-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInit.php
36 lines (31 loc) · 947 Bytes
/
Init.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
<?php
session_start();
$GLOBALS['config'] = array(
'mysql' => array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'db' => 'reportify'
),
'remember' => array(
'cookie_name' => 'Reportify',
'cookie_expiry' => 604800
),
'session' => array(
'session_name' => 'user',
'token_name' => 'token',
'session_expiry' => 900
)
);
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
require_once 'functions/functions.php';
if(Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))) {
$hash = Cookie::get(Config::get('remember/cookie_name'));
$hashCheck = DB::getInstance()->get('users_session', array('hash', '=', $hash));
if($hashCheck->count()) {
$user = new User($hashCheck->first()->user_id);
$user->login();
}
}