/
processbridgecover.php
65 lines (43 loc) · 1.49 KB
/
processbridgecover.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php include 'session.php'; ?>
<!DOCTYPE html>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include 'connection.php';
include 'functions.php';
// check they are allowed to add rotation checks
if ($_POST) {
// go through all the slots and update the database with manager number
foreach ($slots as $name=>$text){
// $name would be 'eight' and $text would be '8:15 - 9:15' as definded in functions.php
$manager = mysqli_real_escape_string($link, $_POST[$name]);
$sql = "REPLACE INTO `bridge` (slot, manager) VALUES ('".$name."','".$manager."')";
if ($link->query($sql) === TRUE) {
debug_to_console("Bridge cover updated successfully");
} else {
echo "Error: " . $sql . "<br>" . $link->error;
}
}
// forward back to index page
?>
<script type="text/javascript">
location.href = 'bridgecover.php';
</script>
<?php
}
if(isset($_GET['remove'])){
$sql = "DELETE FROM handovers WHERE id = ".$_GET['remove'];
if ($link->query($sql) === TRUE) {
echo "Handover removed successfully";
} else {
echo "Error: " . $sql . "<br>" . $link->error;
}
// forward back to index page
?>
<script type="text/javascript">
location.href = 'viewhandovers.php';
</script>
<?php
}
?>