Cod-nes 0 Posted March 19, 2008 Report Share Posted March 19, 2008 I keep getting Inncorrect password. Help please? while($info = mysql_fetch_array( $check )){$_POST['password'] = stripslashes($_POST['password']);$info['password'] = stripslashes($info['password']);$_POST['password'] = md5($_POST['password']);//gives error if the password is wrongif ($_POST['password'] != $info['password']) {die('Incorrect password, please try again.');} Quote Link to post Share on other sites
jhecht 0 Posted March 19, 2008 Report Share Posted March 19, 2008 echo out both $info['password'] and $_POST['password'](after MD5 summation) Quote Link to post Share on other sites
The Sea King 0 Posted March 19, 2008 Report Share Posted March 19, 2008 Maybe show us the code? Quote Link to post Share on other sites
Cod-nes 0 Posted March 19, 2008 Author Report Share Posted March 19, 2008 echo out both $info['password'] and $_POST['password'](after MD5 summation) I tried! It keeps saying Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in login.php on line 54or something like that.can you try to find what is wrong with my code?<?php// Connecting$sql= mysql_connect("Sercet","Sercet","Sercet");$database=mysql_select_db("Sercet");if (!$sql){die('Could not connect: ' . mysql_error());}if (!$database){die ("Could not select db: " . mysql_error());}// $$username = $_POST['username'];if (!$_POST['username'] | !$_POST['password']){die('You did not complete all of the required fields');}//Check username$check = mysql_query("SELECT * FROM Member WHERE username = '".$_POST['username']."'")or die(mysql_error());$check2 = mysql_num_rows($check);if ($check2 == 0) {die('That user does not exist in our database. <a href="registering.php">Click Here to Register</a>');}while($info = mysql_fetch_array( $check )){$_POST['password'] = stripslashes($_POST['password']);$info['password'] = stripslashes($info['password']);$_POST['password'] = md5($_POST['password']);//gives error if the password is wrongif ($_POST['password'] != $info['password']) {die('Incorrect password, please try again.');}else{// if login is ok then we add a cookie$_POST['username'] = stripslashes($_POST['username']);$hour = time() + 3600;setcookie(Username, $_POST['username'], $hour);setcookie(Password, $_POST['password'], $hour);}}echo "'Now you can go and upload files here:' . '<a href=member.php>Link</a>"mysql_close($sql);?> Quote Link to post Share on other sites
Synook 47 Posted March 19, 2008 Report Share Posted March 19, 2008 Try removing the stripslashes() (as md5() negates the need), and not modifying $_POST $password = md5($_POST['password']);//gives error if the password is wrongif ($password != $info['password']) {die('Incorrect password, please try again.');} Also, check that the column in your table is actually called "password" (not "Password" or something). Quote Link to post Share on other sites
justsomeguy 1,135 Posted March 19, 2008 Report Share Posted March 19, 2008 You're missing a semicolon after this line:echo "'Now you can go and upload files here:' . '<a href=member.php>Link</a>" Quote Link to post Share on other sites
jhecht 0 Posted March 19, 2008 Report Share Posted March 19, 2008 What might be a headache saver is to just start off from the basics(mysql_connect(), mysql_close()).From there, check everything to make sure. Double check you don't leave a quote open, or you don't forget semi colons(PHP hates it if you do). Sometimes it's best to just start from scratch. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.