I'm building a facebook app, and have been following the guidelines and posting on the facebook message board, but can't seem to get anywhere.
Facebook creates a session and cookie on the users machine for the facebook application. However, logging out of facebook, does not remove this session or cookie.
I'm using -
require_once('../facebook.php');
-
session_start();
-
setcookie(session_name(), '', time()-42000, '/');
-
-
session_destroy();
-
to try to remove the session, but it looks like that is only removing the last entry of the cookie array (or params).
Any idea on how I can clear the entire cookie and session?
below is the code facebook uses to create the cookie. I've tried creating a function to recreate the cookie as empty, but no luck. -
function logout_user($user, $session_key, $expires=-3600) {
-
if (!$this->in_fb_canvas() && (!isset($_COOKIE[$this->api_key . '_user'])
-
|| $_COOKIE[$this->api_key . '_user'] != $user)) {
-
$cookies = array();
-
$cookies['user'] = $user;
-
$cookies['session_key'] = $session_key;
-
$sig = self::generate_sig($cookies, $this->secret);
-
foreach ($cookies as $name => $val) {
-
setcookie($this->api_key . '_' . $name, $val, (int)$expires);
-
$_COOKIE[$this->api_key . '_' . $name] = $val;
-
}
-
setcookie($this->api_key, $sig, (int)$expires);
-
$_COOKIE[$this->api_key] = $sig;
-
}
-
$this->user = $user;
-
$this->api_client->session_key = $session_key;
-
}
-
Thanks
Pete
1 3063
I'm building a facebook app, and have been following the guidelines and posting on the facebook message board, but can't seem to get anywhere.
Facebook creates a session and cookie on the users machine for the facebook application. However, logging out of facebook, does not remove this session or cookie.
I'm using -
require_once('../facebook.php');
-
session_start();
-
setcookie(session_name(), '', time()-42000, '/');
-
-
session_destroy();
-
to try to remove the session, but it looks like that is only removing the last entry of the cookie array (or params).
Any idea on how I can clear the entire cookie and session?
below is the code facebook uses to create the cookie. I've tried creating a function to recreate the cookie as empty, but no luck. -
function logout_user($user, $session_key, $expires=-3600) {
-
if (!$this->in_fb_canvas() && (!isset($_COOKIE[$this->api_key . '_user'])
-
|| $_COOKIE[$this->api_key . '_user'] != $user)) {
-
$cookies = array();
-
$cookies['user'] = $user;
-
$cookies['session_key'] = $session_key;
-
$sig = self::generate_sig($cookies, $this->secret);
-
foreach ($cookies as $name => $val) {
-
setcookie($this->api_key . '_' . $name, $val, (int)$expires);
-
$_COOKIE[$this->api_key . '_' . $name] = $val;
-
}
-
setcookie($this->api_key, $sig, (int)$expires);
-
$_COOKIE[$this->api_key] = $sig;
-
}
-
$this->user = $user;
-
$this->api_client->session_key = $session_key;
-
}
-
Thanks
Pete
This is what I use to clear my cookies.
[PHP]<?php
$past = time() - 100;
//this makes the time in the past to destroy the cookie
setcookie(ID_my_site, gone, $past);
setcookie(Key_my_site, gone, $past);
header("Location: login.php");
?>[/PHP]
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Daniel Ruscoe |
last post by:
Hi chaps,
I'm relatively new to the language, but I want to create a simple order
form using PHP and cookies. Please let me know if there's a better way
in this situation, database isn't...
|
by: TG |
last post by:
This is more of a pain than I thought it would be. I need a simple code
segment to determine whether a browser accepts cookies or not. When I pass
variables between pages when cookies are turned...
|
by: windandwaves |
last post by:
Hi Gurus
I am basically sorry that I have to bother you about this. I am a PHP
beginner and I have been studying sessions and cookies over the last few
weeks. I have learned lots, but I am...
|
by: Amit D.Shinde |
last post by:
Hello Experts..
I need some help regarding cookies and session objects and also
global.asa file
I am creating one cookie when a user logs in on my website.
The cookie stores the login name of...
|
by: Ik Ben Het |
last post by:
Hello,
I posted a simular question in the "IIS Security" group but it think it
is more usefull to post it here.
I want to do something very simpel. Make a part of my website available
only...
|
by: Marcus |
last post by:
I know that when you start a session in PHP, the "cookie" it creates is
not the same as those that are stored in your browser's temp folder, and
instead is kept in RAM. I am confused because in...
|
by: Atte André Jensen |
last post by:
Hi
I'm developing a site where I'd like to store information during a users
visit. So far I've been using sessions, but as far as I can tell it's
not possible to control for how long a session...
|
by: jheines |
last post by:
I am trying to explain how cookies and sessions work in a class I teach, but I have hit a wall when it comes to the interaction between cookies and the state of the privacy settings in Internet...
|
by: Chuck Anderson |
last post by:
I've instituted a sessions based scheme on my web site to combat hot
linking to my images. When someone requests a page at my site, I set a
session variable. I then use htaccess to redirect *all*...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |