-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·40 lines (35 loc) · 1023 Bytes
/
index.php
File metadata and controls
executable file
·40 lines (35 loc) · 1023 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
35
36
37
38
39
40
<?php
/**
* Main router handles 4 types of requests: app installation * {GET, POST} and
* sign-in * {GET, POST}. When ga-config.php is not present, the request is
* app installation.
*
* @author Xiangyu Bu <xybu92@live.com>
*/
$START_TIME = microtime();
// If the system is not set up yet, run the installer.
if (!file_exists(getcwd() . "/ga-data/ga-config.php"))
{
// Pass control to Installer and exit.
require_once "ga-include/ga-installer.php";
$installer = new Installer();
exit();
}
// If this fails, a fatal error E_COMPIL_ERROR will occur.
// It cannot be handled by user code. So after installation, test
// before use.
require_once "ga-data/ga-config.php";
require_once "ga-include/ga-session.php";
$session = new Session();
if ($session->IsHttpGet()) {
// Render sign-in page
$session->ShowSignInPage();
exit();
} else {
if (!$session->TestSignIn())
$session->JSON_OutputError('wrong-password', 'The password you typed is incorrect.');
else {
header('HTTP/1.1 200 OK');
exit();
}
}