-
-
Notifications
You must be signed in to change notification settings - Fork 251
/
logout.php
44 lines (33 loc) · 956 Bytes
/
logout.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
<?php
include 'config/declare.php';
include_once 'config/class/needy_class.php';
include 'config/class/universal.class.php';
include 'config/class/login.class.php';
?>
<?php
$universal = new universal;
$login = new login_class;
?>
<?php
if(isset($_SESSION['id'])){
if (!isset($_COOKIE['ids'])) {
setcookie("ids", json_encode(array($_SESSION['id'])), time()+30*24*60*60);
} else if (isset($_COOKIE['ids'])) {
$arr = array();
$ids = json_decode($_COOKIE['ids']);
foreach ($ids as $value) {
$arr[] = $value;
}
array_push($arr, $_SESSION['id']);
setcookie("ids", json_encode(array_unique($arr)), time()+30*24*60*60);
}
// setcookie("ids", null, time()-30*24*60*60);
}
?>
<?php
if ($universal->isLoggedIn()) {
$login->LOGOUT();
} else if ($universal->isLoggedIn() == false) {
header('Location: welcome');
}
?>