Sessions and IIS - Issues with passing between 2 pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
janson0
Forum Newbie
Posts: 6
Joined: Thu Jun 01, 2006 11:10 am

Sessions and IIS - Issues with passing between 2 pages

Post 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
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post 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.
Post Reply