forked from dilanWijerathne/phpmyreservation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreservation.php
81 lines (68 loc) · 2.62 KB
/
reservation.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
include_once('main.php');
if(check_login() != true) { exit; }
if(isset($_GET['make_reservation']))
{
$week = mysql_real_escape_string($_POST['week']);
$day = mysql_real_escape_string($_POST['day']);
$time = mysql_real_escape_string($_POST['time']);
echo make_reservation($week, $day, $time);
}
elseif(isset($_GET['delete_reservation']))
{
$week = mysql_real_escape_string($_POST['week']);
$day = mysql_real_escape_string($_POST['day']);
$time = mysql_real_escape_string($_POST['time']);
echo delete_reservation($week, $day, $time);
}
elseif(isset($_GET['read_reservation']))
{
$week = mysql_real_escape_string($_POST['week']);
$day = mysql_real_escape_string($_POST['day']);
$time = mysql_real_escape_string($_POST['time']);
echo read_reservation($week, $day, $time);
}
elseif(isset($_GET['read_reservation_details']))
{
$week = mysql_real_escape_string($_POST['week']);
$day = mysql_real_escape_string($_POST['day']);
$time = mysql_real_escape_string($_POST['time']);
echo read_reservation_details($week, $day, $time);
}
elseif(isset($_GET['week']))
{
$week = $_GET['week'];
echo '<table id="reservation_table"><colgroup span="1" id="reservation_time_colgroup"></colgroup><colgroup span="7" id="reservation_day_colgroup"></colgroup>';
$days_row = '<tr><td id="reservation_corner_td"><input type="button" class="blue_button small_button" id="reservation_today_button" value="Today"></td>';
$i = 0;
while ($i < global_week_days_count) {
$days_row .= '<th class="reservation_day_th">' . $global_week_days[$i] . '</th>';
$i++;
}
$days_row .= '</tr>';
if($week == global_week_number)
{
echo highlight_day($days_row);
}
else
{
echo $days_row;
}
foreach($global_times as $time)
{
echo '<tr><th class="reservation_time_th">' . $time . '</th>';
$i = 0;
while($i < global_week_days_count)
{
$i++;
echo '<td><div class="reservation_time_div"><div class="reservation_time_cell_div" id="div:' . $week . ':' . $i . ':' . $time . '" onclick="void(0)">' . read_reservation($week, $i, $time) . '</div></div></td>';
}
echo '</tr>';
}
echo '</table>';
}
else
{
echo '</div><div class="box_div" id="reservation_div"><div class="box_top_div" id="reservation_top_div"><div id="reservation_top_left_div"><a href="." id="previous_week_a">< Previous week</a></div><div id="reservation_top_center_div">Reservations for week <span id="week_number_span">' . global_week_number . '</span></div><div id="reservation_top_right_div"><a href="." id="next_week_a">Next week ></a></div></div><div class="box_body_div"><div id="reservation_table_div"></div></div></div><div id="reservation_details_div">';
}
?>