-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
52 lines (47 loc) · 1.27 KB
/
ajax.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
<?php require_once('Connections/HMS.php'); ?>
<?php
mysql_select_db($database_HMS, $HMS);
if(isset($_POST['function']))
{
if($_POST['function'] == "ForgotEmail")
{
if(isset($_POST['email']))
{
$query = "SELECT * FROM users WHERE recoveryEmail LIKE '".mysql_real_escape_string($_POST['email'])."'";
$password = mysql_query($query, $HMS) or die(mysql_error());
$totalRows = mysql_num_rows($password);
if($totalRows == 1)
{
$row_password = mysql_fetch_assoc($password);
$message = "
Your password for the HMS login has been recovered!
The password is :
<strong>".$row_password['password']."</strong>
You can go ahead and use this password to login to our site.
Have a good Day.
-Admin
HMS Webmaster";
$emailId = $row_password['recoveryEmail'];
mail($emailId,"HMS Password Recovery",$message,"From:HMSAdmin <[email protected]>");
echo("Email containing the password successfully sent to $emailId");
exit(0);
}else{
echo("The specified email id does not exist!");
exit(0);
}
mysql_free_result($password);
}else{
echo("Insufficient parameters!");
}
}
if($_POST['function'] == "SomethingElse")
{
//Add your custom ajax functions here
}
else{
echo("Invalid paramenters!");
}
}else{
echo("Invalid paramenters!");
}
?>