forked from leftypol/leftypol
first commit
This commit is contained in:
commit
3d92990b18
12 changed files with 1344 additions and 0 deletions
16
inc/user.php
Normal file
16
inc/user.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
session_name(SESS_COOKIE);
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['created'])) $_SESSION['created'] = time();
|
||||
|
||||
if(!isset($_COOKIE[HASH_COOKIE]) || !isset($_COOKIE[TIME_COOKIE]) || $_COOKIE[HASH_COOKIE] != md5($_COOKIE[TIME_COOKIE].SALT)) {
|
||||
$time = time();
|
||||
setcookie(TIME_COOKIE, $time, time()+COOKIE_EXPIRE, '/', null, false, true);
|
||||
setcookie(HASH_COOKIE, md5(time().SALT), time()+COOKIE_EXPIRE, '/', null, false, true);
|
||||
$user = Array('valid' => false, 'appeared' => $time);
|
||||
} else {
|
||||
$user = Array('valid' => true, 'appeared' => $_COOKIE[TIME_COOKIE]);
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue