"; } else { echo "Error upgrading Control table."; } unset($query); $query = <<"; } else { echo "Error populating Control table."; } unset($query); $query = mysql_query("SELECT * FROM $users ORDER BY id") or die(mysql_error()); $errors = 0; $errorlist = ""; while ($row = mysql_fetch_array($query)) { $id = $row["id"]; $oldspells = explode(",",$row["spells"]); $newspells = "0,"; $oldtowns = explode(",",$row["towns"]); $newtowns = "0,"; foreach($oldspells as $a => $b) { if ($b == 1) { $newspells .= "$a,"; } } $newspells = rtrim($newspells,","); foreach($oldtowns as $c => $d) { if ($d == 1) { $newtowns .= "$c,"; } } $newtowns = rtrim($newtowns,","); $update = mysql_query("UPDATE $users SET spells='$newspells',towns='$newtowns',verify='1' WHERE id='$id' LIMIT 1"); if ($update == false) { $errors++; $errorlist .= mysql_error() . "
"; } else { echo "User $id upgraded.
"; } } if ($errors != 0) { echo "
The following errors occurred while upgrading the users list:
$errorlist"; } else { echo "
The upgrade completed successfully. Please log in to the game and visit the control panel to update your main game settings.

You should also delete this file from your Dragon Knight directory for security reasons.
"; } } else { echo "Click the button below to run the upgrade script.
"; die(); } ?>