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? 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. 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? 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!! 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. Link to comment https://forums.phpfreaks.com/topic/173533-solved-login-authentication/#findComment-914712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.