thanks I understand. One other thing you could help me with perhaps is the following code which is part of the login script which checks the user/pw entered. I want to put an access level variable on each page that is secured by the previously mentioned include script (say $access=3; or some such). In this code below I need to check it (say I've got a level access in the same tblusers db table) but everything I try doesn't work. Here's the standard code:
<?PHP
// Check for a cookie, if none got to login page
if(!isset($_COOKIE['session_id'])) {
header('Location: Login.php?refer='.urlencode($PHP_SELF.'?'.$HTTP_SERVER_VARS['QUERY_STRING']));
}
// Try to find a match in the database
$sGUID = $_COOKIE['session_id'];
$hDB = mysql_connect([removed]);
mysql_select_db('test', $hD😎;
$sQuery = "
Select iUser, sClearance
From tblUsers
Where sGUID = '$sGUID'";
$hResult = mysql_query($sQuery, $hD😎;
if(!mysql_num_rows($hResult)) {
// No match for guid
header('Location: Login.php?refer='.urlencode($PHP_SELF.'?'.$HTTP_SERVER_VARS['QUERY_STRING']));
}
and here's the code I've tried:
<?PHP
// Check for a cookie, if none got to login page
if(!isset($_COOKIE['session_id'])) {
header('Location: Login.php?refer='.urlencode($PHP_SELF.'?'.$HTTP_SERVER_VARS['QUERY_STRING']));
}
// Try to find a match in the database
$sGUID = $_COOKIE['session_id'];
$hDB = mysql_connect([removed]);
mysql_select_db('test', $hD😎;
$sQuery = "
Select iUser, sClearance
From tblUsers
Where sGUID = '$sGUID'";
$hResult = mysql_query($sQuery, $hD😎;
if(!mysql_num_rows($hResult)) {
// No match for guid
header('Location: Login.php?refer='.urlencode($PHP_SELF.'?'.$HTTP_SERVER_VARS['QUERY_STRING']));
}
/else {
// Now check clearance
//if(mysql_num_rows($hResult)) {
//$aResult = mysql_fetch_row($hResult);
//$sClearance='$aResult[1]';
$sClearance=2;
$UserSecurityLevel=3;
if $sClearance<$UserSecurityLevel {
header('Location: error.php?refer='.urlencode($PHP_SELF.'?'.$HTTP_SERVER_VARS['QUERY_STRING']));
//header('Location: http://localhost/error.php');
}
}/
?>