robert_gsfame Posted September 8, 2009 Share Posted September 8, 2009 i have problem. i think it's simple but i don't why my script didn't work configuration.php --------------- <?php $local='localhost'; $user='user'; $pass='pass'; $dbase='mylogin'; mysql_connect($local,$user,$pass); mysql_select_db($dbase);?> index.php ------------------------- <form name="check" action="authenticate.php" method="POST"> <input type="text" name="user"> <input type="text" name="pass"> <input type="submit"> authenticate.php ------------------- <?php require_once('configuration.php');?> <?php $user=$_POST['user']; $pass=md5($_POST['pass']); $query="SELECT * FROM mytable WHERE user='$user' AND password='$pass'"; $mysql=mysql_query($query); $sql_num=mysql_num_rows($mysql); if($sql_num==1){ echo "login work"; } else { echo "Wrong Username or Password"; }?> can anyone give me some guide? Quote Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/ Share on other sites More sharing options...
DarkWater Posted September 8, 2009 Share Posted September 8, 2009 You need to make sure error reporting is on and you should also verify the data in your database with the data in your script. Is the column length for the password in your database 32 characters? You need it to be that long in order to store an MD5 hash. Quote Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/#findComment-914701 Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2009 Share Posted September 8, 2009 my script didn't work Yes, we know that because you are posting on a php programming help forum. Just telling us something does not work is pointless. What exactly is it doing? A blank page? A php error? Your "Wrong Username or Password" message? Quote Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/#findComment-914703 Share on other sites More sharing options...
robert_gsfame Posted September 8, 2009 Author Share Posted September 8, 2009 thx, you've solved my problem.... i set password NVARCHAR(30) and it's not enough for hash :P Thank you so much!! Quote Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/#findComment-914710 Share on other sites More sharing options...
DarkWater Posted September 8, 2009 Share Posted September 8, 2009 Crystal ball: 0 Guessing common problems: 1 Seriously, if you have to ask a question again, provide as much information as possible. Otherwise it's hard to diagnose and it leads to random guesses. Quote Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/#findComment-914712 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.