Help Creating This Php Script...

Website Scripts for your Helbreath Server.
Post Reply
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Well...i been using a php script made by wannabee B)

The problem is that i have an account.txt file

account.txt

Code: Select all

account-character  = }{orus

Account-generated:  Time(2005/7/3/16/06)  IP(81.165.221.197)

[NAME]

account-name     = }{avana

[PASSWORD]

account-password = g0dv3rd0mm

[ACCOUNT-STATUS]

account-valid-time = 0
account-valid-date = 2004 6 4

account-change-password = 2004 6 12
[ETC]

account-Gender   = Male
account-Age      =
account-Birth-Year = xxxx
account-Birth-Month = xx
account-Birth-Day   = xx
account-RealName = }{avana
account-SSN      = ssn
account-Email    = dieter1989@hotmail.com
account-Quiz     = Who am I??
account-Answer   = s0m€On€
account-created-by = Tamir's account creator
What i am trying to change with the php script is

this:
account-character
for this:
account-character-WS2
But when i try the php script, instead of changing that part only, it changes me the complete line...so it changes

this:
account-character  = }{orus
for this:
account-character -WS2
Removing the character name at the end...

Here is the php script i am using at the moment.

Note: I ain't no php programmer, i was just messing around with someone's work :P

<a href='http://www.hb-celestial.com/script.txt' target='_blank'>SCRIPT FILE</a>
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
[51LV3RY]
Regular
Posts: 48
Joined: Mon Aug 16, 2004 5:51 pm

Post by [51LV3RY] »

I here are the 2 php's you will need when using a different WorldServer...

ChangeWS(acc) -> changes the WS line to the one disired

P.S: Files attached!

Code: Select all

<html>
<head>
<title>-= [ Change WS (acc) ] =-</title>
</head>
<body bgcolor="#EFECE2" text="#000000">

<?php
Error_reporting(0);
/*--------------Server Path----------------*/
$dir = 'C:\\HB-Server2\\';
$dir = ($dir==''?'':$dir.'\\');
/*--------------Server Path----------------*/
if(!$_POST)
{
        echo '<form action="'.$_SERVER['PHP_SELF'].'" method=post>
        <center><h2><u>Change WL Server</u></h2>
        Admin Character: <input type="text" name=admin><br>
        Admin Password: <input type="password" name=pass><br><br>
        Click here to Change WS - <input type=submit value=Submit>
        <hr>
        Current WL: <input type="txt" name=c_wls> (i.e account-character-WS1)<br> 
        Change WL: <input type="txt" name=n_wls> (i.e account-character-WS2)<br><br>
        </form>';
}
else{
        if(!$_POST['admin'] | !$_POST['pass'])
        die('Please fill all the fields');

        $adm_name = $_POST['admin'];
        $adm_pass = $_POST['pass'];
        $c_wls = $_POST['c_wls'];
        $n_wls = $_POST['n_wls'];
        $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.'Account\\AscII*\\*.txt');
        for($a=0; $a<count($glob); $a++)
        {
                
                //-----------------------------------------------------------
                // 1st Character [CHANGE]
                //-----------------------------------------------------------
                $file = file($glob[$a]);
                for($i=0; $i<count($file); $i++)
                {
                  if(preg_match('/'.$c_wls.'/', $file[$i]))
                  $line = $i;
                }
                $wl_line = trim($file[$line]);
                $wl_line = str_replace($_POST[c_wls], $_POST[n_wls], $wl_line);

                $file[$line] = $wl_line."\r\n";
                $file = join('', $file);

                $fopen = fopen($glob[$a], 'w');
                fwrite($fopen, $file);
                fclose($fopen);

                //-----------------------------------------------------------
                // 2nd Character [CHANGE]
                //-----------------------------------------------------------
                $file = file($glob[$a]);
                for($i=0; $i<count($file); $i++)
                {
                  if(preg_match('/'.$c_wls.'/', $file[$i]))
                  $line = $i;
                }
                $wl_line = trim($file[$line]);
                $wl_line = str_replace($_POST[c_wls], $_POST[n_wls], $wl_line);

                $file[$line] = $wl_line."\r\n";
                $file = join('', $file);

                $fopen = fopen($glob[$a], 'w');
                fwrite($fopen, $file);
                fclose($fopen);

                //-----------------------------------------------------------
                // 3rd Character [CHANGE]
                //-----------------------------------------------------------
                $file = file($glob[$a]);
                for($i=0; $i<count($file); $i++)
                {
                  if(preg_match('/'.$c_wls.'/', $file[$i]))
                  $line = $i;
                }
                $wl_line = trim($file[$line]);
                $wl_line = str_replace($_POST[c_wls], $_POST[n_wls], $wl_line);

                $file[$line] = $wl_line."\r\n";
                $file = join('', $file);

                $fopen = fopen($glob[$a], 'w');
                fwrite($fopen, $file);
                fclose($fopen);

                //-----------------------------------------------------------
                // 4th Character [CHANGE]
                //-----------------------------------------------------------
                $file = file($glob[$a]);
                for($i=0; $i<count($file); $i++)
                {
                  if(preg_match('/'.$c_wls.'/', $file[$i]))
                  $line = $i;
                }
                $wl_line = trim($file[$line]);
                $wl_line = str_replace($_POST[c_wls], $_POST[n_wls], $wl_line);

                $file[$line] = $wl_line."\r\n";
                $file = join('', $file);

                $fopen = fopen($glob[$a], 'w');
                fwrite($fopen, $file);
                fclose($fopen);
        }
        echo 'All the WLserver of  <b>'.count($glob).'</b> accounts have been switched.';
}
?> 

</body>
</html>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Thanks a lot :)
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Post Reply