Jump to content

Script working slower on newer php version


Amerika

Recommended Posts

Hi i have a problem with an third party script. I dont know why but with the newer php version it is much slower then with an older php version.

What could produce much slower results in the new php from this code:

<?php

$back = "#000000"; //background color

$server_host="address";

$server_port="27015";

$img_width = "150px";

$img_height = "90px";

$img_addr = "http://images";

$img_n = ".jpg";

 

 

$qw=chr(32);

$fp = fsockopen ("udp://".$server_host,$server_port);

if (!$fp)

{

echo "Error\n";

}

else {

fwrite($fp,"\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00".chr(10));

$start=time();

socket_set_timeout($fp,1);

$st=fread($fp,1);

$r=socket_get_status($fp);

$r=$r["unread_bytes"];

if($r == 0) {

echo "Serveris šobrīd nedarbojas vai maina karti!"; //teksts, kas uzraadiisies, ja serveris ir izsleegts vai maina mapi

} else {

$st=fread($fp,$r);

fclose($fp);

$st=substr($st,5);

$adrese1=SubStr($st,0,StrPos($st,chr(0)));

$adrese2=str_replace(chr(0),"|",$address);

$st=SubStr($st,StrPos($st,chr(0))+1);

$server_name=SubStr($st,0,StrPos($st,chr(0)));

$st=SubStr($st,StrPos($st,chr(0))+1);

$map=SubStr($st,0,StrPos($st,chr(0)));

$st=SubStr($st,StrPos($st,chr(0))+1);

$st=SubStr($st,StrPos($st,chr(0))+1);

$st=SubStr($st,StrPos($st,chr(0))+1);

$pl_online=ord(SubStr($st,0,1));

$pl_max=ord(SubStr($st,1,1));

$free = ($pl_max-$pl_online);

if($pl_max == $pl_online) {

$pl_col = "#ff0000";

} elseif($pl_online >= ($pl_max-0)) {

$pl_col = "#4AA02C";

} else {

$pl_col = "#4AA02C";

}

if (@fclose(@fopen($img_addr." ".$map.$img_n, "r"))) {

$current_map_img = "<img src='$img_addr$map$img_n class='image' float='top' alt='".$map."' style='width: ".$img_width."; height: ".$img_height."; border:2px solid ".$back.";'>";

} else {

$current_map_img = "<img src='$img_addr$map$img_n' class='image' float='top' alt='".$map."' style='width: ".$img_width."; height: ".$img_height."; border:2px solid ".$back.";'>";

}

echo "

<div style=\"width: 165px; font-size: 12px; font-family: Arial, Helvetica, sans-serif; margin: auto;\">

<div style=\"float: left; color: #fff; padding: 3px; background-color: ".$back."; text-align: center;\" class=\"map_name\">".$map."

".$current_map_img."

<br>

<table>

<tr>

<td><font size='1pt' color='white'>Adrese:</font></td>

<td><font size='1pt' color='white'>".$server_host.":".$server_port."</font></td>

</tr>

<tr>

<td><font size='1pt' color='white'>Speletaji:</font></td>

<td><font size='1pt' color='white'><span style=\"color: ".$pl_col."\">".$pl_online."</span>/<span style=\"color: #ff0000\">".$pl_max."</span></font></td>

</tr>

<tr>

<td><font size='1pt' color='white'>Karte:</font></td>

<td><font size='1pt' color='white'>".$map."</font></td>

</tr>

</table>

</div></div>";

}

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.