Hi people:
My (our) first share:
This weird php only show the number of players ingame, and maybe some people think that is an stupid idea...but I am not good making geodata so I share this :P
It is based, on a well formed SQL process that refresh the message. So if someone want the SQL part please PM. I suppose you can do it yourselves.
On other way, I know is less efficient that it would be....but I have two jobs, a wife and an incoming son (just only 30 days more!!!), and again, I am not very good on making geodata (our first goal on the server) so maybe this weekend I optimize it, and post it later.
Code:
<meta http-equiv="refresh" content="60">
<?php
$ip = "localhost";
$port = "2009";
$conn = mssql_connect ("127.0.0.1", "user", "pass");
$db = mssql_select_db ("lin2world");
$sql = "select announce_msg from login_announce where announce_id=3";
$result = mssql_query ($sql, $conn);
if (mssql_fetch_row($result))
{
$com="50;1;3;".mssql_result($result, 0,0);
}
$mess = "Status:";
$fp = fsockopen($ip, $port, $errno, $errstr);
if (!$fp)
{
$mess .= "Error: <font color=red>$errstr ($errno)</font>";
}
else
{
$out = str_replace(";", "\t", $com)."\r\n";
fwrite($fp, $out);
stream_set_timeout($fp, 2);
$answ = fgets($fp, 8);
if ($answ == 1 and strlen($answ) == 1)
{
$mess .= "<font color=yellow>Respuesta de CacheD: {$answ}</font>";
}
else
{
$mess .= "<font color=red>Error. Respuesta de CacheD: {$answ}</font>";
}
fclose($fp);
}
echo $mess;
?>
Ok, so that's all folks!
P.D.:Yes, I know my english sounds very spanish (and is not good), but I am from Spain.