Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-04-2006, 04:06 AM   PM User | #1
thesavior
Senior Coder

 
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
thesavior has a little shameless behaviour in the past
if, if, else, if, else, else...error?

This is pretty much what i want to do:

PHP Code:
if ($username == $adminuser);
        {
            if (
$password == $adminpass);
                {
                    include 
'admin/adminstart.php';
                }
                else
                {
                    echo 
$loginerror;
                }
        }        
        else
        {
            echo 
$loginerror;
        } 
However i don't think this is the easiest way to do so. Im also getting errors. If someone can tell me the easiest way to do the same thing, i would be very happy. Thanks in advance!

*edit added below*
Im thinking maybe something like:
PHP Code:
if ($username == $adminuser) and ($password == $adminpass);
        {
            include 
'admin/adminstart.php';
        }
        else
        {
            echo 
$loginerror;
        } 
but im getting the and statment wrong.

Last edited by thesavior; 01-04-2006 at 04:09 AM..
thesavior is offline   Reply With Quote
Old 01-04-2006, 04:20 AM   PM User | #2
Kurashu
Regular Coder

 
Join Date: Aug 2004
Location: The US of A
Posts: 767
Thanks: 1
Thanked 0 Times in 0 Posts
Kurashu is an unknown quantity at this point
Close. There is a few errors in your code. The most obvious is the semicolon after the if statements, there doesn't need to be one. And your "fixed" code was close, an if statement needs to be completely enclosed in parentheses. You can also use the and keyword of the double ampersand (&&) for this.

PHP Code:
if ($username == $adminuser && $password == $adminpass)
        {
            include 
'admin/adminstart.php';
        }
        else
        {
            echo 
$loginerror;
        } 
Kurashu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:08 AM.


Advertisement
Log in to turn off these ads.