-
Notifications
You must be signed in to change notification settings - Fork 3
/
forgotChangePwd.php
140 lines (130 loc) · 4.08 KB
/
forgotChangePwd.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
$defineVariablesPhp = "defineVariables.php";
require $defineVariablesPhp;
require $dbConnectPhp;
require $queryFunctionsPhp;
require $phpFunctionsPhp;
?>
<?php
$msg = NULL;
if(isset($_GET[$sendPwdVerifyCode]) && !is_null($_GET[$sendPwdVerifyCode]))
{
$sendPwdVerifyCodeVal = mysql_real_escape_string($_GET[$sendPwdVerifyCode]);
if($sendPwdVerifyCodeVal == 1)
{//Send Mail for password change
if(isset($_GET[$colEmailId]) && !is_null($_GET[$colEmailId]))
{
$colEmailIdVal = mysql_real_escape_string($_GET[$colEmailId]);
$retSendPwdVerifyCode = sendPwdVerifyCode($colEmailIdVal);
if($retSendPwdVerifyCode == 1)
{//PwdVerifyCode added to db
$msg = "An email will be sent to you in few minutes to reset your password.";
}
elseif($retSendPwdVerifyCode == 2)
{//Could not add PwdVerifyCode to db
$msg = "Could not add PwdVerifyCode to db.";
}
elseif($retSendPwdVerifyCode == 3)
{//Mail couldnot be sent
$msg = "Sorry! Mail couldnot be sent.";
}
}
else
{
$msg = "$colEmailId is not set in GET.";
}
$redirectUrl = $indexPageUrl.'?'.$getMsg.'='.$msg;
echo '<script> window.location.replace("'.$redirectUrl.'"); </script>';
}
elseif($sendPwdVerifyCodeVal == 2)
{//Show Html page
$colPwdVerifyCodeVal = NULL;
if((isset($_GET[$colPwdVerifyCode]) && !is_null($_GET[$colPwdVerifyCode]))
)
{
$colPwdVerifyCodeVal = mysql_real_escape_string($_GET[$colPwdVerifyCode]);
}
else
{
$msg = "$colPwdVerifyCode is not set in GET.";
$redirectUrl = $indexPageUrl.'?'.$getMsg.'='.$msg;
echo '<script> window.location.replace("'.$redirectUrl.'"); </script>';
}
}
elseif($sendPwdVerifyCodeVal == 3)
{//Update Password
if((isset($_GET[$colPwdVerifyCode]) && !is_null($_GET[$colPwdVerifyCode]))
&&(isset($_GET[$colPassword]) && !is_null($_GET[$colPassword]))
)
{
$colPwdVerifyCodeVal = mysql_real_escape_string($_GET[$colPwdVerifyCode]);
$colPasswordVal = mysql_real_escape_string($_GET[$colPassword]);
$retUpdatePwd = updatePwd($colPwdVerifyCodeVal, $colPasswordVal);
if($retUpdatePwd == 2)
{//$colPwdVerifyCode is not present in db
$msg = "$colPwdVerifyCode is not present in db";
}
elseif($retUpdatePwd == 1)
{//Update done
$msg = "Update done";
}
elseif($retUpdatePwd == 3)
{//Could not be updated
$msg = "Could not be updated";
}
else
{
$msg = "Dont know what is wrong.";
}
}
else
{
$msg = "$colPwdVerifyCode or $colPassword not set.";
}
$redirectUrl = $indexPageUrl.'?'.$getMsg.'='.$msg;
echo '<script> window.location.replace("'.$redirectUrl.'"); </script>';
}
else
{
$msg = "$sendPwdVerifyCodeVal not set in GET variable.";
$redirectUrl = $indexPageUrl.'?'.$getMsg.'='.$msg;
echo '<script> window.location.replace("'.$redirectUrl.'"); </script>';
}
}
else
{
$msg = "$sendPwdVerifyCode not set in GET.";
$redirectUrl = $indexPageUrl.'?'.$getMsg.'='.$msg;
echo '<script> window.location.replace("'.$redirectUrl.'"); </script>';
}
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=divice-width, initial-scale=1.0">
<title>Nishi Agarwal</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/customIndex.css">
</head>
<body>
<div class="container">
<section>
<div class="row">
<h2><?php echo $msg; ?></h2>
</div>
</section>
<section>
<div class="row">
<form action="forgotChangePwd.php" method="GET" enctype="multipart/form-data">
<input name=<?php echo '"'.$colPassword.'"'; ?> class="form-control" placeholder="New Password"/>
<br>
<input type="submit" class="btn btn-default" value="Submit"/>
<input name=<?php echo '"'.$colPwdVerifyCode.'"'; ?> value=<?php echo '"'.$colPwdVerifyCodeVal.'"' ?> class="display-hidden" placeholder=""/>
<input name=<?php echo '"'.$sendPwdVerifyCode.'"'; ?> value="3" class="display-hidden" placeholder=""/>
<br>
</form>
</div>
</section>
</div>
</body>
</html>