Frage script

  • der script refresht immer die seite 100mal ... das is kacke will das wegbakommen kann da ma einer schauen xD


    <?php
    chdir("../../");
    include ("config.inc.php");
    chdir("games");
    chdir("cod");
    $port = $codserverport;
    $ip = $codserver;

    $connect = fsockopen("udp://".$ip, $port);
    fwrite($connect, "ÿÿÿÿ". chr (0x02). "getstatus". chr (0x00));
    fread($connect, 4);
    $status = socket_get_status($connect);
    $timeout = time() +3;

    if($status['unread_bytes'] == 0 or time() >=$timeout)
    {
    echo "
    <div align=\"center\">";
    echo "<table><tr><td align=\"center\">";
    echo "Server
    $ip:$port
    antwortet nicht !
    ";
    die();
    }

    do
    {
    $empfangen .= fread($connect, 1);
    $status = socket_get_status($connect);
    }
    while($status['unread_bytes'] != 0);

    fclose($connect);
    $daten = explode("\n", $empfangen);
    $rules = explode("\\",$daten[1]);
    $find_pos = array_search ("sv_hostname", $rules);
    $hostname = $rules[$find_pos+1] . "\n";
    ?>
    <table border="0">
    <tr>
    <td align="center">
    <font color="#ffffff" size="3">Serverstatus</font>

    </td>
    </tr>
    <tr>


    <td align="center">
    <?php

    $find_pos = array_search ("mapname", $rules);
    $mapname = $rules[$find_pos+1] . "\n";

    if ( substr_count($mapname, "mp_brecourt") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_carentan") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_dawnville") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_depot") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_harbor") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_hurtgen") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_pavlov") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_railyard") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_rocket") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_ship") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_stalingrad") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_powcamp") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_chateau") > 0 ) {
    echo '
    ';
    }

    if ( substr_count($mapname, "mp_neuville") > 0 ) {
    echo '
    ';
    }
    ?>
    </td>
    </tr>
    <tr>
    <td align="center">
    <font color="#ffffff" size="2">Map <?php echo "$mapname"; ?></font>
    </td>
    </tr>
    <?php
    $playercount = count ($daten);
    $playercount = $playercount-3;
    $find_pos = array_search ("sv_maxclients", $rules);
    $maxplayers = $rules[$find_pos+1] . "\n";
    ?>

    <tr>
    <td align="center">
    <font color="#ffffff" size="2"><?php echo "$playercount"; ?> von <?php echo "$maxplayers"; ?> Online </font>
    </td>
    </tr>
    </table>
    <script>function load() {window.self.location="status.php"}</script><script>JSCTimeOutID = window.setTimeout('load()',4000)</script>


    <html>
    <head>
    <title>blabla interface</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <STYLE type=text/css>BODY {
    background-image: url(hintergrund.bmp);
    }
    </STYLE>
    </head>


    hm ...... :)

  • hä???? hast du das script selbst geschrieben???

    wenn nicht, das
    <script>function load() {window.self.location="status.php"}</script><script>JSCTimeOutID = window.setTimeout('load()',4000)</script>

    führt den Refresh herbei.

  • und so hat das script sicherlich übels die Performance probleme oder ?!?!

    Denn ich habe soetwas auch schon für BF und BFV geschriebne, bloß das diese Scripte etwas umfangreicher wahren