так
пол дела сделал
кто поможет составить запрос дальше
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
function token($length = 32) {
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$max = strlen($string) - 1;
$token = '';
for ($i = 0; $i < $length; $i++) {
$token .= $string[mt_rand(0, $max)];
}
return $token;
}
function generar_pass($passTextoPlano){
$sal = token(9);
$hash = sha1($sal . sha1($sal . sha1($passTextoPlano)));
return [
"sal" => $sal,
"hash" => $hash,
];
}
$mysqli = new mysqli("localhost", "test", "test", "test");
$sql = mysqli_query($mysqli, 'SELECT * FROM `oc_customer`');
while ($result = mysqli_fetch_array($sql)) {
$id_user = $result['customer_id'];
$name_user = $result['firstname'];
$email_user = $result['email'];
$phone_user = $result['telephone'];
$datosPass = generar_pass("123456");
$pass = $datosPass["hash"];
$sal = $datosPass["sal"];
printf("id: %s имя: %s почта: %s телефон: %s пароль: %s соль: %s <br>", $id_user, $name_user, $email_user, $phone_user, $pass, $sal );
}