-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsuccess.php
More file actions
40 lines (26 loc) · 944 Bytes
/
success.php
File metadata and controls
40 lines (26 loc) · 944 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
<?php
include 'db_conn.php';
if(isset($_GET["successId"])){
$id = $_GET["successId"];
$dateEnd = date('M-d-Y', strtotime('now'));
$sql = "INSERT INTO `log` (`name`, `position`, `service`, `dateCreated`, `dateEnd`, `state`)
SELECT `name`,`position`,`service`,`date`,'$dateEnd','Success'
FROM `appointments`
WHERE `id` = '$id'";
$result = mysqli_query($conn, $sql);
if ($result) {
$sql2 = "DELETE FROM `appointments` WHERE `id` = '$id'";
$result2 = mysqli_query($conn, $sql2);
if ($result2) {
echo '<script type="text/javascript">';
echo 'alert("Appointment id ('.$id.') done successfully and moved to logs!");';
echo 'window.location.href = "appointments.php";';
echo '</script>';
} else {
die(mysqli_error($conn));
}
} else {
die(mysqli_error($conn));
}
}
?>