Solved

Facebook Php Logout

Posted on 2012-03-19
11
1,366 Views
Last Modified: 2012-04-02
I have this logout but it only logs out on facebook not on my site.

$logoutUrl=$_SESSION['logout'];

Open in new window

0
Comment
Question by:glynco
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37737665
Eh?  Is there anything else you want to tell us?
0
 

Author Comment

by:glynco
ID: 37737821
I need a redirect to my logout.php after being log out on facebook.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37737848
There are two ways you can redirect the client browser.  One is with the header() function.  The other is to put a meta-refresh tag into the browser output stream.  The latter method is "deprecated" however I have never encountered a browser that did not obey the command.

See these links for specifics:
http://php.net/manual/en/function.header.php
http://en.wikipedia.org/wiki/Meta_refresh
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:glynco
ID: 37738090
What I mean is I have to redirect after logging out on facebook.com

I tried this but it does not work

$facebook->getLogoutUrl( array(
    'redirect_uri'  => 'http://www.mydomain.com/fblogout.php')
);

Open in new window

0
 

Author Comment

by:glynco
ID: 37738134
---------------------
home.php

require 'facebook.php';
require 'fbconfig.php';
session_start();
$facebook=$_SESSION['facebook'];
$userdata=$_SESSION['userdata'];
$logoutUrl=$_SESSION['logout'];

//$logoutUrl = $facebook->getLogoutUrl(array('next' => $logoutUrl, 'session_key' => $session_key));


//$logoutUrl = $facebook->getLogoutUrl( array(
//    'redirect_uri'  => 'http://www2.mydomain.com/fblogout.php')
//);

Open in new window


-----------------
fbconfig.php

<?php
$facebook_appid='xxxxx';
$facebook_app_secret='xxxxx';
$facebook = new Facebook(array(
'appId' => $facebook_appid,
'secret' => $facebook_app_secret,
));
?>

Open in new window

0
 
LVL 8

Expert Comment

by:Ben McNelly
ID: 37738165
You can specify in your facebook app setting what you want the return URL to be.
0
 

Author Comment

by:glynco
ID: 37738409
Where is that? I cannot find it on settings
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 37740706
instead of this,
$facebook->getLogoutUrl( array(
    'redirect_uri'  => 'http://www.mydomain.com/fblogout.php')
);

try,

echo "<script>window.location = 'http://www.mydomain.com/fblogout.php'</script>";
0
 

Author Comment

by:glynco
ID: 37740787
I need to log-out on both facebook website and on my site.
0
 
LVL 8

Accepted Solution

by:
Ben McNelly earned 500 total points
ID: 37742288
Ah, in that case I would make the link go to your logout page, that then redirects or has the facebook logout code in it.

Send user to your log out page
Log out page sends them to facebook log out
0
 

Author Comment

by:glynco
ID: 37745679
If I send them to my logout page first, how can I send them to facebook page if the session has already been destroyed?
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question