-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
map.php
52 lines (42 loc) · 1.21 KB
/
map.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
<?php
// written by sqall
// twitter: https://twitter.com/sqall01
// blog: https://h4des.org/blog
// github: https://github.com/sqall01
//
// Licensed under the GNU Affero General Public License, version 3.
require_once(__DIR__ . "/config/config.php");
require_once(__DIR__ . "/lib/helper.php");
require_once(__DIR__ . "/lib/objects.php");
require_once(__DIR__ . "/lib/output.php");
// Set global settings.
date_default_timezone_set("UTC");
// Start session.
$cookie_conf = session_get_cookie_params();
session_set_cookie_params($cookie_conf["lifetime"], // lifetime
$cookie_conf["path"], // path
$cookie_conf["domain"], // domain
TRUE, // secure
TRUE); // httponly
session_start();
$mysqli = new mysqli(
$config_mysql_server,
$config_mysql_username,
$config_mysql_password,
$config_mysql_database,
$config_mysql_port);
if($mysqli->connect_errno) {
die("Database error.");
}
// Authenticate user.
$user_id = auth_user($mysqli);
// User authentication failed.
if($user_id < 0) {
chasr_session_destroy();
output_login_redirect();
}
// User authentication successful.
else {
output_map();
}
?>