Sessions
| From: | Dave Alger | Date: | Tue, 08 Jul 2003 16:07:33 +0000 |
| Subject: | Sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154394@lists.php.net to get a copy of this message | ||
Hi All,
I'm struggling with a session problem and I'm not sure where I should be
looking for the answer.
Most of my pages begin like this:
====================================
include_once('cfheader.php');
$feedback = cfHeader("Main Page");
//Start of page code
====================================
The cfheader.php file begins like this:
====================================
<?PHP
session_start();
function cfHeader($Title,$Protect=false)
{
$feedback="";
//IF we're loggin on then destory and get new session
if (IsSet($_POST['login']))
{
include_once('userreg.inc');
session_destroy(); //Destroy current session before continuing
$feedback =do_login();
}
if ($Protect==true && !IsSet($_SESSION['name']))
{
//No Session.
echo "<META HTTP-EQUIV='refresh' content='2;URL=mypage.php'>";
//Redirect
exit;
}
====================================
This works fine on my development PC, (PHP v 4.3.1) and on my primary test
site (PHP v4.2.2).
However when I try it on the target site (PHP v4.1.2) then I find that
immediately after starting the session everything works fine, however when I
move to any other page the session information is lost and I'm redirected to
log in again.
I was looking over the PHPInfo but to be honest I can't see what it is
that's different.
All help is gratefully appreciated.
regards,
Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.497 / Virus Database: 296 - Release Date: 04/07/2003