-
Notifications
You must be signed in to change notification settings - Fork 71
/
scan.php
46 lines (41 loc) · 1.07 KB
/
scan.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
<?php
require("config.php");
require("db.class.php");
require('actions-qrcode.php');
$db=new Database($dbserver,$dbuser,$dbpassword,$dbname);
$db->connect();
if (isset($_COOKIE["loguserid"])) {
$userid = $db->conn->real_escape_string(trim($_COOKIE["loguserid"]));
} else {
$userid = 0;
}
if (isset($_COOKIE["logsession"])) {
$session = $db->conn->real_escape_string(trim($_COOKIE["logsession"]));
} else {
$session = '';
}
$request=substr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],".php")+5);
$request=explode("/",$request);
$action=$request[0];
if (isset($request[1])) $parameter=$request[1];
else $action=""; // mangled QR code, clear action
switch($action)
{
case "rent":
logrequest($userid,$action);
checksession();
$bikeno=$parameter;
checkbikeno($bikeno);
rent($userid,$bikeno);
break;
case "return":
logrequest($userid,$action);
checksession();
$stand=$parameter;
checkstandname($stand);
returnbike($userid,$stand);
break;
default:
unrecognizedqrcode($userid);
}
?>