Jump to content

MD5


eaglelegend

Recommended Posts

Wouldn't it be easier to just run the query:

 

UPDATE `members` SET `password`=md5(`password`)

 

Again, as wildteen has emphasized, make sure you back up your data and run this query only once.

I wasn't sure whether to use that query as I thought Mysql will set all passwords to the md5 hash of the string '`password`' (minus the quotes) and not the value of the password field. However after testing this my thoughts where wrong.

 

I found out why my code wasn't working correctly though. The following line:

while(list($username, $password) = mysql_fetch_row(mysql_query('SELECT username, password FROM members')))

actually causes an infinity loop :o

Link to comment
Share on other sites

ok... errm I pasted gingers code into thre query and it says

You have to choose at least one column to display

 

what coloumn?

With GingerRobots suggestion

<?php

include 'header.php';

mysql_query('UPDATE `members` SET `password`=md5(`password`)');

echo 'Passwords reset. DELETE THIS SCRIPT NOW DONOT RERUN.';

?>

Link to comment
Share on other sites

What I'd do is this:

 

<?php
$password = "password";
$password = md5($password); // 319f4d26e3c536b5dd871bb2c52e3178
$password = substr($password,0,16); // 319f4d26e3c536b5
// For extra security, do it again
$password = md5($password); // ce90da7acc4c917baa12b361b4d1a126
$password = substr($password,0,16); // ce90da7acc4c917b
?>

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.