Jump to content

Simplest "login" ever wont work


Rifts

Recommended Posts

I'm trying to make the simplest login and this isnt working can someone explain why?

 

thanks

	

if ($_POST['user'] == 'admin' && $_POST['pass'] != '1234') {
	echo "fail";
} else {
        echo "win";

 

no matter what I do it says win

Link to comment
Share on other sites

This is most likely one of the following reasons:

1 - The pass vaildation is using Not Equal To(!=) instead of Equal To (==)

2 - The form input fields are not named correctly. Change the names to match.

 

If you are still stuck post your whole code, so we can have a look over it.

 

Regards, Paul.

 

 

 

Link to comment
Share on other sites

yeah i actaully just changed it to this and it workes now

if ($_POST['login'] == 'admin' && $_POST['pass'] == '1234') {
                   echo "win";
             } else {
                  echo "fail";
              }

 

Link to comment
Share on other sites

I always have the same trouble, just fiddling around with it usually helps myself.

 

Its like I always use

if(!isset($_SESSION))

is the one I start off with and then just bump it up later on, adding an stage of it every time to see where I am going wrong usually helps me, but thats just my way of doing things.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.