-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.php
More file actions
38 lines (33 loc) · 1.04 KB
/
Copy pathinit.php
File metadata and controls
38 lines (33 loc) · 1.04 KB
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
<?php
session_start(); //echo 'init.php ';
$GLOBALS['config'] = array (
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'db' => 'tutorials'
),
'remember' => array(
'cookie_name' => 'hash',
'cookie_expiry' => 604800
),
'session' => array(
'session_name' => 'user',
'token_name' => 'token'
)
);
spl_autoload_register(function($class){
require_once 'file:///C:/wamp/www/tutorials/authentication/ooplr/classes/' . $class . '.php';
});
require_once('file:///C:/wamp/www/tutorials/authentication/ooplr/functions/sanitize.php');
if(Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))){
//echo 'User asked to be remembered';
$hash = Cookie::get(Config::get('remember/cookie_name'));
$hashCheck = DB::getInstance()->get('users_session',array('hash','=',$hash));
if($hashCheck->count()){
//echo 'Hash matches. Log user in.';
//echo "Check";
$user = new User($hashCheck->first()->user_id);
$user ->login();
}
}