Results 1 to 4 of 4

Thread: Adding this password as MD5

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Adding this password as MD5

    what would I need to add to get this password added as a MD5 format?

    PHP Code:
    <?php 

    $check 
    "select id from members where username = '".$_POST['username']."';"
    $qry mysql_query($check) or die ("Could not match data because ".mysql_error());
    $num_rows mysql_num_rows($qry); 
    if (
    $num_rows != 0) { 
    echo 
    "Sorry, the username $username is already taken. Please go back and try another.<br>";



    } else {

    $result mysql_query("insert into members (`id`,`username`,`firstname`,`lastname`,`dob`,`address`,`city`,`country`,`phone`,`email`,`password`,`nz_mailing`,`active`,`warriors_mailing`,`bcc_mailing`,`level`) values ('', '".$_POST['username']."','$firstname','$lastname','$dob','$address','$city','$country','$phone','$email','".$_POST['password']."','$nz_mailing','$active','$warriors_mailing','$bcc_mailing','$level')")
    or die(
    "Could not insert data because ".mysql_error());

    print (
    "Thanks for registering with [url]www.rugbyleaguenz.com[/url] <?php echo $firstname ?> , we have sent you a email with instructions 
              on how to activate your account."
    );

    }

    ?>

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    In your SQL statement, you need to use the md5() function on $_POST['password']. Then, whenever someone logs in and you need to validate their password, you must md5() the password they give you and compare it to the one in the database.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    One of the most secure methods is to md5 the password using Javascript before it is sent to the server. This makes it nearly impossiable to crack, however a user could still snoop the md5 hash and send that. I am not even going to try and explain how to create an md5 function in Javascript, but there are plenty of free implementations.

    I found quite a good one here:
    http://pajhome.org.uk/crypt/md5/index.html
    Last edited by visualAd; Aug 14th, 2004 at 04:01 PM.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width