- Joined
- Dec 4, 2007
- Messages
- 2,502
- Reaction score
- 987
Wrote a PHP script to do it. Just fill in the needed variables, then navigate with your browser to the page and it should execute.
Please note that anyone that knows the path can execute it, there's no security.
The script:
Might be a helpfull script.
Please note that anyone that knows the path can execute it, there's no security.
The script:
PHP:
<?php
//Written by Wizkid
//Copyright 2008 - 2009
//Let us connect the databases.
//Yeah yeah, ODBC this time.
$host = "PETER-18BEFA497\SQLEXPRESS"; //The host.
$user = "SA"; //The username.
$pass = "password"; //The password. I hope it's unique for you.
$dbname = "GunzDB"; //The dbname. Most likely GunzDB.
$connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
//The num_rows() function for ODBC since the default one always returns -1.
function num_rows(&$rid) {
//We can try it at least, right?
$num= odbc_num_rows($rid);
if ($num >= 0) {
return $num;
}
if (!odbc_fetch_row($rid, 1)) {
odbc_fetch_row($rid, 0);
return 0;
}
if (!odbc_fetch_row($rid, 2)) {
odbc_fetch_row($rid, 0);
return 1;
}
$lo= 2;
$hi= 8192000;
while ($lo < ($hi - 1)) {
$mid= (int)(($hi + $lo) / 2);
if (odbc_fetch_row($rid, $mid)) {
$lo= $mid;
} else {
$hi= $mid;
}
}
$num= $lo;
odbc_fetch_row($rid, 0);
return $num;
}
//Query time.
$query = odbc_exec($connect,"SELECT CID FROM Character WHERE Name = ''");
$count = num_rows($query);
while(odbc_fetch_row($query))
{
$cid = odbc_result($query, 1);
odbc_exec($connect,"DELETE FROM CharacterItem WHERE CID = '" . $cid . "'");
odbc_exec($connect,"DELETE FROM Character WHERE CID = '" . $cid . "'");
echo "Removed the character with CID " . $cid . ". <br />";
}
echo $count . " characters have been totally removed out of the database.";
?>
Might be a helpfull script.