-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete-account.php
58 lines (45 loc) · 1.55 KB
/
delete-account.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
<?php
session_start();
if(isset($_SESSION["user"])){
if(($_SESSION["user"])=="" or $_SESSION['usertype']!='p'){
header("location: ../login.php");
}else{
$useremail=$_SESSION["user"];
}
}else{
header("location: ../login.php");
}
//import database
include("../connection.php");
$sqlmain= "select * from patient where pemail=?";
$stmt = $database->prepare($sqlmain);
$stmt->bind_param("s",$useremail);
$stmt->execute();
$userrow = $stmt->get_result();
$userfetch=$userrow->fetch_assoc();
$userid= $userfetch["pid"];
$username=$userfetch["pname"];
if($_GET){
//import database
include("../connection.php");
$id=$_GET["id"];
$sqlmain= "select * from patient where pid=?";
$stmt = $database->prepare($sqlmain);
$stmt->bind_param("i",$id);
$stmt->execute();
$result001 = $stmt->get_result();
$email=($result001->fetch_assoc())["pemail"];
$sqlmain= "delete from webuser where email=?;";
$stmt = $database->prepare($sqlmain);
$stmt->bind_param("s",$email);
$stmt->execute();
$result = $stmt->get_result();
$sqlmain= "delete from patient where pemail=?";
$stmt = $database->prepare($sqlmain);
$stmt->bind_param("s",$email);
$stmt->execute();
$result = $stmt->get_result();
//print_r($email);
header("location: ../logout.php");
}
?>