Item Wipe Script

Website Scripts for your Helbreath Server.
[51LV3RY]
Regular
Posts: 48
Joined: Mon Aug 16, 2004 5:51 pm

Post by [51LV3RY] »

Here you have it... enjoy... for more scripts just request here.
<html>
<head>
<title>-= [ Items Wipe Tool ] =-</title>
</head>
<body bgcolor="#EFECE2" text="#000000">

<?
Error_reporting(0);
/*--------------Server Path----------------*/
$dir = 'C:\\HB-Server';
$dir = ($dir==''?'':$dir.'\\');
/*--------------Server Path----------------*/
if(!$_POST)
{
        echo '<form action="'.$_SERVER['PHP_SELF'].'" method=post>
        <center><h2><u>Items Wipe Tool</u></h2>
        Admin Character: <input type="text" name=admin><br>
        Admin Password: <input type="password" name=pass><br><br>
        Click here to Wipe - <input type=submit value=Submit>
        </form>';
}
else{
        if(!$_POST['admin'] | !$_POST['pass'])
        die('Please fill all the fields');

        $adm_name = $_POST['admin'];
        $adm_pass = $_POST['pass'];
        $ord = ord($adm_name);
        $adm_path = $dir.'Character\\AscII'.$ord.'\\'.$adm_name.'.txt';

        if(!file_exists($adm_path))
        die('Character <b>'.$adm_name.'</b> isn\'t exists');

        $file = file($adm_path);
        for($i=0; $i<count($file); $i++)
        {
                if(preg_match('/account-name      =/', $file[$i]))
                $acc_l = $i;
                elseif(preg_match('/admin-user-level =/', $file[$i]))
                $adm_l = $i;
        }
        $acc_l = str_replace('account-name      =', '', $file[$acc_l]);
        $acc_l = trim($acc_l);
        $ac_ord = ord($acc_l);

        $adm_l = str_replace('admin-user-level =', '', $file[$adm_l]);
        $adm_l = trim($adm_l);

        if($adm_l != '4')
        die('The character <b>'.$adm_name.'</b> isn\'t a level 4 admin.');

        $ac_file = file($dir.'Account\\AscII'.$ac_ord.'\\'.$acc_l.'.txt');
        for($i=0; $i<count($ac_file); $i++)
        {
                if(preg_match('/account-password =/', $ac_file[$i]))
                $pass_l = $i;
        }
        $pass_l = str_replace('account-password =', '', $ac_file[$pass_l]);
        $pass_l = trim($pass_l);

        if($pass_l != $adm_pass)
        die('Wrong password');


        $glob = glob($dir.'Character\\AscII*\\*.txt');
        for($a=0; $a<count($glob); $a++)
        {

          //-----------------------------------------------------------
          // character-item [WIPE]
          //-----------------------------------------------------------
          $file = file($glob[$a]);
          for($i=0; $i<count($file); $i++)
          {
            if(preg_match('/character-item/', $file[$i]))
            $line = $i;
            $file[$line] = NULL;
          }
          $file = implode('', $file);
          $fopen = fopen($glob[$a], 'w');
          fwrite($fopen, $file);
          fclose($fopen);

          //-----------------------------------------------------------
          // character-bank-item [WIPE]
          //-----------------------------------------------------------
          $file = file($glob[$a]);
          for($i=0; $i<count($file); $i++)
          {
            if(preg_match('/character-bank-item/', $file[$i]))
            $line = $i;
            $file[$line] = NULL;
          }
          $file = implode('', $file);
          $fopen = fopen($glob[$a], 'w');
          fwrite($fopen, $file);
          fclose($fopen);
        }

        echo 'All the items of  <b>'.count($glob).'</b> characters have been removed';
}
?>

</body>
</html>
Post Reply