Re: how to write IF statement for login script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nick wrote:

Hi,
I have a login script which has worked fine in the past, however i need to change the IF statement. Basically all i want it to do is verify that $squadnum variable is inbetween 1-98 or is 99. I'm not even entirely sure if i need to use the ereg function and i dont think the "1-98" bit is formatted correctly, any help would be much appreciated.


Heres the code i have so far:

if (ereg("1-98", $squadnum)) { // users with id 1-98 should get sent to squad page
header("Location: squad.php");
} else if(ereg("99", $squadnum)) { // 99 is the id number of the site administrator
header("Location: admin.php");
} else {
header("Location: login.php");
}


Thanks, Nick
how about a non regular-expression solution?
if($squadnum > 0 && $squadnum < 99) {
	header('Location: squad.php');
} elseif($squadnum == 99) {
	header('Location: admin.php');
} else {
	header('Location: login.php');
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux