-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
40 lines (36 loc) · 1003 Bytes
/
header.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
<?php
require 'fb-phpsdk/facebook.php';
// Creating the facebook object using appid and app secret
$facebook = new Facebook(array(
// Facebook Credentials for FriendzOnMap
'appId' => '444724602218418',
'secret' => 'ace7aff8abf062c50b888e47c770cdb7',
// Facebook Credentials for FriendzOnMap-Dev
//'appId' => '487490984599920',
//'secret' => 'cc2064e358eb3c34f3e7382fa0548a6e',
));
$user = $facebook -> getUser();
$user_profile = "";
if($user){
try{
$user_profile = $facebook -> api('/me');
}catch(FacebookApiException $e){
error_log($e);
$user = null;
}
}
$params2 = array(
'scope' => 'read_stream, user_location, friends_location',
'redirect_uri' => 'http://' . $_SERVER['HTTP_HOST'] .'/main.php'
);
$loginUrl = $facebook -> getLoginUrl($params2);
if ($user){
$params = array(
'redirect_uri' => 'http://' . $_SERVER['HTTP_HOST'] .'/login.php'
);
$logoutUrl = $facebook -> getLogoutUrl($params);
//echo $logoutUrl;
}else{
//echo $loginUrl;
}
?>