Mobile devices and PHP sessions

Associate
Joined
30 Dec 2005
Posts
415
Hi all,

Does anyone know if mobile devices support PHP sessions?

This is how i'm declaring the pages:
Code:
<?php
session_name('HikingID'); session_start();
?>

I know the sessions work etc, as i've been testing in FF. As soon as I try it on the Openwave Simulator, none of my session variables are working. Is this problem to do with passing the Session ID? Should it be passed in the URL?

Cheers,
Rich
 
Last edited:
Hmm not sure what's going on here then.
This is the first part of my page:
Code:
<?php
session_name('HikingID'); session_start();
$ses_id = session_id();
include("../includes/query.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ERH</title>
</head>

<body>
<?php
echo strtotime('9th March 2006');
$query = "SELECT * FROM hiking_hikedetails WHERE (`hiking_hikedetails`.`userid` = '{$_SESSION["user_id"]}') ORDER BY `hiking_hikedetails`.`hikeid` ASC";
echo $query;
The value of $query is
Code:
SELECT * FROM hiking_hikedetails WHERE (`hiking_hikedetails`.`userid` = '') ORDER BY `hiking_hikedetails`.`hikeid` ASC
When it should be
Code:
SELECT * FROM hiking_hikedetails WHERE (`hiking_hikedetails`.`userid` = '1') ORDER BY `hiking_hikedetails`.`hikeid` ASC

Anyone got any ideas for debugging etc?
 
I've found the problem but not sure what to do about it.

On the first page, the session id is set as 30c161aec5e60807ee1baf4d00cd339e, and then php forwards to http://localhost:8081/mobile/loggedin.php?30c161aec5e60807ee1baf4d00cd339e

However, on this next page, by echoing the session id, it has now changed to 05601cfaedc274ffdf42d602e422fb5d.

Any ideas on how to make it use that first one? Am I passing it in the URL incorrectly?
 
Ah I solved it with that bit of help :)

I used GET to pass the session id, which was incorrectly named. All works now and I have a nice mobile site :)

Cheers
 
Back
Top Bottom