I think this is what you mean ....
<?php
// This looks cleaner, and is a lot easyer to read!
$siteAccessLevel = 2;
$gAccessLevel = 1;
switch ($siteAccessLevel) {
case "level-1":
$slevel = "0";
break;
case "level-2":
$slevel = "1";
break;
case "level-3":
$slevel = "2";
break;
}
switch ($gAccessLevel) {
case "level-1":
$glevel = "1";
break;
case "level-2":
$glevel = "2";
break;
case "level-3":
$glevel = "3";
break;
}
if ($slevel < $glevel) {
echo "Access Granted";
}else{
echo "You don't belong";
}
?>
-----Original Message-----
From: Philip J. Newman [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 8:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Confused a little with = to and grater than ...
Importance: Low
Well i thought about changeing access levels into numbers so that only
LARGER numbers can access lower numbers and Lower numbers can't access
anything higher ... if that makes sence ...
So 3 can access 2 and 1,
2 can't access 3, but can access 2 and 1 and one can't access 2 or 3, but
can 1 ...
assuming that $siteAccessLevel is = to eather level-1, level-2 or level-3
...
if ($slevel >= $glevel) {
is the line i can't seem to get right.
*GRIN* any help? code below.
if ($siteAccessLevel == "level-1") { $slevel = "1"; }
else if ($siteAccessLevel == "level-2") { $slevel = "2"; }
else if ($siteAccessLevel == "level-3") { $slevel = "3"; }
if ($gAccessLevel == "level-1") { $glevel = "1"; }
else if ($gAccessLevel == "level-2") { $glevel = "2"; }
else if ($gAccessLevel == "level-3") { $glevel = "3"; }
if ($slevel >= $glevel) {
//LOAD PAGE
} else {
// ERROR MESSAGE HERE.
{
------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]
+64 (9) 576 9491
+64 021-048-3999
------
Friends are like stars
You can't allways see them,
but they are always there.
------
Websites:
PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]
Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]
Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php