-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhavingTrouble.php
199 lines (152 loc) · 5.59 KB
/
havingTrouble.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Forgot Password | Can't login | KConnect</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" title="Red" href="KnowledgeSharing/KShop/style_green.css" />
<script src="KnowledgeSharing/KShop/styleswitch.js" type="text/javascript"></script>
<script src="KnowledgeSharing/KShop/LoginValidation.js"></script>
<script src="WelcomeValidation.js"></script>
<!-- PHP code to compare email id from the textbox with email id from database -->
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$mailid=$_POST["email1"];
$qns=$_POST["secqns"];
$ans=$_POST["secans"];
$hostname="student-db.cse.unt.edu";
$user="hk0367";
$pwd="hk0367";
$nameErr= $uname = $passErr = $pwd1 = "";
if($database=mysql_connect($hostname,$user,$pwd))
{
$conn=mysql_select_db("hk0367");
if (empty($_POST["euid"]))
{
$nameErr = "euid is required";
}
else
{
$uname = $_POST["euid"];
$result=mysql_query("select Password from registerTable where UntId='$uname'");
$row=mysql_fetch_assoc($result);
$passw= $row['Password'];
$result1=mysql_query("select Username from user where UntId='$uname'");
$row1=mysql_fetch_assoc($result1);
$fname=$row1['Username'];
session_start();
$_SESSION['username1']=$uname;
$_SESSION['firstname']=$fname;
if (empty($_POST["Password"]))
{
$passErr = "Password is required";
}
else
{
$pwd1= $_POST["Password"];
if(strcmp($pwd1,$passw)== 0)
{
header("Location:MainPage.php");
mysql_close($database);
}
else
{
$passErr = "username or password is wrong";
}
}
}
// Code for Forgot password and error message display
$result0=mysql_query("select Password from registerTable where Email='$mailid' AND Secqns='$qns' AND Secans='$ans';");
$row1=mysql_fetch_assoc($result0);
if(mysql_num_rows($result0)==0)
{
$err = "Oops!!! there is no PASSWORD registered with the given details...";
}
else
{
$data1=$row1['Password'];
}
}
}
?>
</head>
<body>
<div id="header">
<div id="header_inner" class="fixed">
<div id="logo">
<a href="index.php"><h1 style="font-size:60px;"><span>KConnect</span></h1></a>
</div>
<div id="menu" style="bottom: 0.1em;">
<form id="form1" name='login' method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table cellspacing="5">
<tbody>
<tr>
<td><label for="euid" style="font-size:medium; font-weight:bold; color:white"> UNT ID </label></td>
<td><label for="Password" style="font-size:medium; font-weight:bold; color:white"> Password </label></td>
</tr>
<tr cellspacing="5">
<td><input type="text" name="euid" placeholder="UNT ID"></td>
<td><input type="password" name="Password" Placeholder="Password"></td>
</tr>
<!--<tr>
<td><span class="error" style="color:white"> <?php echo $nameErr;?></span></td>
<td><span class="error" style="color:white"> <?php echo $passErr;?></span></td>
</tr>-->
<tr>
<td><input type="submit" value=" Log in " style="font-size:small"></td> <!-- On Click should redirect to Home Page -->
<td><a href="havingTrouble.php" style="color:white; font-size:medium">Having trouble ?</a></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<div id="main">
<div id="main_inner" class="fixed">
<div id="primaryContent_2columns">
<div id="columnA_2columns">
<br class="clear" />
<div class="post">
<h3 style="font-family:Comic Sans MS;">Your Password is :</h3>
<span class="error" Style="font-family:Comic Sans MS; font-size:large; font-weight:bold"> <?php echo $data1;?> </span>
<span class="error" Style="font-family:Comic Sans MS; font-size:large; color:Red"> <?php echo $err;?> </span>
<p> </p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<fieldset>
<legend style="font-family:Monotype Corsiva; font-size:large"> Find Your Account </legend>
<table>
<tr>
<td><label for="email1"> Email </label></td>
<td><label for="secqns"> Security Question </label></td>
<td><label for="secans"> Security Answer </label></td>
</tr>
<tr>
<td><input type="email" name="email1" Placeholder="Enter your registered mailID"></td>
<td>
<select name="secqns">
<option selected="" value="Default">(Please select a security question)</option>
<option> What is your first pet name ? </option>
<option> Who is your inspiration ? </option>
<option> What is your favourite color ? </option>
<option> Where are you from ? </option>
</select>
</td>
<td><input type="text" name="secans" Placeholder="Enter your security answer"></td>
</tr>
<tr>
<td><input type="submit" class="button" value=" Search " style="font-size:small; width: 7em; height: 2em;"></td>
<td><a href="index.php"><input type="button" class="button" value="Close" style="font-size:small; width: 7em; height: 2em;"></a></td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
</div>
<br class="clear" />
</div>
</div>
<div id="footer" class="fixed"> Copyright © 2016 KConnect Website. All rights reserved. </div>
</body>
</html>