Reply to Re: [PHP] how to write IF statement for login script

Your name:

Reply:


Posted by Nick on 03/24/05 00:59

Thanks, that seems to have worked.


M. Sokolewicz wrote:

> 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');
> }
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация