Jump to content

password trouble


dadamssg

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/140381-password-trouble/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/140381-password-trouble/#findComment-734739
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/140381-password-trouble/#findComment-735074
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.