Forum Moderators: coopster

Message Too Old, No Replies

Closing Sessions with Mobile Devices

         

username

7:00 am on May 19, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi all, I have built a mobile version of a site which uses the standard php session object to create a $_SESSION'username'] session variable. Strangely enough I cannot end or delete the session once someone hit logout. It seems to delete the session on the page I am on after refresh, but once I visit another page, the session starts back up again.

I am testing on the iPhone, and read that there is on some mobile devices a special cookie that stores sessions? Is this causing the problem or my code below?

$action = $_GET['action'];
if($action == 'out'){
@session_destroy();
$_SESSION['username'] = "";
}

Thanks in advance.

penders

11:16 am on May 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The PHP Manual - session_destroy page [uk2.php.net] might help:

In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that.