All pastes #804661 Raw Edit

Status Checker

public php v1 · immutable
·published 2007-12-03 17:37 UTC
rendered paste body
 <?php/* K PHP Side now, stop ripping design ;D */function checkServerStatus($Id, $XmlFile = 'ServCheck.xml'){    $xml = simplexml_load_file($XmlFile);    $Data = array($xml->Server[ $Id ]->ip,$xml->Server[ $Id ]->port,$xml->Server[ $Id ]->last);    $Date = date('z:H:i');    if (strpos($Data[2],$Date) === false) {        $fp = @fsockopen($Data[0], (int) $Data[1], $errno, $errstr, 1);        if (!$fp)        {            $xml->Server[ $Id ]->pic = 'offline.png';            $xml->Server[ $Id ]->status = 0;            $xml->Server[ $Id ]->last = $Date;        } else {            $xml->Server[ $Id ]->pic = 'online.png';            $xml->Server[ $Id ]->status = 1;            $xml->Server[ $Id ]->last = $Date;        }        $NewXml = $xml->asXML();        file_put_contents($XmlFile,$NewXml);        @fclose($fp);    }            }function GetStatus($Id, $XmlFile = 'ServCheck.xml'){    checkServerStatus($Id);    $xml = simplexml_load_file($XmlFile);    return '<img src="'.$xml->Server[ $Id ]->pic.'" alt="" />';}function Counting($XmlFile = 'ServCheck.xml'){    $xml = simplexml_load_file($XmlFile);    $xml->Counter = $xml->Counter++;    for ($i = 1;$i <= strlen($xml->Counter); $i++)    {        echo '<img src="nums/'.substr($xml->Counter,$i,1).'.png" alt="" />';    }    $NewXML = $xml->asXML();    file_put_contents($XmlFile,$NewXML);}      ?><html><head><meta http-equiv="refresh" content="123"> <title>Arua Rose Server Status</title><style type="text/css">    <!--        body{            color: black;            font-family: Tahoma;            font-size: 8px;            font-weight: bold;        }        table.tableform{            color: #1c2f4f;            width : 500px;            margin-top:100px;            font-size:10pt;            border: 2px solid #1c2f4f;                    }            td.header{            color: white;            background-color: #1c2f4f;            font-size: 20px;            padding: 10px;        }        a{            color: black;            text-decoration:none;        }    -->    </style></head><body style='font-family:Tahoma';font-size=10px;'><center><table class=tableform border=0 cellpadding=0 cellspacing=0>    <tr>        <td class=header colspan =3>Arua Rose Status Checker</td>    </tr>    </tr>        <td width=300px rowspan=8 style="background-color:white;padding:10px;"><img src="arualogo.png"></td>                <td width=30px style="padding-top:10px"><?php echo GetStatus(1); ?></td>                <td width=180 style="padding-top:10px">Login Server</td>        </tr>    <tr>        <td><?php echo GetStatus(2); ?></td>        <td>Character Select : <b>Destiny</b></td>    </tr>    <tr>        <td><?php echo GetStatus(3); ?></td>        <td>Character Select : <b>Hebarn</b></td>    </tr>        <tr>        <td><?php echo GetStatus(4); ?></td>        <td>World 1 : <b>Destiny</b></td>    </tr>        <tr>        <td><?php echo GetStatus(5); ?></td>        <td>World 2 : <b>Hebarn</b></td>    </tr>        <tr>        <td>&nbsp</td>        <td>&nbsp;</td>    </tr>    <tr>        <td><?php echo GetStatus(0); ?></td>        <td><a href='http://www.AruaROSE.com'><b>www.AruaROSE.com</b></a></td>    </tr>    <tr>        <td><img src="click.png" alt="" /></td>        <td><div align="center"><?php Counting(); ?></div></td>    </tr>    <tr>        <td>&nbsp</td>        <td>&nbsp;</td>    </tr>    <tr>        <td style="padding-left:20px;color:gray;"><b><font size=1>Last update: <font style='color:green'><?php echo date("s"); ?></font> seconds ago. </font></b></td>        <td>&nbsp;</td>        <td colspan=1 style="color:gray;"><font size=1>Script re-written by Xn</font></td>    </tr><tr></tr></table></center></body></html>