-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete-user.php
More file actions
41 lines (32 loc) · 769 Bytes
/
delete-user.php
File metadata and controls
41 lines (32 loc) · 769 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Delete from news</title>
</head>
<body>
</body>
<?php
require_once 'db.php';
$conn = konek_db();
if(!isset($_GET['username']))
die("Tidak ditemukan username");
$username =$_GET['username'];
$query = $conn->prepare("select * from user where username=?");
$query->bind_param('s',$username);
$result = $query->execute();
if(!$result)
die("Gagal query");
$rows = $query->get_result();
if($rows->num_rows == 0)
die("user tidak detemukan");
$query = $conn->prepare("delete from user where username=?");
$query->bind_param('s',$username);
$result=$query->execute();
if($result)
header("Location:admin.php");
else
echo "<p>Gagl mendelete user</p>";
?>
<a href="admin.php"><button>Back to Admin Page</button></a>
</body>
</html>