-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
25 lines (25 loc) · 965 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
<?php
include("database/db.php");
$id = $_GET['id'];
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query = "DELETE FROM employees WHERE id = $id";
$result = mysqli_query($conn, $query);
if (!$result) {
die("Query failed");
}
$value = $id;
$url = "https://ICXCandidate:Welcome2021@imaginecx--tst2.custhelp.com/services/rest/connect/v1.3/contacts/$value";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$result = json_decode($result);
curl_close($ch);
$_SESSION['message'] = 'Employee removed successfully';
$_SESSION['message_type'] = 'danger';
header("Location: index.php");
}
?>