-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-data.php
40 lines (25 loc) · 891 Bytes
/
delete-data.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
<?php
function delete_data(){
$db = llg_db_connection();
if (!isset ($_POST['event_id'])) {
echo 'E898: No event id';
exit();
}
$pass = mysqli_real_escape_string($db, $_POST['password']);
$event_id = mysqli_real_escape_string($db, $_POST['event_id']);
$event_name = mysqli_real_escape_string($db, $_POST['event_name']);
if (!isset ($pass)) {
exit();
}
if(!llg_validate_pass($db, $event_id, $pass)){
exit();
}
$res = mysqli_query($db, 'SELECT wp_page_id FROM `events` WHERE id="'.$event_id.'"') or die (mysqli_error($db));
$wp_page_id = mysqli_fetch_array($res)[0];
wp_delete_post($wp_page_id, false);
$sql = 'DELETE FROM bookings WHERE event_id="'.$event_id.'"';
mysqli_query($db, $sql) or die (mysqli_error($db));
$sql = 'DELETE FROM events WHERE id="'.$event_id.'"';
mysqli_query($db, $sql) or die (mysqli_error($db));
}
?>