-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
86 lines (70 loc) · 2.67 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once 'assets/php/functions.php';
if(isset($_GET['newfp'])){
unset($_SESSION['auth_temp']);
unset($_SESSION['forgot_email']);
unset($_SESSION['forgot_code']);
}
if(isset($_SESSION['Auth'])){
$user = getUser($_SESSION['userdata']['id']);
$posts = filterPosts();
$follow_suggestions = filterFollowSuggestion();
}
$pagecount = count($_GET);
//manage pages
if(isset($_SESSION['Auth']) && $user['ac_status']==1 && !$pagecount){
showPage('header',['page_title'=>'Home']);
showPage('navbar');
showPage('wall');
}elseif(isset($_SESSION['Auth']) && $user['ac_status']==0 && !$pagecount){
showPage('header',['page_title'=>'Verify Your Email']);
showPage('verify_email');
}elseif(isset($_SESSION['Auth']) && $user['ac_status']==2 && !$pagecount){
showPage('header',['page_title'=>'Blocked']);
showPage('blocked');
}elseif(isset($_SESSION['Auth']) && isset($_GET['editprofile']) && $user['ac_status']==1){
showPage('header',['page_title'=>'Edit Profile']);
showPage('navbar');
showPage('edit_profile');
}elseif(isset($_SESSION['Auth']) && isset($_GET['u']) && $user['ac_status']==1){
$profile = getUserByUsername($_GET['u']);
if(!$profile){
showPage('header',['page_title'=>'User Not Found']);
showPage('navbar');
showPage('user_not_found');
}else{
$profile_post = getPostById($profile['id']);
$profile['followers']=getFollowers($profile['id']);
$profile['following']=getFollowing($profile['id']);
showPage('header',['page_title'=>$profile['first_name'].' '.$profile['last_name']]);
showPage('navbar');
showPage('profile');
}
}elseif(isset($_GET['signup'])){
showPage('header',['page_title'=>'Via Chat - SignUp']);
showPage('signup');
}elseif(isset($_GET['login'])){
showPage('header',['page_title'=>'Via Chat - Login']);
showPage('login');
}elseif(isset($_GET['forgotpassword'])){
showPage('header',['page_title'=>'Via Chat - Forgot Password']);
showPage('forgot_password');
}else{
if(isset($_SESSION['Auth']) && $user['ac_status']==1){
showPage('header',['page_title'=>'Home']);
showPage('navbar');
showPage('wall');
}elseif(isset($_SESSION['Auth']) && $user['ac_status']==0){
showPage('header',['page_title'=>'Verify Your Email']);
showPage('verify_email');
}elseif(isset($_SESSION['Auth']) && $user['ac_status']==2){
showPage('header',['page_title'=>'Blocked']);
showPage('blocked');
}else{
showPage('header',['page_title'=>'Via Chat - Login']);
showPage('login');
}
}
showPage('footer');
unset($_SESSION['error']);
unset($_SESSION['formdata']);