Var kāds ielikt scriptā funciju! ja piemēram netiek atrasta servera png , tad tur rādās Nav atēla png?

Tip no_img


    <?php
    function get_tf2_data($address) {
    $array = explode(":", $address);
     
    $server['status'] = 0;
    $server['ip'] = $array[0];
    $server['port'] = $array[1];
     
    if (!$server['ip'] || !$server['port'])
    exit("Nav norādīta pareiza servera adrese!");
     
    $socket = @fsockopen("udp://{$server['ip']}", $server['port'], $errno, $errstr, 1);
     
    if (!$socket)
    return $server;
     
    stream_set_timeout($socket, 1);
    stream_set_blocking($socket, TRUE);
    fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
    $packet = fread($socket, 4096);
    @fclose($socket);
     
    if (!$packet)
    return $server;
     
    $header = substr($packet, 0, 4);
    $response_type = substr($packet, 4, 1);
    $network_version = ord(substr($packet, 5, 1));
     
    $packet_array = explode("\x00", substr($packet, 6), 5);
    $server['name'] = $packet_array[0];
    $server['map'] = $packet_array[1];
    $server['game'] = $packet_array[2];
    $server['description'] = $packet_array[3];
    $packet = $packet_array[4];
    $app_id = array_pop(unpack("S", substr($packet, 0, 2)));
    $server['players'] = ord(substr($packet, 2, 1));
    $server['playersmax'] = ord(substr($packet, 3, 1));
    $server['bots'] = ord(substr($packet, 4, 1));
    $server['status'] = 1;
    $server['dedicated'] = substr($packet, 5, 1);
    $server['os'] = substr($packet, 6, 1);
    $server['password'] = ord(substr($packet, 7, 1));
    $server['vac'] = ord(substr($packet, 8, 1));
     
    return $server;
    }
     
    function get_cs_data($address) {
    $array = explode(":", $address);
     
    $server['status'] = 0;
    $server['ip'] = $array[0];
    $server['port'] = $array[1];
     
    if (!$server['ip'] || !$server['port'])
    exit("Nav norādīta pareiza servera adrese!");
     
    $socket = @fsockopen("udp://{$server['ip']}", $server['port'], $errno, $errstr, 1);
     
    if (!$socket)
    return $server;
     
    stream_set_timeout($socket, 1);
    stream_set_blocking($socket, TRUE);
    fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
    $packet = fread($socket, 4096);
    @fclose($socket);
     
    if (!$packet)
    return $server;
     
    $packet = substr($packet, 5);
    $packet = substr($packet, strpos($packet, chr(0)) + 1);
    $server['name'] = substr($packet, 0, strpos($packet, chr(0)));
    $packet = substr($packet, strpos($packet, chr(0)) + 1);
    $server['map'] = substr($packet, 0, strpos($packet, chr(0)));
    $packet = substr($packet, strpos($packet, chr(0)) + 1);
    $packet = substr($packet, strpos($packet, chr(0)) + 1);
    $packet = substr($packet, strpos($packet, chr(0)) + 1);
    $server['players'] = ord(substr($packet, 0, 1));
    $server['playersmax'] = ord(substr($packet, 1, 1));
    $server['status'] = 1;
     
    return $server;
    }
     
    function show_monitor($address, $type = 'cs') {
    $server = $type == 'cs' ? get_cs_data($address) : get_tf2_data($address);
     
    list($hostname, $port) = explode(':', $address);
     
    $mapimg = 'http://bildes.mostwanted.lv/map-icons/' . $server['map'] . '.jpg';
     
    if($server['status'] === 0) {
    echo 'Neizdevās sazināties ar serveri!';
    } else {
    ?>
    <!--<div class="panels2-m"><?php echo $server['name'];?></div>-->
    <div class="aboutBox">
    <img style="display:inline;float:left;border: 1px solid grey; padding: 1px;" src="<?php echo $mapimg;?>" width="130px" height="60px" />
<span style="color: #888">
&nbsp;&nbsp;<img src="bildites/icons.png" />&nbsp;Statuss: <span style="color: green">Ieslēgts</span><br />
&nbsp;&nbsp;<img src="bildites/icons.png" />&nbsp;IP: <a style="text-decoration:none; color:#707070;" href="steam://connect/<?php echo $address;?>"><?php echo $hostname;?></a><br />
&nbsp;&nbsp;<img src="bildites/icons.png" />&nbsp;Spēlētāji: <span style="color:#00aeff;"><?php echo $server['players'];?></span>/<?php echo $server['playersmax'];?><br />
&nbsp;&nbsp;<img src="bildites/icons.png" />&nbsp;Karte: <?php echo $server['map'];?><br /></div>
    
    
    <?php
    }
    }
     
    get_cs_data('war3.gign.lv:27015');
    ?>

    <div id="tooltip"></div>
    <script type="text/javascript">
    var offsetxpoint = -60
    var offsetypoint = 20
    var ie = document.all
    var ns6 = document.getElementById && !document.all
    var enabletip = false
    if (ie || ns6)
    var tipobj = document.all ? document.all["tooltip"] : document.getElementById ? document.getElementById("tooltip") : ""
     
    function ietruebody() {
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
     
    function showtooltip(thetext, thecolor, thewidth){
    if (ns6||ie) {
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    tipobj.innerHTML = thetext
    enabletip = true
    return false
    }
    }
     
    function positiontip(e){
    if (enabletip) {
    var curX = (ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
    var curY = (ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
     
    var rightedge = ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
    var bottomedge = ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
     
    var leftedge = (offsetxpoint<0)? offsetxpoint*(-1) : -1000
     
    if (rightedge<tipobj.offsetWidth)
    tipobj.style.left = ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
    else if (curX<leftedge)
    tipobj.style.left = "5px"
    else
     
    tipobj.style.left = curX+offsetxpoint+"px"
     
    if (bottomedge<tipobj.offsetHeight)
    tipobj.style.top = ie ? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
    else
    tipobj.style.top = curY+offsetypoint+"px"
    tipobj.style.visibility = "visible"
    }
    }
     
    function hidetooltip() {
    if (ns6||ie) {
    enabletip = false
    tipobj.style.visibility = "hidden"
    tipobj.style.left = "-1000px"
    tipobj.style.backgroundColor = ''
    tipobj.style.width = ''
    }
    }
     
    document.onmousemove = positiontip
    </script>
    <?php
    show_monitor('ip:27015');
    show_monitor('ip:27015');
    show_monitor('ip:27015');
    show_monitor('ip:27015', false);

    ?>
    </body2>
    </html>

Laboja SliDerS, labots 3x