-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_password.php
41 lines (32 loc) · 1.14 KB
/
forgot_password.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Created by PhpStorm.
* User: MAARTEN
* Date: 13-10-2018
* Time: 10:08
*/
require 'core/QueryBuilder.php';
//variables
$email = $_POST['email'];
$Query_builder = new QueryBuilder();
$link = $Query_builder->forgotPass($email);
//if it's not empty show result
if($link!=-1){
//WARNING replace localhost when upload on the cloud or the server!!!
//Only works for localhost 7777 if you use another one you fail.
$msg = "Please click on this link to change your password. If you do not click this beautiful link it will expire in 2 days\n\n" . "http://localhost:7777/views/new_password.view.php?id=" . $link;
// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
// send email
mail($email,"forgot password",$msg);
echo "<br/>";
echo "<div class=\"alert alert-success\" role=\"alert\">";
echo "<p><i>Email is verstuurd</i></p>";
echo "<p><i>Wanneer je email is verstuurd, volg de instructie in de email om je wachtwoord te reseten.</i></p>";
echo "</div>";
}else {
echo "<br/>";
echo "<div class=\"alert alert-danger\">";
echo "<p><i>Email incorect</i></p>";
echo "</div>";
}