mmarif4u Posted June 23, 2007 Share Posted June 23, 2007 R u want to match the password in the row against username. I did not see any query for that. Ok try this may be it will work. SELECT * FROM user_info WHERE username = '$user' and password='$pw' If this doesnot work than try this. $pw =$_POST['pw']; SELECT * FROM user_info WHERE username = '$user' and md5(sha1(md5(md5('password')='$pw' Quote Link to comment Share on other sites More sharing options...
Foser Posted June 23, 2007 Author Share Posted June 23, 2007 alright, I tried both and both times i did this, I get nothing when i press submit, brings me to a blank page. Quote Link to comment Share on other sites More sharing options...
Foser Posted June 23, 2007 Author Share Posted June 23, 2007 <?php require("config.php"); $user = mysql_real_escape_string($_POST['user']); $pw = $_POST['pw']; mysql_fetch_assoc(mysql_query("SELECT * FROM user_info WHERE username = '$user' and md5(sha1(md5(md5(password)))) = '$pw'")) or die(mysql_error()); if ($pw == $user_info['password'] && $user == $user_info['username']){ mysql_fetch_assoc(mysql_query("SELECT rights FROM user_info WHERE username = '$user'")); echo "You are now logged in as a $user_info[rights]."; } else { echo "You have typed in an incorrect password or/and username. Please try again."; } ?> This is my edited code Quote Link to comment Share on other sites More sharing options...
Foser Posted June 23, 2007 Author Share Posted June 23, 2007 bump Quote Link to comment Share on other sites More sharing options...
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.