Jump to content

Recommended Posts

Hey guys i have a converter code i made that is suposed to convert a copy past of data and create a board freindly version.

 

Imput data looks like this:

Resources at Colony [1:130:6] (Player 'XISORZ') on 02-28 13:54:19

Metal:	33.361 	Crystal: 	152.878
Deuterium:	1.361 	Energy: 	16.728

Activity
Activity
Activity means that the scanned player has been active on that planet or another player had fleet contact with the planet you scanned.
Your espionage report shows abnormalities in the atmosphere of the planet which suggests activity within the last 15 minutes.
fleets
Large Cargo	108	Solar Satellite	492
Defense
Rocket Launcher	8.874	Light Laser	1.559
Heavy Laser	305	Gauss Cannon	46
Ion Cannon	62	Plasma Turret	116
Large Shield Dome	1	Anti-Ballistic Missiles	1
Interplanetary Missiles	7
Chance of counter-espionage: 7 %

 

The output is:

INFOS

ESP Date: 13:54:19

Player: XISORZ

Planet: Colony [1:130:6]

 

 

RESOURCES

Metal: 33.361

Crystal: 152.878

Deuterium: 1.361

Energy: 16.728

 

 

FLEET

Large Cargo: 108

Solar Satellite: 492

 

 

DEFENSES

Heavy Laser: 305

Gauss Cannon: 46

Ion Cannon: 62

Plasma Turret: 116

Interplanetary Missiles: 7

 

------- Created by

DC ESP TOOL V1.2 ---------

 

But as you can see, it's missing data in the DEFENSES section

Rocket Launcher 8.874

Light Laser 1.559

Large Shield Dome 1

Anti-Ballistic Missiles 1

 

I don't get it why they are not picked up ...

 

My code is the folowing:

