This topic is locked

Generate passwords encrypted with bcrypt in an already existing user table

3/30/2023 1:58:21 AM
PHPRunner General questions
alfonso authorDevClub member

I have a table with 700 records and in a field of this table I have the access password. My question is how can I generate, in another field of the table, the password with bcrypt for the already registered users. For new users it's easy with the phprunner "Registration and passwords" options

mbintex 3/30/2023

Try it with this code for selected records. A field "Passwortkopie" is used for saving the password without encryption as a way back in case something went wrong. $altespasswort is the old password, $verschlpasswort is the encrypted version.
`$sql="alter table Benutzer add Passwortkopie varchar(60);";
$sql="update Benutzer set Passwortkopie=Passwort;";
$sql="alter table Benutzer modify Passwort varchar(60);";
while($record = $button->getNextSelectedRecord())

$sql="update Benutzer set Passwort='".$verschlpasswort."' where Email='".$email."';";

//$valid=password_verify ( $altespasswort , $verschlpasswort ) ;
//$sql="update Benutzer set Gruppe='".$valid."' where Email='".$email."';";
alert("Verschl├╝sselung erfolgt.");


alfonso authorDevClub member 3/30/2023

In which event do I have to add that code? Is there no way that with one code you can generate all the passwords without having to go through one by one?

mbintex 3/30/2023

It is the code for a custom button and it changes the passwords for all marked users (getNextSelectedRecord) ...