dadamssg Posted January 11, 2009 Share Posted January 11, 2009 Hi im trying to set up a login application. im going through a PHP and MySQL for Dummies book and i've copied everything down but i can't seem to get the password to work. Whenever i try to make an account the password i put into the application is encoded in my database and when i try to use the password i assigned the user it won't work, it also won't work for the coded password it gives me in my database. I had the password set to CHAR (30)...didn't work. tried setting it to VARCHAR (10)...didn't work. i attached the password section of the code. THANKS ahead of time [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/140381-password-trouble/ Share on other sites More sharing options...
fenway Posted January 11, 2009 Share Posted January 11, 2009 Please post the relevant code on this board... not the file itself. Also, do the mysql queries work? Quote Link to comment https://forums.phpfreaks.com/topic/140381-password-trouble/#findComment-734655 Share on other sites More sharing options...
PFMaBiSmAd Posted January 11, 2009 Share Posted January 11, 2009 The code is storing and checking the password using md5('$_POST[fpassword]') I'm sure the book would have told you the size the password field needed to be to hold an md5() value and even if it somehow omitted that critical piece of information you could always search the Internet and/or the php manual to find it. Quote Link to comment https://forums.phpfreaks.com/topic/140381-password-trouble/#findComment-734739 Share on other sites More sharing options...
fenway Posted January 12, 2009 Share Posted January 12, 2009 hey thanks for replying. and yes my queries work, its storing the data but my password is encrypted and won't seem to match what i enter in the form. i also just noticed that the file i attached earlier was for the matching of the username and password. /* Add new member to database */ else #190 { $today = date("Y-m-d"); $fields_str = implode(",",$fields); $values_str = implode('","',$values); $fields_str .=",createDate"; $values_str .='"'.",".'"'.$today; $fields_str .=",password"; $values_str .= '"'.","."md5"."('".$password."')"; $sql = "INSERT INTO Member "; $sql .= "(".$fields_str.")"; $sql .= " VALUES "; $sql .= "(".'"'.$values_str.")"; $result = mysqli_query($cxn,$sql) or die("Couldn't execute insert query."); $_SESSION['auth']="yes"; #205 $_SESSION['logname'] = $loginName; #206 ^this is the code for adding the member to the database...have any idea? thanks Quote Link to comment https://forums.phpfreaks.com/topic/140381-password-trouble/#findComment-735074 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.