-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.php
More file actions
68 lines (65 loc) · 2.03 KB
/
send.php
File metadata and controls
68 lines (65 loc) · 2.03 KB
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
61
62
63
64
65
66
67
68
<?php
include 'global.php';
include 'digest.php';
include 'config.php';
require_once "Mail.php";
require_once "Mail/mime.php";
//Create 10-digit pass
$newPass=mt_rand(1000000000,9999999999);
$newDigest=digest($newPass);
$user=(trim(strtolower($_POST['userName'])));
$invalidUser=(preg_match('/[^a-zA-Z0-9\s@.-_+]/', $user));
list($emailName,$mailDomain)=explode("@",$user);
if($user)
{
if(!$invalidUser)
{
if(($mailDomain) && (checkdnsrr($mailDomain,"MX")))
{
$con = mysql_connect($mysqlserver,$mysqluser,$mysqlpass);
if(!$con)
{
die('Could not connect: '.mysql_error());
}
mysql_select_db($mysqldb);
$selectUser =(mysql_query(sprintf("SELECT user FROM users WHERE user='%s'", mysql_real_escape_string($user))));
$checkUser = mysql_fetch_array($selectUser);
if($user == $checkUser['user'])
{
$renew = (sprintf("UPDATE users SET pass='%s' WHERE user='%s'", mysql_real_escape_string($newDigest), mysql_real_escape_string($user)));
if(mysql_query($renew))
{
$from = "ogenboy+dropManagerBot@gmail.com";
$to = $user;
$subject = "Drop Manager Password Recovery";
$body = ("Hello ".$user.",\r\rYou have requested for your password to be reset to a new temporary one. When you log in with this password, you can go and change it to something else in your Control Panel.\r\rNEW PASSWORD: ".$newPass."\r\r");
$host = "localhost";
$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
$smtp = Mail::factory('smtp', array('host' => $host));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo "There has been an error. Please try again.";
} else {
echo "Message has been sent!";
goBack(login);
}
} else {
die('Error: '.mysql_error());
}
} else {
echo "There is no such user";
goBack(recover);
}
} else {
echo "Your e-mail is not valid";
goBack(recover);
}
} else {
echo "E-mail has invalid characters";
goBack(recover);
}
} else {
echo "No e-mail was given";
goBack(recover);
}
?>