Cod-nes Posted March 19, 2008 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.');} Link to comment Share on other sites More sharing options...
jhecht Posted March 19, 2008 Share Posted March 19, 2008 echo out both $info['password'] and $_POST['password'](after MD5 summation) Link to comment Share on other sites More sharing options...
The Sea King Posted March 19, 2008 Share Posted March 19, 2008 Maybe show us the code? Link to comment Share on other sites More sharing options...
Cod-nes Posted March 19, 2008 Author 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);?> Link to comment Share on other sites More sharing options...
Synook Posted March 19, 2008 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). Link to comment Share on other sites More sharing options...
justsomeguy Posted March 19, 2008 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>" Link to comment Share on other sites More sharing options...
jhecht Posted March 19, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.