-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal.php
More file actions
85 lines (84 loc) · 2.48 KB
/
Copy pathglobal.php
File metadata and controls
85 lines (84 loc) · 2.48 KB
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
82
83
84
85
<?php
session_start();
include('db.php');
include('query.php');
$database = new db();
//User Checker
if (isset($_REQUEST["user"]))
{
$username = $_REQUEST['user'];
$count = $database->get_row(sprintf(USER_CHECK, $username));
if ($count['count'] != 0)
{
echo "Username already exists.";
}
}
//Register
else if(isset($_REQUEST["u"]) && isset($_REQUEST["p"]))
{
$database->others(sprintf(USER_INSERT,$_REQUEST["u"], $_REQUEST["p"]));
}
else if(isset($_REQUEST["lu"]) && isset($_REQUEST["lp"]))
{
$username = $_REQUEST['lu'];
$password = $_REQUEST['lp'];
$count = $database->get_row(sprintf(USER_PASS_CHECK, $username, $password));
if ($count['count'] == 0)
{
echo "Invalid Username/Password";
}
else
{
$_SESSION['username'] = $username;
echo "";
}
}
else if(isset($_REQUEST["logout"]))
{
$_SESSION['username'] = null;
}
else if(isset($_REQUEST["fill"]))
{
$reserve = $database->get_multi_row(RESERVATION);
$result = "";
foreach($reserve as $row)
{
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['contact']."</td>";
echo "<td>".$row['pname']."</td>";
echo "<td><input class='btn btn-success' type='button' data-value=".$row['id']." onclick='acceptRes($(this).data().value)' name='accept' value='Accept'><input class='btn btn-danger' type='button' data-value=".$row['id']." onclick='deleteRes($(this).data().value)' name='delete' value='Delete'></td>";
echo "</tr>";
}
echo $result;
}
else if(isset($_REQUEST["fill1"]))
{
$reserve = $database->get_multi_row(RESERVATION1);
$result = "";
foreach($reserve as $row)
{
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['contact']."</td>";
echo "<td>".$row['pname']."</td>";
echo "<td><input class='btn btn-danger' type='button' data-value=".$row['id']." onclick='cancelRes($(this).data().value)' name='delete' value='Cancel'></td>";
echo "</tr>";
}
echo $result;
}
else if(isset($_REQUEST["updateRes"]))
{
$database->others(sprintf(UPDATE_RESERVE, $_REQUEST["updateRes"]));
}
else if(isset($_REQUEST["deleteRes"]))
{
$database->others(sprintf(DELETE_RESERVE, $_REQUEST["deleteRes"]));
}
else if(isset($_REQUEST["cancelRes"]))
{
$database->others(sprintf(UN_RESERVE, $_REQUEST["cancelRes"]));
}
?>