-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
58 lines (52 loc) · 1.89 KB
/
index.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
53
54
55
56
57
58
<?php
require_once('includes/config.php');
require_once('includes/functions.php');
if (!is_logged() && isset($_COOKIE['login_hash']) && $_COOKIE['login_hash'] != 0) {
$hash = $_COOKIE['login_hash'];
$_SESSION['user_id'] = $GLOBALS['link']->query("SELECT `user_id` FROM `login_hashes` WHERE `hash` = '{$hash}'")->fetch()['user_id'];
}
if (is_logged()) {
$CUR_USER = get_user_row_by_id($_SESSION['user_id']);
update_last_seen();
}
?>
<?php if (!isset($_GET['page'])) : ?>
<?php if (is_logged()) : ?>
<?php include 'views/index/logged.php'; ?>
<?php else : ?>
<?php include 'views/index/default.php'; ?>
<?php endif; ?>
<?php else: ?>
<?php if ($_GET['page'] == 'signin') : ?>
<?php include 'login.php'; ?>
<?php elseif ($_GET['page'] == 'join') : ?>
<?php include 'signup.php'; ?>
<?php elseif ($_GET['page'] == 'logout') : ?>
<?php
logout();
header("Location: " . $URL);
?>
<?php else : ?>
<?php
if (!is_logged()) {
header("Location: " . $URL);
}
?>
<?php if ($_GET['page'] != 'premium') : ?>
<?php include 'views/header.php'; ?>
<?php
switch ($_GET['page']) {
case 'profile' :
include 'views/profile.php';
break;
case 'conversation' :
include 'views/chatbox.php';
break;
}
?>
<?php include 'views/footer.php'; ?>
<?php else : ?>
<?php include 'views/premium.php'; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>