forked from omermaksutii/olux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
passform.php
60 lines (49 loc) · 2.25 KB
/
passform.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
ob_start();
session_start();
include "includes/config.php";
date_default_timezone_set('UTC');
error_reporting(0);
if(isset($_SESSION['sname']) and isset($_SESSION['spass'])){
header("location: buyer/index.html");
exit();
}
$email = mysqli_real_escape_string($dbcon, strip_tags($_POST['email']));
$finder = mysqli_query($dbcon, "
SELECT * FROM users WHERE email='$email' ") or die("mysql error");
if(mysqli_num_rows($finder) != 0){
$row = mysqli_fetch_assoc($finder);
$user = $row['username'];
$random = substr(md5(mt_rand()), 0, 40);
// Plusieurs destinataires
$to = "$email";
// Sujet
$subject = 'Password reset request';
// message
$message = '
Hello <b>'.$row['username'].'</b><br><br>
Please confirm that you have submitted the password reset request. <br><br>
Open this link in your browser in order to complete password reset proccess<br>
https://jerux.to/reset.html?code='.$random.'&user='.$row['username'].'<br>
+================+<br>
Best Regards,<br>
<b>JeruxSHOP Team</b><br>
This e-mail is sent automatically by our system. Please do not reply.<br>
at '.date('m/d/Y h:i:s a', time()).'
';
// Pour envoyer un mail HTML, l'en-tête Content-type doit être défini
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'X-PHP-Script: ';
// En-têtes additionnels
$headers[] = 'From: JeruxShop <noreply@jerux.to>';
// Envoi
mail($to, $subject, $message, implode("\r\n", $headers));
$sql = mysqli_query($dbcon, "UPDATE users SET resetpin='$random' WHERE email='$email'");
$errorbox = "<div class='alert alert-dismissible alert-success'><button type='button' class='close' data-dismiss='alert'>×</button><p>We have sent an e-mail with a confirmation link to you. Please check your e-mail address!</p></div>";
echo '{"state":"1","errorbox":"'.$errorbox.'","url":"login.html"}';
} else {
$errorbox = "<div class='alert alert-dismissible alert-info'><button type='button' class='close' data-dismiss='alert'>×</button><p>This email doesn't exist!</p></div>";
echo '{"state":"0","errorbox":"'.$errorbox.'","url":""}';
}
?>