diff -r de56132c008d -r bdac73ed481e install/schemas/upgrade/1.1.5-1.1.6.php --- a/install/schemas/upgrade/1.1.5-1.1.6.php Sun Mar 28 21:49:26 2010 -0400 +++ b/install/schemas/upgrade/1.1.5-1.1.6.php Sun Mar 28 23:10:46 2010 -0400 @@ -9,27 +9,27 @@ $q = $db->sql_query('UPDATE ' . table_prefix . "users SET old_encryption = 2 WHERE user_id > 1 AND old_encryption = 0;"); if ( !$q ) - $db->_die(); + $db->_die(); $q = $db->sql_query('SELECT user_id, password FROM ' . table_prefix . "users WHERE user_id > 1 AND old_encryption = 2;"); if ( !$q ) - $db->_die(); + $db->_die(); while ( $row = $db->fetchrow($q) ) { - $password = $session->pk_decrypt($row['password']); - if ( empty($password) ) - { - global $ui; - echo '

1.1.5-1.1.6 migration script: ERROR: bad password returned from $session->pk_decrypt()

'; - $ui->show_footer(); - exit; - } - $hmac_secret = hexencode(AESCrypt::randkey(20), '', ''); - $password = hmac_sha1($password, $hmac_secret); - $e = $db->sql_query('UPDATE ' . table_prefix . "users SET password = '{$password}', password_salt = '{$hmac_secret}', old_encryption = 0 WHERE user_id = {$row['user_id']};"); - if ( !$e ) - $db->_die(); + $password = $session->pk_decrypt($row['password']); + if ( empty($password) ) + { + global $ui; + echo '

1.1.5-1.1.6 migration script: ERROR: bad password returned from $session->pk_decrypt()

'; + $ui->show_footer(); + exit; + } + $hmac_secret = hexencode(AESCrypt::randkey(20), '', ''); + $password = hmac_sha1($password, $hmac_secret); + $e = $db->sql_query('UPDATE ' . table_prefix . "users SET password = '{$password}', password_salt = '{$hmac_secret}', old_encryption = 0 WHERE user_id = {$row['user_id']};"); + if ( !$e ) + $db->_die(); }