-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
44 lines (39 loc) · 1.23 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
<!--
File Name: delete.php
Author's Name: Sukhdeep Singh
Web Site Name: My Portfolio
File Description: This page deletes the selected contacts from the database
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Delete Admin</title>
</head>
<body>
<?php
//access current session
session_start();
//evaluate the user_id stored in the session that was set on validate.php
if(empty($_SESSION['user_id']))
{
header('Location:login.php');
}
$conn = mysqli_connect('webdesign4','dbxxxxxxxxx','xxxxx','dbxxxxxxxxx') or die('Connect Error');
//grab the id from url
$id = $_GET['id'];
//write the sql
$sql = "DELETE FROM business_contacts WHERE id = $id";
//check and ensure that id is numeric
if(is_numeric($id))
{
//run the deletion
mysqli_query($conn,$sql);
//disconnect
mysqli_close($conn);
}
//redirect to the contacts page
header('Location:business.php');
?>
</body>
</html>