I click the 'logout' button, yet i remain logged into my site via facebook...
I am using the php SDK, code to follow.
Can somone tell me how to work this bloody thing!
index
Code: Select all
<?php
require_once("core/init.php");
require_once("core/function.php");
/*if($session) {
header("Location: signup.php");
exit;
}*/
?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home page</title>
<link href='http://fonts.googleapis.com/css?family=Macondo' rel='stylesheet' type='text/css'>
<link href='/style/main.css' rel='stylesheet' type='text/css'>
</head>
<body>
<?=$logUrl?>
<div id="wrapper">
<h1>Blood Hunt</h1>
<div>
<a href="<?=$loginUrl?>" id="fb-login"></a>
</div>
<div>
<p>Blood Hunt is in pre Alpha.</p>
<p>Use your Facebook account to login. All information accessed by Blood Hunt is kept private and is not stored in our system.</p>
</div>
</div>
</body>
</html>
Code: Select all
require_once($_SERVER['DOCUMENT_ROOT'] . "/libs/facebook.php");
$facebook_config = array(
"appId" => "*********************",
"secret" => "*********************"
);
$facebook = new Facebook($facebook_config);
$session = $facebook->getUser();
$me = null;
if($session)
{
try
{
$me = (object)$facebook->api('/me');
}
catch (FacebookApiException $e)
{
echo $e;
$me = null;
}
}
if($me)
{
$login_options = array("next" => "http://www.blood-hunt.tapt-in.net/logout.php");
$logoutUrl = $facebook->getLogoutUrl($login_options);
$logUrl = "<a href='$logoutUrl'>Log out</a>";
}
else
{
$login_options = array(
"redirect_uri" => "http://www.blood-hunt.tapt-in.net",
"scope" => "email,read_stream,publish_stream,user_photos,read_mailbox,offline_access"
);
$loginUrl = $facebook->getLoginUrl($login_options);
$logUrl = "<a href='$loginUrl'>Log in</a>";
}
Code: Select all
<?php
require_once("core/init.php");
unset($_SESSION);
unset($_COOKIE);
?>