[PHP] KOSP Website Player Online Script
I am not sure if anybody released it before but here youcan get my php script. It is running with KOSP, meaning you need to edit something in config.properties and install KOSP on your Mainserver.exe
Code:
<?php
function Send_KOSP_command($cmd)
{
$host = "127.0.0.1";
$port = XXXXX;
$user = "YYYYY";
$pass = "ZZZZZ";
$fp = @fsockopen($host, $port);
if($fp)
{
// Send login
fwrite($fp,"login $user $pass\r");
// Set mode
fwrite($fp,"mode web\r");
// Send command
fwrite($fp, "$cmd\r");
while(!feof($fp))
$result .= fread ($fp, 1024);
fclose($fp);
return $result;
}
return NULL;
}
$Status = Send_KOSP_command("status");
if($Status)
{
$PlayerOnline = Send_KOSP_command("player_online");
echo "<div align=center><font color=#ffffff>Player Online : <color='red'>$PlayerOnline</font><br></div>";
}
?>
*Port in Config.properties
*Username in Config.properties
*Password in config.properties
Now enjoy.
Kind Regards NarutaruTR
Re: [PHP] KOSP Website Player Online Script
Re: [PHP] KOSP Website Player Online Script
it's the Example from KOSP or :P well, just a little modification and it's a realy helpfull script ;)
(in the Example is also GM status list)
Code:
PHP Status Server Example:
<?php
function Send_KOSP_command($cmd)
{
$host = "127.0.0.1";
$port = xxxxxx;
$user = "yyyyyy";
$pass = "zzzzzzzz";
$fp = @fsockopen($host, $port);
if($fp)
{
// Send login
fwrite($fp,"login $user $pass\r");
// Set mode
fwrite($fp,"mode web\r");
// Send command
fwrite($fp, "$cmd\r");
while(!feof($fp))
$result .= fread ($fp, 1024);
fclose($fp);
return $result;
}
return NULL;
}
$Status = Send_KOSP_command("status");
if($Status)
{
$PlayerOnline = Send_KOSP_command("player_online");
$GMOnline = Send_KOSP_command("gm_online");
$PlayerList = Send_KOSP_command("player_list");
$GMList = Send_KOSP_command("gm_list");
echo "Player Online: $PlayerOnline<br>";
echo "Player List: $PlayerList<br><br>";
echo "GM Online: $GMOnline<br>";
echo "GM List: $GMList";
}
else
{
echo "<font color=red>Offline</font>";
}
?>
Quote:
Originally Posted by
pangkan92
lol thats from one of the first versions of kosp.........
true
Re: [PHP] KOSP Website Player Online Script
lol thats from one of the first versions of kosp.........
Re: [PHP] KOSP Website Player Online Script
lol... i have one released, and you dont need KOSP installed... just PHP and MSSQL ^^.
Re: [PHP] KOSP Website Player Online Script
y dont release it us here then or can u give me a link for it if it already has been released?
Re: [PHP] KOSP Website Player Online Script
Is there a list anywhere of more kosp commands?
Re: [PHP] KOSP Website Player Online Script
i think released before but thanks anyway :D