// first we check if the form has been posted
if ($_POST[str] or $_GET[url=http://) {
    
    if (!$_GET[url]){
    if ($_POST[board]=="1"){$theb = "Vbullettin";}
    if ($_POST[board]=="2"){$theb = "Burning Board";}

    // We explode each lines
    $str = explode("\r\n", $_POST["str"]);
    $linecount = count($str); // Number of lines

    // We loop the lines
    $i = 0;
    while ($i <= $linecount) {

        // We filter out empty lines
        $line = str_replace(' ', '', $str[$i]);
        if ($line != "") {
            
            $str[$i] = trim($str[$i]);
            $str[$i] = str_replace ('	', ' ', $str[$i]);
            $str[$i] = str_replace ('  ', ' ', $str[$i]);

            if ($line == "fleets") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>FLEET</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]FLEET[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]FLEET[/b][/size][/color]' . "\n";
                $inc++;
            }

            if ($line == "Defense") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>DEFENSES</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]DEFENSES[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]DEFENSES[/b][/size][/color]' . "\n";
                $inc++;
            }

            if ($line == "Building") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>BUILDINGS</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]BUILDINGS[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]BUILDINGS[/b][/size][/color]' . "\n";
                $inc++;
            }
            
            if ($line == "Research") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>RESEARCH</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESEARCH[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESEARCH[/b][/size][/color]' . "\n";
                $inc++;
            }
            
            // preg_match_all('/([^0-9\.]+)([0-9\.]+)/is',$str[$i],$output);

            if (preg_match('/^([a-z]+(?: [a-z]+){0,2}) ([0-9]+)(?: ([a-z]+(?: [a-z]+){0,2}) ([0-9]+))?$/i', $str[$i], $regs1)) {

                $Weapon1 = $regs1[1];
                $Power1 = $regs1[2];
                $Weapon2 = $regs1[3];
                $Power2 = $regs1[4];

                if ($Weapon1) {
                    $html .= '<b>' . $Weapon1 . '</b>: <font color="#FF0000" size="2">' . $Power1 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon1 . '[/b]: [color=red]' . $Power1 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon1 . '[/b]: [color=red]' . $Power1 . '[/color]' . "\n";
                }

                if ($Weapon2) {
                    $html .= '<b>' . $Weapon2 . '</b>: <font color="#FF0000" size="2">' . $Power2 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon2 . '[/b]: [color=red]' . $Power2 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon2 . '[/b]: [color=red]' . $Power2 . '[/color]' . "\n";
                }
              $inc++;
            }

            if (preg_match('/(Metal|Deuterium): ([0-9.]+) (Crystal|Energy): ([0-9.]+)/i', $str[$i], $regs2)) {

                $Weapon3 = $regs2[1];
                $Power3 = $regs2[2];
                $Weapon4 = $regs2[3];
                $Power4 = $regs2[4];

                if ($Weapon3) {
                    $html .= '<b>' . $Weapon3 . '</b>: <font color="#FF0000" size="2">' . $Power3 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon3 . '[/b]: [color=red]' . $Power3 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon3 . '[/b]: [color=red]' . $Power3 . '[/color]' . "\n";
                }

                if ($Weapon4) {
                    $html .= '<b>' . $Weapon4 . '</b>: <font color="#FF0000" size="2">' . $Power4 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon4 . '[/b]: [color=red]' . $Power4 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon4 . '[/b]: [color=red]' . $Power4 . '[/color]' . "\n";
                }
              $inc++;  
            }

            if (preg_match('#Resources at (.+) \[([^\]]+)\] \(Player \'([^\']+)\'\) on [0-9]{2}-[0-9]{2} ((?:[0-9]{2}{2}[0-9]{2})#i', $str[$i], $regs3)) {
                //if (preg_match('/Resources at (.*) \[([0-9]+:[0-9]+:[0-9]+)\] \(Player \'(.*)\'\) on ([0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})/i', $str[$i], $regs3)) {
                    
                $nb = "0";
                $nb = $_POST[show_planet] + $_POST[show_player] + $_POST[show_coord] + $_POST[show_date];
                
                if ($nb!="0"){
                    $html .= '<font color="DarkOrange" size="3"><b>INFOS</b></font><br>';
                    $bbcode[1] .= '[color="DarkOrange"][size="3"][b]INFOS[/b][/size][/color]' . "\n";
                    $bbcode[2] .= '[color="DarkOrange"][size="3"][b]INFOS[/b][/size][/color]' . "\n";
                }

                $planet = $regs3[1];
                $coords = $regs3[2];
                $player = $regs3[3];
                $date = $regs3[4];
                
                if ($_POST[show_date]){
                if ($date) {
                    $html .= '<b>ESP Date</b>: ' . $date . '<br>';
                    $bbcode[1] .= '[b]ESP Date[/b]: ' . $date . "\n";
                    $bbcode[2] .= '[b]ESP Date[/b]: ' . $date . "\n";
                }
                }
                
                if ($_POST[show_player]){
                if ($player) {
                    $html .= '<b>Player</b>: ' . $player . '<br>';
                    $bbcode[1] .= '[b]Player[/b]: ' . $player . "\n";
                    $bbcode[2] .= '[b]Player[/b]: ' . $player . "\n";
                }
                }
                
                if ($coords) {
                    $tcoords = '[' . $coords . ']';
                }
                
                if ($_POST[show_planet] or $_POST[show_coords]){
                if ($planet) {
                    
                    if ($_POST[show_planet]){$html .= '<b>Planet</b>: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$html .= $tcoords;}
                    $html .= '<br>';
                    
                    if ($_POST[show_planet]){$bbcode[1] .= '[b]Planet[/b]: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$bbcode[1] .= $tcoords;}
                    $bbcode[1] .= "\n";
                    
                    if ($_POST[show_planet]){$bbcode[2] .= '[b]Planet[/b]: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$bbcode[2] .= $tcoords;}
                    $bbcode[2] .= "\n";
                    
                }
                }

                $html .= '<br><br><font color="DarkOrange" size="3"><b>RESOURCES</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESOURCES[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESOURCES[/b][/size][/color]' . "\n";
              $inc++;
            }

            if (preg_match('/^Chance of counter.*?:\s+(\d+)\s+%\s+$/im', $str[$i], $regs2)) {
                $counter = $regs2[1];
                $html .= '<br><br><center><i>Chance of counter-espionage: <b>' . $counter . '%</b></i></center>';
                $bbcode[1] .= "\n\n" . '
[center][i]Chance of counter-espionage: [b]' . $counter . '%[/b][/i][/center]
';
                $bbcode[2] .= "\n\n" . '
[center][i]Chance of counter-espionage: [b]' . $counter . '%[/b][/i][/center]
';
                $inc++;
            }

            // Line is not empty
            //echo "Line: $i) ".$str[$i]."<br>"; // debug
        }

        $i++;
    }

if ($inc){
    $html .= '<br><center>------- <font color="DarkOrange" size="4"><b>Created by <a href="http://dramis.info?mod=esp">DC ESP TOOL V'.$verssion.'</a></font></b> ---------</center>';
    $bbcode[1] .= '' . "\n" . '
[center]------- [b][size="4"][color="DarkOrange"]Created by [url="http://http://dramis.info?mod=esp"]DC ESP TOOL V'.$verssion.']) {
    
    if (!$_GET[url]){
    if ($_POST[board]=="1"){$theb = "Vbullettin";}
    if ($_POST[board]=="2"){$theb = "Burning Board";}

    // We explode each lines
    $str = explode("\r\n", $_POST["str"]);
    $linecount = count($str); // Number of lines

    // We loop the lines
    $i = 0;
    while ($i <= $linecount) {

        // We filter out empty lines
        $line = str_replace(' ', '', $str[$i]);
        if ($line != "") {
            
            $str[$i] = trim($str[$i]);
            $str[$i] = str_replace ('	', ' ', $str[$i]);
            $str[$i] = str_replace ('  ', ' ', $str[$i]);

            if ($line == "fleets") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>FLEET</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]FLEET[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]FLEET[/b][/size][/color]' . "\n";
                $inc++;
            }

            if ($line == "Defense") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>DEFENSES</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]DEFENSES[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]DEFENSES[/b][/size][/color]' . "\n";
                $inc++;
            }

            if ($line == "Building") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>BUILDINGS</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]BUILDINGS[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]BUILDINGS[/b][/size][/color]' . "\n";
                $inc++;
            }
            
            if ($line == "Research") {
                $html .= '<br><br><font color="DarkOrange" size="3"><b>RESEARCH</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESEARCH[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESEARCH[/b][/size][/color]' . "\n";
                $inc++;
            }
            
            // preg_match_all('/([^0-9\.]+)([0-9\.]+)/is',$str[$i],$output);

            if (preg_match('/^([a-z]+(?: [a-z]+){0,2}) ([0-9]+)(?: ([a-z]+(?: [a-z]+){0,2}) ([0-9]+))?$/i', $str[$i], $regs1)) {

                $Weapon1 = $regs1[1];
                $Power1 = $regs1[2];
                $Weapon2 = $regs1[3];
                $Power2 = $regs1[4];

                if ($Weapon1) {
                    $html .= '<b>' . $Weapon1 . '</b>: <font color="#FF0000" size="2">' . $Power1 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon1 . '[/b]: [color=red]' . $Power1 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon1 . '[/b]: [color=red]' . $Power1 . '[/color]' . "\n";
                }

                if ($Weapon2) {
                    $html .= '<b>' . $Weapon2 . '</b>: <font color="#FF0000" size="2">' . $Power2 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon2 . '[/b]: [color=red]' . $Power2 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon2 . '[/b]: [color=red]' . $Power2 . '[/color]' . "\n";
                }
              $inc++;
            }

            if (preg_match('/(Metal|Deuterium): ([0-9.]+) (Crystal|Energy): ([0-9.]+)/i', $str[$i], $regs2)) {

                $Weapon3 = $regs2[1];
                $Power3 = $regs2[2];
                $Weapon4 = $regs2[3];
                $Power4 = $regs2[4];

                if ($Weapon3) {
                    $html .= '<b>' . $Weapon3 . '</b>: <font color="#FF0000" size="2">' . $Power3 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon3 . '[/b]: [color=red]' . $Power3 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon3 . '[/b]: [color=red]' . $Power3 . '[/color]' . "\n";
                }

                if ($Weapon4) {
                    $html .= '<b>' . $Weapon4 . '</b>: <font color="#FF0000" size="2">' . $Power4 . '</font><br>';
                    $bbcode[1] .= '[b]' . $Weapon4 . '[/b]: [color=red]' . $Power4 . '[/color]' . "\n";
                    $bbcode[2] .= '[b]' . $Weapon4 . '[/b]: [color=red]' . $Power4 . '[/color]' . "\n";
                }
              $inc++;  
            }

            if (preg_match('#Resources at (.+) \[([^\]]+)\] \(Player \'([^\']+)\'\) on [0-9]{2}-[0-9]{2} ((?:[0-9]{2}{2}[0-9]{2})#i', $str[$i], $regs3)) {
                //if (preg_match('/Resources at (.*) \[([0-9]+:[0-9]+:[0-9]+)\] \(Player \'(.*)\'\) on ([0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})/i', $str[$i], $regs3)) {
                    
                $nb = "0";
                $nb = $_POST[show_planet] + $_POST[show_player] + $_POST[show_coord] + $_POST[show_date];
                
                if ($nb!="0"){
                    $html .= '<font color="DarkOrange" size="3"><b>INFOS</b></font><br>';
                    $bbcode[1] .= '[color="DarkOrange"][size="3"][b]INFOS[/b][/size][/color]' . "\n";
                    $bbcode[2] .= '[color="DarkOrange"][size="3"][b]INFOS[/b][/size][/color]' . "\n";
                }

                $planet = $regs3[1];
                $coords = $regs3[2];
                $player = $regs3[3];
                $date = $regs3[4];
                
                if ($_POST[show_date]){
                if ($date) {
                    $html .= '<b>ESP Date</b>: ' . $date . '<br>';
                    $bbcode[1] .= '[b]ESP Date[/b]: ' . $date . "\n";
                    $bbcode[2] .= '[b]ESP Date[/b]: ' . $date . "\n";
                }
                }
                
                if ($_POST[show_player]){
                if ($player) {
                    $html .= '<b>Player</b>: ' . $player . '<br>';
                    $bbcode[1] .= '[b]Player[/b]: ' . $player . "\n";
                    $bbcode[2] .= '[b]Player[/b]: ' . $player . "\n";
                }
                }
                
                if ($coords) {
                    $tcoords = '[' . $coords . ']';
                }
                
                if ($_POST[show_planet] or $_POST[show_coords]){
                if ($planet) {
                    
                    if ($_POST[show_planet]){$html .= '<b>Planet</b>: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$html .= $tcoords;}
                    $html .= '<br>';
                    
                    if ($_POST[show_planet]){$bbcode[1] .= '[b]Planet[/b]: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$bbcode[1] .= $tcoords;}
                    $bbcode[1] .= "\n";
                    
                    if ($_POST[show_planet]){$bbcode[2] .= '[b]Planet[/b]: ' . $planet . ' ';}
                    if ($_POST[show_coords]){$bbcode[2] .= $tcoords;}
                    $bbcode[2] .= "\n";
                    
                }
                }

                $html .= '<br><br><font color="DarkOrange" size="3"><b>RESOURCES</b></font><br>';
                $bbcode[1] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESOURCES[/b][/size][/color]' . "\n";
                $bbcode[2] .= "\n\n" . '[color="DarkOrange"][size="3"][b]RESOURCES[/b][/size][/color]' . "\n";
              $inc++;
            }

            if (preg_match('/^Chance of counter.*?:\s+(\d+)\s+%\s+$/im', $str[$i], $regs2)) {
                $counter = $regs2[1];
                $html .= '<br><br><center><i>Chance of counter-espionage: <b>' . $counter . '%</b></i></center>';
                $bbcode[1] .= "\n\n" . '[center][i]Chance of counter-espionage: [b]' . $counter . '%[/b][/i][/center]
';
                $bbcode[2] .= "\n\n" . '
[center][i]Chance of counter-espionage: [b]' . $counter . '%[/b][/i][/center]
';
                $inc++;
            }

            // Line is not empty
            //echo "Line: $i) ".$str[$i]."<br>"; // debug
        }

        $i++;
    }

if ($inc){
    $html .= '<br><center>------- <font color="DarkOrange" size="4"><b>Created by <a href="http://dramis.info?mod=esp">DC ESP TOOL V'.$verssion.'</a></font></b> ---------</center>';
    $bbcode[1] .= '' . "\n" . '
[center]------- [b][size="4"][color="DarkOrange"]Created by [url=http://"http://http://dramis.info?mod=esp"]DC ESP TOOL V'.$verssion.'[/url][/color][/size][/b] ---------[/center]
';
    $bbcode[2] .= '' . "\n" . '
[center]------- [b][size="4"][color="DarkOrange"]Created by [url=http://"http://http://dramis.info?mod=esp"]DC ESP TOOL V'.$verssion.'[/url][/color][/size][/b] ---------[/center]
';
}
}

Link to comment
https://forums.phpfreaks.com/topic/229167-code-not-working-well/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.