i am having trouble using session variables... this code was working for a long time (6 mths) without hassles and then suddenly ... i have a problem of
"undefined index" when i try to access the session variables on a different page than where i d set them
this is the index page of the control panel where the session vars are set
<?php
session_start();
$HTTP_SESSION_VARS['admin'] = FALSE;
//$_SESSION['admin'] = FALSE;
$admin = false;
include 'backend.php';
if(!isset($_POST['uname']))
{
?>
some html
<?php
}
elseif($_POST['uname']=='admin' && $_POST['pword']=='rr543')
{
$_SESSION['admin']= TRUE;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta name="generator" content="PSPad editor, www.pspad.com" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<title>Welcome To "xxxxxxxxxx"</title>
<link href="../styleshop.css" rel="stylesheet" type="text/css" />
<script src="comjs.js" type="text/javascript"></script>
</head>
<body>
<br /><br /><br /><br /><br /><br />
<table class = "log" cellpadding = "0" cellspacing ="0">
<th colspan ="100%">Select Operation</th>
<tr><td><a href = "addprod.php">Add Product</a></td><td><a href ="vieword.php">View Orders</a></td><td><a href ="edit.php">Edit Product</a></td></tr>
</table>
</body>
</html>
<?php
}
else
{
?>
some html
<?php
}
?>
then this is the code for the view orders page where the $SESSION['admin'] is called ... this is where the error occurs "undefined index" i feel the session is not being registered...this is just one of many errors on the site ... an entire shopping cart is dysfunctional due to this error...
<?php
session_start();
include 'backend.php';
error_reporting(E_ALL);
$isadmin=$_SESSION['admin'];
//var_dump($_SESSION);
if(!$isadmin)
{
//echo $isadmin;
die("Unauthorised Access");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta name="generator" content="PSPad editor, www.pspad.com" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<title>Welcome To "xxxxxxxxx"</title>
<link href="../styleshop.css" rel="stylesheet" type="text/css" />
<script src="comjs.js" type="text/javascript"></script>
</head>
<body>
<?php
vieword();
?>
</body>
</html>
the file backend.php contains only functions ... no output is generated in this file..
this site is hosted on a webhost running php as cgi (fastcgi)... the version is 4.4.0
i know i have not used isset ... i would be totally embarassed if that is causing the prob... btw this very code works on my server...
please help