Old database to Znote AAC compatibility converter:
Converting accounts and characters to work with Znote AAC:
';
echo 'Total accounts detected: '. count($all_account) .'.';
if (isset($znote_account)) {
echo '
';
echo 'Znote compatible accounts detected: '. count($znote_account) .'.';
if (isset($old_accounts)) {
echo '
';
echo 'Old accounts detected: '. count($old_accounts) .'.';
}
} else {
echo '
';
echo 'Znote compatible accounts detected: 0.';
}
echo '
';
echo '
';
} else {
echo '
';
echo 'Total accounts detected: 0.';
}
// end count status
// validate accounts
if (isset($old_accounts) && $old_accounts !== false) {
$time = time();
foreach ($old_accounts as $old) {
// Make acc data compatible:
mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`) VALUES ('$old', '0', '$time')");
$updated_acc += 1;
// Fetch unsalted password
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) {
$password = user_data($old, 'password', 'salt');
$p_pass = str_replace($password['salt'],"",$password['password']);
}
if ($config['TFSVersion'] == 'TFS_02' || $config['salt'] === false) {
$password = user_data($old, 'password');
$p_pass = $password['password'];
}
// Verify lenght of password is less than 28 characters (most likely a plain password)
if (strlen($p_pass) < 28 && $old > 1) {
// encrypt it with sha1
if ($config['TFSVersion'] == 'TFS_02' || $config['salt'] === false) $p_pass = sha1($p_pass);
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) $p_pass = sha1($password['salt'].$p_pass);
// Update their password so they are sha1 encrypted
mysql_update("UPDATE `accounts` SET `password`='$p_pass' WHERE `id`='$old';");
$updated_pass += 1;
}
}
}
// validate players
if ($all_account !== false) {
$time = time();
foreach ($all_account as $all) {
$chars = user_character_list_player_id($all);
if ($chars !== false) {
// since char list is not false, we found a character list
// Lets loop through the character list
foreach ($chars as $c) {
// Is character not compatible yet?
if (user_character_is_compatible($c) == 0) {
// Then lets make it compatible:
mysql_insert("INSERT INTO `znote_players` (`player_id`, `created`, `hide_char`, `comment`) VALUES ('$c', '$time', '0', '')");
$updated_char += 1;
}
}
}
}
}
echo "
SUCCESS
";
echo 'Updated accounts: '. $updated_acc .'
';
echo 'Updated characters: : '. $updated_char .'
';
echo 'Detected:'. $updated_pass .' accounts with plain passwords. These passwords has been given sha1 encryption.
';
echo '
All accounts and characters are compatible with Znote AAC
';
?>