哈希密码更新mysql无法正常工作

时间:2013-02-26 07:51:45

标签: php mysql password-encryption phpass

我运行了以下PHP并且它回显了散列密码,但是,它没有更新/替换表中未散列的密码?

<?php 
  require_once 'wp-config.php';

$sql="SELECT user_pass,ID FROM wp_users WHERE ID BETWEEN 5000 AND 10000";
$find = mysql_query($sql) or die(mysql_error());

  while($row = mysql_fetch_array($find))
  {

  $current_password = $row['user_pass'];
  $current_id = $row['ID'];
  $hashed_password = wp_hash_password( $current_password );

  $update_sql= "UPDATE wp_users SET user_pass = '" . $hashed_password . "' WHERE ID = " . $current_id . "";
  $update = mysql_query($update_sql) or die(mysql_error());  

  echo $current_id . " " . $hashed_password;
  echo "<br />";
  }

 ?>

0 个答案:

没有答案