-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
27 lines (21 loc) · 848 Bytes
/
delete.php
File metadata and controls
27 lines (21 loc) · 848 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
<?php
session_start();
session_destroy();
require_once "database.php";
require_once 'twig.php';
$conn = connection();
if(!isset($_SESSION["username"]))
echo $twig->render("pesan.html", array("pesan"=>"Anda belum login"));
$query = $conn->prepare("select * from register where username=?");
$query->bind_param("s", $_SESSION['username']);
$result = $query->execute();
if($result)
$rows = $query->get_result();
$query = $conn->prepare("delete from register where username=?");
$query->bind_param("s", $_SESSION['username']);
$result = $query->execute();
if($result)
echo $twig->render("pesan.html", array("pesan"=>"User telah dihapus"));
else
echo $twig->render("pesanRegister.html", array("pesan"=>"Gagal menghapus user"));
?>