1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| <?php
//Adresse IP de votre server ragnarok
$ip='88.191.37.92';
//Port du Login-server
$lport=6900;
//Port du Char-server
$cport=6121;
//Port du Map-server
$mport=5121;
//Login
$account='Status';
//Pass
$passwd='server_img';
//Timeout
$timeout=2;
//Debug mode (1 pour oui, 0 pour non)
$debug=0;
function status_check($ip,$port,$timeout) {
//Verification du Status du Serveur
$up = @fsockopen($ip,$port,$errno,$errstr,$timeout);
if($up) {
return "ONLINE";
}
else {
return "OFFLINE";
}
@fclose($up);
}
//Original fonction by [Devil] for AthenaAdvanced
//Edited by LebrEf for status script
function usronline($ip,$port,$account,$passwd,$timeout,$debug) {
if (!($fp = @fsockopen($ip,$port,$errno,$errstr,$timeout)))
{
if ($debug==1) die( "Erreur 1");
else return "0";
}
else {
$in = pack("vVa24a24C",0x0064,9,$account,$passwd,3);
fputs($fp, $in, strlen($in));
fflush($fp);
$assoc_array = unpack("vint", fread($fp,2));
if ( $assoc_array['int'] != 0x0069){
if ($debug==1) die( "Erreur 2");
else return "0";
}
$assoc_array = unpack("vint",fread($fp,2));
$plen = ($assoc_array['int'] -= 4);
fread($fp,43);
$plen-=43;
for (; $plen>0; $plen-=32){
$assoc_array = unpack("x6/a20char/Vint",fread($fp,32));
$name = $assoc_array['char'];
//$name=substr($name,0,strpos($name,"\0")); // uncomment that line if you have more than one char server.
$count = "".$assoc_array['int']."";
return $count;
}
}
}
if($_GET['type'] == "login") {
$lol = 'Login Server : '.status_check($ip,$lport,$timeout);
echo $lol;
}
if($_GET['type'] == "char") {
$lol = 'Char Server : '.status_check($ip,$cport,$timeout);
echo $lol;
}
if($_GET['type'] == "map") {
$lol = 'Map Server : '.status_check($ip,$mport,$timeout);
echo $lol;
}
if($_GET['type'] == "ppl") {
$lol = 'Joueurs : '.usronline($ip,$lport,$account,$passwd,$timeout,$debug);
echo $lol;
} if($_GET['type'] == "max") {
if ($maxjoueur<.usronline($ip,$lport,$account,$passwd,$timeout,$debug)) { $maxjoueur=.usronline($ip,$lport,$account,$passwd,$timeout,$debug) }
$lol = 'Pax Joueurs Connecté : '$maxjoueur;
echo $lol;
}
?> |
Partager