Session Problem in IE
Posted: Wed Mar 23, 2005 9:45 am
I will be using session variables to control who and how long users are logged in.
The problem is the script below works fine in FF, but not in IE.
In IE, as soon as you login the welcome page is displayed, but as soon as you continue to another page, it returns back to the login page and there is no session_id!!!
Is there something wrong with IE or is it a setting i need to change?
session.php
admin.php
login.php
The problem is the script below works fine in FF, but not in IE.
In IE, as soon as you login the welcome page is displayed, but as soon as you continue to another page, it returns back to the login page and there is no session_id!!!
Is there something wrong with IE or is it a setting i need to change?
session.php
Code: Select all
<?
session_start();
header("Cache-control: private");
/*session_register('sid');
session_register('username');
session_register('userlevel');*/
?>Code: Select all
<?
include_once ('resources/session.inc');
include_once ('resources/constants.inc');
include_once ('resources/classes/Database.pclass');
include_once ('resources/classes/CreateForm.pclass');
$dbConn = new Database();
$conn = $dbConn->dbConnect();
//session_unset();
print_r($_SESSION);
if (!isset($_SESSION['sid']) && !empty($_POST['username']) && !empty($_POST['password'])) {
if ($conn) {
$userLogin = $dbConn->getLoginDetails($_POST['username'], $_POST['password']);
if (!is_array($userLogin)) {
$loginError="There is a problem with the login details you have entered";
} else {
$_SESSION['userlevel'] = $userLogin['userlevel'];
$_SESSION['username'] = $userLogin['username'];
$_SESSION['sid'] = session_id();
}
}
}
if(isset($_SESSION['sid'])) {
if (!isset($_GET['page'])) {
$page = 'welcome';
} else {
$page = $_GET['page'];
}
} else {
$page = 'login';
}
include_once('admin/head.php');
include_once('admin/nav.php');
if (file_exists('admin/'.$page.'.php')) {
$cfForm = new CreateForm();
include_once('admin/'.$page.'.php');
} else {
include_once('include/missing.php');
}
include_once('admin/foot.php');
// close the database connection
$dbConn->closeConn($conn);
?>login.php
Code: Select all
<form name="logon" action="admin.php" method="post">
<table width="90%">
<tr><td> </td></tr>
<tr>
<td style="color:#FF0000; font-weight:bold; " colspan="2"> <?
if(isset($loginError)) print $loginError;
?></td>
</tr>
<tr><td> </td></tr>
</table>
<table>
<tr><td style="color:#777;" colspan="2">Your username and password is case sensitive.<br/>
<span style="color:#f77; ">If you forget your password, please see your adminstrator.</span></td></tr>
<tr><td> </td></tr>
<tr>
<td style="text-align:right; vertical-align:top;"><strong>Username:</strong></td>
<td><input name='username' type='text' size='40' value='<? if(isset($_POST['username'])) print $_POST['username']; ?>' /></td>
</tr>
<tr>
<td style="text-align:right; vertical-align:top;"><strong>Password:</strong></td>
<td><input name='password' type='password' size='40' value='<? if(isset($_POST['password'])) print $_POST['password']; ?>' /></td>
</tr>
<tr><td> </td></tr>
<tr>
<td> </td>
<td><input type='submit' name='submit' value='Login' /></td>
</tr>
</table>
</form>