Quote:
Originally Posted by MarkPW
Where are your SQL errors generated from? You're giving me half the story - I haven't a clue what's happening in the "rest" of your script. The above script generated a password hash with salt. It has does nothing to do with your database. Your SQL errors are coming from somewhere...
|
OH. Ok here:
PHP Code:
<?php
include "pwfunction.php";
$dbh=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
$get = mysql_query("SELECT * FROM users") or die('Error, query failed');
while($row = mysql_fetch_array($get)){
$password = $row['password'];
$id = $row['id'];
$salt = fetch_user_salt();
$hash = hash_password($password, $salt);
$update = mysql_query("UPDATE users SET `password`='$hash', `salt`='$salt' WHERE `id`='$id'") or die(mysql_error());
}
?>
pwfunctions.php is the same. Sorry my bad, I forgot to add the updated script for running it.