I have a database table called user where I have some columns. One of these columns is the user password.
This password is not encrypted, what I have to do now is grab automatically all the users and all the passwords in that table, encrypt them, and update the table with the new encrypted passwords.
What can I do? Using a PHP loop? Or what?
I am a little bit lost here..
Could you please provide a working example?
So I select the Passwords from the Table
$query="SELECT * FROM users";
$ar=mysql_query($query) or die("Error selecting accounts: ".mysql_error());
$ac = mysql_num_rows($ar);
while($arow = mysql_fetch_array($ar)) {
$password = $arow['Password'];
}
AND.......
After that I am totally lost.
Could you help me?
Thanks
Enter this code to phpMyAdmin SQL query page. First login in phpMyAdmin, then select DB and table and then click “SQL”. Then you need to enter this in the field and submit:
EDIT
The OP wanted actual PHP code:
Can’t get any clearer than this. You’d have to make sure that the password field is big enough to store md5 hashes. Remember that md5 hashes are 32 characters long.