|
-
Aug 13th, 2004, 10:22 PM
#1
Thread Starter
Frenzied Member
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.");
}
?>
-
Aug 14th, 2004, 03:20 AM
#2
-
Aug 14th, 2004, 11:19 AM
#3
Stuck in the 80s
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.
-
Aug 14th, 2004, 03:57 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|