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
https://forums.phpfreaks.com/topic/105165-md5/page/2/#findComment-538539
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
https://forums.phpfreaks.com/topic/105165-md5/page/2/#findComment-538544
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
https://forums.phpfreaks.com/topic/105165-md5/page/2/#findComment-538548
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.