Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Location
    Southend, Essex, UK
    Posts
    7
    Tokens
    0

    Default MySQL Encryption

    Hey.

    Im sort of new to MySQL. Im combining it with PHP to create a user system. I am using phpmyadmin to manage my databases.

    I was wondering, how do i encrypt my password field? I know how to encrypt passwords AFTER they have been added, but how do i get it too encrypt my password field automaticly when its added?

    Thanks, MrStretch

  2. #2
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    You just use md5() before saving it onto the database

  3. #3
    Join Date
    May 2006
    Location
    Southend, Essex, UK
    Posts
    7
    Tokens
    0

    Default

    Ok.

    This is the query to insert the information from the form into the database. Can you add the md5() function into it? Im not sure where to put it.

    mysql_query("INSERT INTO members SET name='{$HTTP_POST_VARS['username']}', creds='{$HTTP_POST_VARS['creds']}', password='{$HTTP_POST_VARS['password']}'")

    Thanks :-)

  4. #4
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    www.php.net/md5

    Read and learn.

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    101
    Tokens
    0

    Default

    mysql_query("INSERT INTO members SET name='{$HTTP_POST_VARS['username']}', creds='{$HTTP_POST_VARS['creds']}', password='{$HTTP_POST_VARS['password']}'")

    Change to:
    $name = $_POST['username'];
    $creds = $_POST['creds'];
    $pass = md5($_POST['password']);
    mysql_query("INSERT INTO members (`name` , `creds` , `password`) VALUES ('$name' , '$creds' , '$pass')");


    Edit:
    Remember to md5 it where you login by putting md5($_POST['whatever'])
    Last edited by Microsoft; 02-09-2006 at 11:58 AM.

  6. #6
    Join Date
    May 2006
    Location
    Southend, Essex, UK
    Posts
    7
    Tokens
    0

    Default

    Thank you very much :-)
    Ive figured it out now.

  7. #7
    Join Date
    May 2006
    Location
    UK
    Posts
    101
    Tokens
    0

    Default

    No problemo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •