-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeleteac.php
51 lines (51 loc) · 1.2 KB
/
deleteac.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
<div id="code">
<div id="code-st">
<?php
include('session.php');
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="contentbox" >
<script type="text/javascript">
function countdown() {
var i = document.getElementById('timecount');
if (parseInt(i.innerHTML)<=1) {
location.href = 'index.php';
}
i.innerHTML = parseInt(i.innerHTML)-1;
}
setInterval(function(){ countdown(); },1000);
</script>
<?php
include ('db.php');
$id=$loggedin_id;
$deltable="SELECT username FROM member WHERE mem_id='$id'";
$yoman=mysqli_query($db,$deltable);
$row=mysqli_fetch_assoc($yoman);
$deletbl="DROP TABLE " . $row["username"] . " ";
mysqli_query($db,$deletbl);
$sql="DELETE FROM member WHERE mem_id='$id'";
$result=mysqli_query($db,$sql);
if($result){
echo "<div align='center'>";
echo "Account Deleted Successfully. You will be redirected to main page in <div id=\"timecount\">10</div> <u>seconds.</u>";
echo "<p><a href='index.php' >Click here</a> to go back.</p>";
echo "</div>";
}
elseif(!isset($loggedin_session) || $loggedin_session==NULL)
{
header("Location: index.php");
}
else {
echo "Unable to delete Your Account";
}
?>
<?php
mysqli_close($db);
?>
</div>
</div>
</div>