Hello,
we are migrating a mail server from plaintext passwords to md5 and I am having a big issue with loops, so if someone would help me on this I would really be externally grateful, cos this is very urgent and our client is giving us hard time over this.
$link = mysql_connect('localhost', 'xxxx', 'xxxx');
$db = 'xxxx';
if (!$link) {
die('Could not connect: ' . mysql_error());
}
else mysql_select_db($db, $link);
print "Connected successfully to the '$db' database. Processing...<br><br>";
$pw_db = mysql_query("SELECT password FROM mailbox");
while ($row=mysql_fetch_assoc($pw_db)) {
$output=generate_password();
$result=mysql_query("UPDATE mailbox SET password = '$output'");
}
mysql_close ($link);
This is the problematic part (the actual hashing function works). What happens is it hashes the first password, and populates all following rows with it, instead of taking the next row's password value and hashing it etc.
Can someone please help me get this loop straightened out, I am going crazy over this.
Thanks in advance,
Boris