-
Notifications
You must be signed in to change notification settings - Fork 0
/
pass.php
48 lines (35 loc) · 1016 Bytes
/
pass.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
<?php
include('connect.php');
$uname = $_POST["username"];
$pass = $_POST["new_password"];
$sql1 = ("SELECT * FROM lightapp");
$result = mysqli_query($conn, $sql1);
while ($row = mysqli_fetch_array($result)) {
$noname = $row['username'] ;
}
if ($noname == $uname )
{
{
$sql2 = "UPDATE lightapp
SET password='$pass'
WHERE username='$uname'";
}
if (mysqli_query($conn, $sql2))
{
echo '<script type="text/javascript">';
echo 'alert("Password reset Success please Login Now");';
echo 'window.location.href = "./login.html";';
echo '</script>';
}
else {
echo "ERROR: Hush! Sorry $sql2. "
. mysqli_error($conn);
}
}
else {
echo '<script type="text/javascript">';
echo 'alert("Email Doesnot Exist please Enter Right Email");';
echo 'window.location.href = "./pass.html";';
echo '</script>';
}
?>