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' Link to comment https://forums.phpfreaks.com/topic/56674-login-code-issues-mysql_fetch_assoc/page/2/#findComment-280793 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. Link to comment https://forums.phpfreaks.com/topic/56674-login-code-issues-mysql_fetch_assoc/page/2/#findComment-280796 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 Link to comment https://forums.phpfreaks.com/topic/56674-login-code-issues-mysql_fetch_assoc/page/2/#findComment-280797 Share on other sites More sharing options...
Foser Posted June 23, 2007 Author Share Posted June 23, 2007 bump Link to comment https://forums.phpfreaks.com/topic/56674-login-code-issues-mysql_fetch_assoc/page/2/#findComment-280885 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.