RE: [PHP] Confused a little with = to and grater than ...

From: Date: Sun, 16 Mar 2003 07:20:48 +0000
Subject: RE: [PHP] Confused a little with = to and grater than ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139829@lists.php.net to get a copy of this message
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:newmanpj@philipnz.com] Sent: Saturday, March 15, 2003 8:29 PM To: php-general@lists.php.net 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 info@philipnz.com +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/ info@philipnz.com Philip's Domain // Internet Project. http://www.philipsdomain.com/ newmanpj@philipnz.com Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ philip@newman.net.nz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#139829) next »