/
index.php
39 lines (36 loc) · 1.03 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
<?php
$config['baseurl'] = "http://zachwe.dyndns.org:8888/index.php";
require_once('fb-auth.php');
require_once('FbQueryProcessor.php');
$appid = FacebookAuth::$appid;
$app_secret = FacebookAuth::$secret;
$url = urlencode('http://zachwe.dyndns.org:8888/fb_cleanser');
$facebook = FacebookAuth::getFacebook();
$session = FacebookAuth::getSession($facebook);
$me = FacebookAuth::getMe($facebook, $session);
if($me) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'email,read_stream'));
}
?>
<html>
<head>
<!--Include JQuery via Google CDN-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<?if($me) {
echo 'Hello, ' . $me['name'] . "!\n";
}?>
<? if($me) { ?>
<a href="<?echo $logoutUrl;?>">Log Out</a>
<? } else { ?>
<a href="<?echo $loginUrl;?>">Log In</a>
<? } ?>
<p>Welcome to Facebook Cleanser!</p>
<? if($me) { ?>
<!--use ajax to query the endpoint getFacebookPosts-->
<? } ?>
</body>
</html>