Jump to content
php.lv forumi

Monitoram kkas kaiš! :D


HULK

Recommended Posts

Sveicināti.

Es netieku galā ar cs 1.6 monitoringu, itkā viss iet, bet nevaru atrast problēmu, kādeļ mapes bildes nerāda.

Monitors izkatās šādi!

lig5vckdijrf0wf3c0.jpg

 

Skripts!

<?php

$back = "#000000"; //background color aiz bildes un mapes nosaukuma

$server_host="dd2.retry.lv"; //servera adrese

$server_port="27015"; //servera ports

$img_width = "150px"; //image platums

$img_height = "90px"; //image augstums

$img_addr = "images/maps/"; //atteelu atrashanaas vieta

$img_n = "jpg"; //atteela paplashinaajums - .jpg , .gif , .png

 

 

$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 maina mapi..."; //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"; //kraasa, kuraa uzraadiisies shobriid speeleejosho speeleetaaju skaits, ja serveris ir pilns

} elseif($pl_online >= ($pl_max-0)) { //3 noraada, cik slotiem jaabuut briiviem, lai uzraadiitos speeleejosho speeleetaaju skaits citaa kraasaa

$pl_col = "#4AA02C"; ////kraasa, kuraa uzraadiisies shobriid speeleejosho speeleetaaju skaits, ja serverii ir 3 briivi sloti

} else {

$pl_col = "#4AA02C"; //kraasa, kuraa uzraadiisies shobriid speeleejosho speeleetaaju skaits, ja serveris ir paaraak tush

}

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

$current_map_img = "<img src='".$img_addr."images/maps/".$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."images/maps/".$img_n."' class='image' float='top' alt='".$map."' style='width: ".$img_width."; height: ".$img_height."; border:2px solid ".$back.";'>"; //noimage.jpg ir atteels, kursh uzraadaas, ja nav iistaas mapes atteels

}

echo "".$server_name."

<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."</div>

".$current_map_img."

<br>

<table>

<tr>

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

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

</tr>

<tr>

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

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

</tr>

<tr>

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

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

</tr>

</table>

</div>";

}

}

?>

 

Nēsmu tik gudrs php jomā lai izštukotu, kas par vainu, bet ceru kad palīdzēsiet un vietas kur es kko varētu būt nočakarējis salabsiet.

Paldies. :)

Link to comment
Share on other sites

Labāk vienmēr liecs te

nav īsti norādīts uz attēla links vari palabot

$current_map_img = "<img src='".$img_addr."images/maps/".$img_n."' class='image' float='top' alt='".$map."' style='width: ".$img_width."; height: ".$img_height."; border:2px solid ".$back.";'>"; //noimage.jpg ir atteels, kursh uzraadaas, ja nav iistaas mapes atteels

Link to comment
Share on other sites

OMFG

if (@fclose(@fopen($img_addr."/".$map.$img_n, "r"))) {
$current_map_img = "<img src='./images/maps/".$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='./images/maps/".$img_n."' class='image' float='top' alt='".$map."' style='width: ".$img_width."; height: ".$img_height."; border:2px solid ".$back.";'>"; //noimage.jpg ir atteels, kursh uzraadaas, ja nav iistaas mapes atteels
}

Link to comment
Share on other sites

Ai es atkal palaboju, bet vienalga niet, vaina nav ka man nav mapes bildes saliktas, visas zem pareizajiem nosaukumiem viss okey, bet bildi nerāda :S

Omg, esmu tik liels amatieris, kad nesaprotu. :S

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...