Null/Deleted Characters/Clans Delete script

Results 1 to 4 of 4
  1. #1
    num num num <3 rootbeer daniel131605 is offline
    MemberRank
    Jul 2008 Join Date
    New YorkLocation
    573Posts

    Null/Deleted Characters/Clans Delete script

    Eh im pretty sure its not on here, but a long while ago someone was asking for this and wizkid made a script and i edited it to the needs for my server. Now since im on a different computer it still works but it doesn't use mssql codes, it uses odbc ones. It should work if your odbc crap is configured right...

    simply open notepad and paste this into it and save it as index.php and throw it into your xampp folder.

    FakeCharacterDelete

    <?php
    //Written by Wizkid Edited by daniel131605
    //Copyright 2008 - 2009

    //Let us connect the databases.
    //Yeah yeah, ODBC this time.
    $host = "DANIELEWALDPC"; //The host.
    $user = "sa"; //The username.
    $pass = "d101395"; //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.";
    ?>


    FakeClanDelete


    <?php
    //Written by Wizkid Edited by daniel131605
    //Copyright 2008 - 2009

    //Let us connect the databases.
    //Yeah yeah, ODBC this time.
    $host = "DANIELEWALDPC"; //The host.
    $user = "sa"; //The username.
    $pass = "d101395"; //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 CLID FROM Clan WHERE Name = ''");
    $count = num_rows($query);

    while(odbc_fetch_row($query))
    {
    $clid = odbc_result($query, 1);

    odbc_exec($connect,"DELETE FROM Clanmember WHERE CLID = '" . $clid . "'");
    odbc_exec($connect,"DELETE FROM Clan WHERE CLID = '" . $clid . "'");


    echo "Removed the clan with CLID " . $clid . ". <br />";
    }

    echo $count . " clans have been totally removed out of the database.";
    ?>


    credits to me for editing the crap, credits to wizkid for making the crap


  2. #2
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Null/Deleted Characters/Clans Delete script

    I can do it with 2 queries.

    Delete * from CharacterItem where name= 'name'
    Delete * from character where name ='name'

    same goes for clans..

    Anyway , good job.
    Last edited by Vusion; 07-08-11 at 04:12 PM.

  3. #3
    Proficient Member Zewa is offline
    MemberRank
    Nov 2009 Join Date
    EstoniaLocation
    183Posts

    Re: Null/Deleted Characters/Clans Delete script

    Quote Originally Posted by Vusion View Post
    I can do it with 2 queries.

    Delete * from CharacterItem where name= 'name'
    Delete * from character where name ='name'

    same goes for clans..

    Anyway , good job.
    well you have to connect also to DB
    and if you would to like this:
    Delete * from CharacterItem where name= 'name'
    Delete * from character where name ='name'


    then you would get an error.

    should be like this:
    Delete from CharacterItem where name= 'name'
    Delete from character where name ='name'

  4. #4
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Null/Deleted Characters/Clans Delete script

    Quote Originally Posted by Zewa View Post
    well you have to connect also to DB
    and if you would to like this:
    Delete * from CharacterItem where name= 'name'
    Delete * from character where name ='name'


    then you would get an error.

    should be like this:
    Delete from CharacterItem where name= 'name'
    Delete from character where name ='name'
    I was in a rush.



Advertisement