-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·40 lines (40 loc) · 1.07 KB
/
index.php
File metadata and controls
executable file
·40 lines (40 loc) · 1.07 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
39
40
<?php
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on") {
header("Location: http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit();
}
require('app/library.php');
if(isset($_GET['logout'])) {
setcookie("auth_token", 0, time() - 3600);
setcookie("user_id", 0, time() - 3600);
if($user) {
$logoutUrl = $facebook->getLogoutUrl();
header("Location:$logoutUrl");
} else header("Location:/");
}
if($_SERVER["HTTP_HOST"] != "rambl.it") {
header("Location: http://rambl.it". $_SERVER["REQUEST_URI"]);
}
$ramble_user = false;
$invite_code = false;
// Determine whether to show app or not.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
$code = isset($_POST['code']) ? $_POST['code'] : "invalid";
if(!isset($_COOKIE['auth_token'])) {
if(login($user_profile,$code)==true) {
header("Location: $siteUrl");
} else {
$ramble_user = false;
$invite_code = true;
}
} else {
$ramble_user = true;
$user_info = pullUser($user_profile['id']);
}
} else {
$ramble_user=false;
$loginUrl = $facebook->getLoginUrl();
}
require_once('app/views/home.php');
?>