-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroutes.php
More file actions
34 lines (29 loc) · 794 Bytes
/
routes.php
File metadata and controls
34 lines (29 loc) · 794 Bytes
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
<?php
set_include_path('.:lib:example');
function __autoload($class) {
include $class . '.php';
}
include_once('config.php');
$exec_start = microtime(true);
$request = $_SERVER['SCRIPT_NAME'];
PnmLogger::debug("Request: " . print_r($_SERVER['REQUEST_URI'], true));
# Route the incoming requests to a handler
switch ($request) {
case '/authorize':
$pnm = new ExampleAuthorizationCallbackHandler(SECRET, $_GET);
break;
case '/confirm':
$pnm = new ExampleConfirmationCallbackHandler(SECRET, $_GET);
break;
default:
return false;
}
# Handle request and output result
echo $pnm->handleRequest();
$exec_time = (microtime(true) - $exec_start);
PnmLogger::debug("Request took $exec_time seconds");
if ($exec_time >= 6) {
PnmLogger::warn("Request took longer than 6 seconds!");
}
exit();
?>