I got the following file to work by removing session_destroy() and adding session_write_close() at the end.
<?php
session_start();
$neg = array('off', 0, false, '', null);
$flags = array(
'Register Globals' => 'register_globals',
'Short Tags' => 'short_open_tag',
'Display Errors' => 'display_errors',
'Magic Quotes GPC' => 'magic_quotes_gpc',
'Magic Quotes Runtime' => 'magic_quotes_runtime',
'Magic Quotes Sybase' => 'magic_quotes_sybase',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$flags['Config file'] = get_cfg_var('cfg_file_path');
if (empty($flags['Config file']))
{
$flags['Config file'] = '-';
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";
$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
$le .= ' ' . implode(' ', array_slice($gle, $i, $wide)) . $eol;
}
$ec = array(
'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
$e2 = array();
foreach ($ec as $n => $v)
{
if (!in_array($n, $e) and $n != 'E_ALL')
{
$e2[] = $n;
}
}
$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
$er = $er . ' (' . implode(' | ', $e) . ')';
}
if (!$cli)
{
echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}
echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;
if (!$cli)
{
echo '</pre></body></html>', $eol;
}
$_SESSION['test'] = "Testing Sessions";
echo "REQUEST = ";
print_r($_REQUEST);
echo "<br>SESSION = ";
print_r($_SESSION);
session_id($_REQUEST['PHPSESSID']);
echo "<br> session file = ".session_save_path() . DIRECTORY_SEPARATOR . "sess_".session_id();
echo "<br> session file = ".session_save_path() . DIRECTORY_SEPARATOR . "sess_".$_REQUEST['PHPSESSID']."<br>";
echo file_exists(session_save_path() . DIRECTORY_SEPARATOR . "sess_".$_REQUEST['PHPSESSID']) ? 'session file exists' : 'session file does not exist';
session_write_close();
?>
I also had to do the same in my login.php and now it works. I guess it was creating and destroying the session right away. I have seen tons of examples that use it like this. Maybe it's an IIS thing?
Either way I have it working for now. Watch it not work on Apache now!?!
login.php
<?php
session_start(); //removed session_destroy() after this line
define("EP_Root", "../");
include(EP_Root.'usercontrols/validate.php');
$isErr = false;
if(isset($_POST['username'])){
require_once(EP_Root.'bll/login.class.php');
$login = new Login();
$blReturn = $login->ReturnCheckEmployeeLogin($_POST['username'], $_POST['password'], $CompanyID);
if ($blReturn["EmployeeID"] != NULL){
$login->UpdateEmployeeLogin($blReturn["EmployeeID"], $CompanyID);
$_SESSION['EmployeeSession'] = $blReturn["EmployeeNo"];
$_SESSION["Company"] = $CompanyID;
include(EP_Root.'config.php');
$_SESSION["OraServerUser"] = $OSUser;
$_SESSION["OraServerName"] = $OSName;
$_SESSION["OraSID"] = $OSID;
$_SESSION["OraServerPassword"] = $OSPassward;
if(isset($_GET["ReturnURL"])){
$path=explode("ReturnURL=",$_SERVER['QUERY_STRING']);
session_destroy(); //added this line here
header("Location:".$path[1]);
}else{
include(EP_Root.'bll/preference.class.php');
$preference = new Preference();
$result = $preference->GetTabPriviledgeInfo('Employee', 0, $CompanyID);
header("location:".$result[0]["url"]);
}
}else{
$isErr = true;
}
}
?>
<html>
<head>
<title>Employee Portal - Employee Login</title>
<!--<meta HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1"> -->
<link rel="icon" href="../favicon.ico">
<link rel="Shortcut Icon" href="../favicon.ico">
<link rel="stylesheet" href="../includes/login.css">
<script type="text/javascript" src="../scripts/wforms.js" ></script>
<style>
.errFld {border: 1px solid #F00;}
.errMsg { color: #C33;}
.style1 {color: #CC0000}
</style>
</head>
<body class="Login" onLoad="document.f1.username.focus();" bgcolor="#FFFFFF">
<table width="550px" align="center" border="0" cellpadding="20" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="10%"></td>
<td width="80%">
<br><br><br>
<div id="Dialog">
<h1><center><img src="../images/security-lock.gif" style="vertical-align:middle;"> <span style="vertical-align:bottom;">Login to Employee Portal</span></center></h1>
<?php
if ($isErr == true)
echo '<DIV class=AlertBad>The username and/or password you entered is invalid.</DIV>';
?>
<form name="f1" action="login.php<?php if(isset($_SERVER['QUERY_STRING'])) echo "?".$_SERVER['QUERY_STRING'];?>" method="post">
<input type="hidden" name="DBGSESSID" value="1234@localhost:7869;d=1,p=1" />
<dl>
<dt>Username:</dt>
<dd><input name="username" type="text" id="username" class="required"></dd>
<dt>Password:</dt>
<dd><input name="password" type="password" id="password" class="required"></dd>
</dl>
<p style="text-align: center;"><input type="image" src="../images/signin.gif" width="59" height="21" style="width:60px">
<br><br>(<a href="forgot-password.php">I forgot my password</a>)</p>
</form>
</div>
</td>
<td width="10%"></td>
</tr>
</table>
</body>
</html>