Page 1 of 1

Sessions and IIS - Issues with passing between 2 pages

Posted: Thu Jun 08, 2006 2:20 pm
by janson0
Hey all,

So I have a page with a login/user authentication system. I am using a derivative of the challenge/response tutorial on this very forum. It is a great starting point.

My problem now is that I am on a Windows server hosting plan and as many of you may know, there are some issues passing session ID's between two pages on IIS. Whenever I refresh the page or I go to another page, it resets the sessionID. This kinda throws session tracking out the window. I was wondering if anyone has a solution for this.

Pertinent code:

index.php

Code: Select all

<?php
/*
    Start the PHP Session
*/
session_start();
session_register("access_time");
$access_time = time();
session_write_close();
include("database.php");
?>
login.php

Code: Select all

<?php
session_start();
/*
    Start the PHP Session
*/

if (isset($_SESSION['access_time']))
{
echo("It's set...");
}
The if statement in the second code snippet does not fire. I also had it print out the session id's on both pages, and they were different. This happens at page change and refresh.

Anyone got an idea for a solution? If not I'm just going to pass the session id with the form and set a cookie that the user is logged in.. I would just like to use sessions and not cookies if at all possible.

Thanks,
Janson

Posted: Thu Jun 08, 2006 7:59 pm
by a94060
this same thing happed to me,for some reason,when i also used if statments,i could not see the session value i set before.