-
Notifications
You must be signed in to change notification settings - Fork 36
/
deact.php
66 lines (66 loc) · 1.8 KB
/
deact.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
<html>
<head>
<title>Deactivate account</title>
<link rel="stylesheet" href="css/main.css">
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/main.js"></script>
<style type="text/css">
a:link {color: #ffffff}
a:visited {color: #ffffff}
a:hover {color: #ffffff}
a:active {color: #ffffff}
</style>
</head>
<body>
<?php
session_start();
include("header.php"); ?>
<form id="login-form" class="login-form" name="form1" method="post" action="deact.php">
<div id="form-content">
<div class="welcome">
Do you sure you wish to deactivate your account?
<br />
Email ID: <input type="text" name="email"><br/>
Password: <input type="password" name="password"><br/><br/><br/>
<center><input type="submit" name="submit" value="Deactivate account"></center>
</div>
</div>
</form>
</body>
</html>
<?php
if (isset($_POST['submit']))
{
$email=$_POST['email'];
$password=$_POST['password'];
$connect = mysql_connect("localhost","root","");
mysql_select_db("foodies") or die("couldn't find database");
$query = mysql_query("select * from php_users_login where email='$email'");
$numrows = mysql_num_rows($query);
if($numrows!=0)
{
while($row = mysql_fetch_assoc($query))
{
$dbemail = $row['email'];
$dbpassword = $row['password'];
}
if($email==$dbemail&&$password==$dbpassword)
{
$sql1 ="DELETE FROM `php_users_login` WHERE email='$dbemail';";
if(mysql_query($sql1))
{
echo "<script type='text/javascript'>alert('User deleted successfully');</script>";
}
else
{
echo "<script type='text/javascript'>alert('Could not delete user');</script>";
}
}
else
echo "<script type='text/javascript'>alert('Incorrect password');</script>";
}
else
echo "<script type='text/javascript'>alert('User does not exist');</script>";
}
?>