-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
32 lines (23 loc) · 899 Bytes
/
delete.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
<?php
//error_reporting(E_ALL);
session_start();
$referer = filter_var($_SERVER['HTTP_REFERER'], FILTER_VALIDATE_URL);
$referer_parsed_path = parse_url($referer, PHP_URL_PATH);
// $referer_parsed = (isset($referer_parsed['path']) ? $e['path'] : '/');
$referer_parsed_path = preg_replace(array('/^\//','/\/$/'), "", $referer_parsed_path);
if(isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: index.php");
}
include "db_connect.php";
$userid = $_SESSION['user_id'];
$retainerid = mysqli_real_escape_string($conn, $_GET['id']);
$sql = "DELETE FROM `user-retainers` WHERE `USER-Retainer-ID` LIKE ? AND `User` LIKE ?";
if($stmt = mysqli_prepare($conn,$sql)){
mysqli_stmt_bind_param($stmt, "ii", $retainerid, $userid);
mysqli_stmt_execute($stmt);
}
echo $retainerid;
header("location:$referer_parsed_path");
?>