1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    What is the best way to store and retrieve encrypted passwords in mySQL with Perl DBI?

  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    To store password -->

    When setting the value in the query add the password() statement to the value...ie

    $query = "INSERT INTO yourtable (yourfield, otherfields) VALUES (password('$yourfield'), $otherfields)"

    To retrieve password -->

    There is no way to retrieve an encrypted password from the MySQL database (that I'm aware of..)
    To check that a password entered matches a password in the database you can encrypt the entered password and check that string against the encrypted password in the table.

    See "MySQL password verification" posting in Perl Forum......

    Hope that helps some.......
  4. #3
  5. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Hi Deviant, thanks for responding. This is somewhat what I'm looking for, one thing that I'd like to do though is allow users who have forgotten their password have to have it automatically emailed to them when they submit a "Lost password" form (why I would like to be able to decrypt the password) .... do you know how so many other sites are able to do this? (including this forum, for example)

  6. #4
  7. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    I have solved this problem by entering password in two different fields as follows.
    $query = "INSERT INTO yourtable (yourfield, otherfields, yourfield_1) VALUES (password('$yourfield'), $otherfields, yourfield_1)";

    password('$yourfield') will be checked for user password and in case if user forgot his password "yourfield_1" will be mailed to him.
    I do not know whether this correct. Tell me if there is any better way.

Similar Threads

  1. store information of wewpages in mysql
    By nimaone in forum MySQL Help
    Replies: 1
    Last Post: November 8th, 2003, 12:24 PM
  2. Using BLOB to store graphics (MySQL w/ Perl)
    By rogergraves in forum MySQL Help
    Replies: 3
    Last Post: May 14th, 2003, 09:44 AM
  3. Replies: 6
    Last Post: January 27th, 2003, 12:16 PM
  4. store and retrieve gifs and / or jpges with php in mySQL
    By zischg in forum Beginner Programming
    Replies: 1
    Last Post: November 9th, 2000, 03:49 PM
  5. Replies: 4
    Last Post: November 9th, 2000, 03:46 PM

IMN logo majestic logo threadwatch logo seochat tools logo