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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.