Im new to php5, and have been working on this for 3 days and cant figure out why its not working. Ok this is weird, I was editing the php file to post here and change $pass = $_POST["password"]; to $pass = $_POST["a"]; and it worked. I verified before and after the IF statement that both hashes did match. Can anyone see what Im doing wrong? Im new to php and dont quite have it figured out. Thanks. Heres the .php file.
<?php
ob_start();
session_start();
$pass = "a";
echo "<html>\n";
echo " <body>\n";
echo " <title>fix later</title>\n";
echo " </body>\n";;
$hpass = ("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
$passwordHash = sha1($pass);
echo "<p>$hpass is hpass</p>\n";
echo "<p>$passwordHash is passwordHash</p>\n";
if ( $hpass == $passwordHash )
{
echo "<p>Welcome back $emailaddress</p>\n";
} else
{
echo "<p>Wrong password</p>\n";
}
echo "<p>$hpass is hpass</p>\n";
echo "<p>$passwordHash is passwordHash</p>\n";
?>
if statement not working
Moderator: General Moderators
Re: if statement not working
you code does not reference the post data, you've hard coded an ascii character.
-
petethepirate
- Forum Newbie
- Posts: 10
- Joined: Sat Oct 04, 2008 5:33 pm
Re: if statement not working
Yeah I did that so I didnt have to post 20 files.
Re: if statement not working
print_r( $_POST );
if you're going to edit your code before you post it, how are we gonna spot the bug? Obviously if changing it to "a" worked, then the field must be called "a" in the form or whatever is posting to your script
if you're going to edit your code before you post it, how are we gonna spot the bug? Obviously if changing it to "a" worked, then the field must be called "a" in the form or whatever is posting to your script