View Full Version : Website Server Status
YankeeDeuce
12-16-2004, 23:23
I forgot about this. I got it working - here is the code. Check http://www.wdgamers.com/server.php to see what it looks like. I also have another version that works that you can see here http://www.forgottenones.net/index.php?p=serverstatus&s=css&e=php&id=67.18.100.60:27015
<?php
function fragsort ($a, $b) {
if ($a["frags"] == $b["frags"]) return 0;
if ($a["frags"] > $b["frags"]) {
return -1;
} else {
return 1;
}
}
Class CounterStrike {
var $m_playerinfo =""; // Info about players
var $m_servervars =""; // Info about the server current map, players etc
var $m_serverrules =""; // Serverrules
//
// Get exact time, used for timeout counting
//
function timenow() {
return doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()));
}
//
// Read raw data from server
//
function getServerData($command,$serveraddress,$portnu mber,$waittime) {
$serverdata ="";
$serverdatalen=0;
if ($waittime< 500) $waittime= 500;
if ($waittime>2000) $waittime=2000;
$waittime=doubleval($waittime/1000.0);
if (!$cssocket=fsockopen("udp://".$serveraddress,$portnumber,$errnr)) {
$this->errmsg="No connection";
return "";
}
socket_set_blocking($cssocket,true);
@socket_set_timeout($cssocket,0,500000);
fwrite($cssocket,$command,strlen($command));
// Mark
$starttime=$this->timenow();
do {
$serverdata.=fgetc($cssocket);
$serverdatalen++;
$socketstatus=socket_get_status($cssocket);
if ($this->timenow()>($starttime+$waittime)) {
$this->errmsg="Connection timed out";
fclose($cssocket);
return "";
}
} while ($socketstatus["unread_bytes"] );
fclose($cssocket);
return $serverdata;
}
function getnextstring(&$data) {
$temp="";
$counter=0;
while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
$data=substr($data,strlen($temp)+1);
return $temp;
}
function getnextbytevalue(&$data) {
$temp=ord($data[0]);
$data=substr($data,1);
return $temp;
}
function getnextfragvalue(&$data) {
$frags=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
if ($frags>=4294967294) $frags-=4294967296;
$data=substr($data,4);
return $frags;
}
function getnextplaytime(&$data) {
$decnumber=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
$binnumber=base_convert($decnumber,10,2);
while (strlen($binnumber) < 32) $binnumber="0".$binnumber;
$exp=abs(base_convert(substr($binnumber,1,8), 2,10))-127;
if (substr($binnumber,0,1)=="1") $exp=0-$exp;
$man=1;$manadd=0.5;
for ($counter=9;$counter<32;$counter++) {
if (substr($binnumber,$counter,1)=="1") $man+=$manadd;
$manadd=$manadd/2;
}
$time=round(pow(2,$exp)*$man);
$playtime="";
if ($time>3600) {
$playtime=sprintf("%02d:",$time/3600); //heures
}
$time%=3600;
$playtime=$playtime.sprintf("%02d:",$time/60); //minutes
$time%=60;
$playtime=$playtime.sprintf("%02d",$time); //secondes
$data=substr($data,5);
if(strlen($playtime)==5) $playtime="00:".$playtime;
if(strlen($playtime)==2) $playtime="00:00:".$playtime;
return $playtime;
}
// ********************************************* *************************
// getServerRules
// Read rules/setup from the gameserver into m_serverrules
// Return true if successful
// ********************************************* *************************
function getServerRules($serveraddress,$portnumber,$wa ittime) {
$cmd="\xFF\xFF\xFF\xFF\x56";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime) ;
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Figure out how many rules there are
$rules=(ord($serverdata[5]))+(ord($serverdata [6])*256);
if ($rules!=0) {
// Strip OOB data
$serverdata=substr($serverdata,7);
for ($i=1;$i<=$rules;$i++) {
$rulename =$this->getnextstring($serverdata);
$rulevalue =$this->getnextstring($serverdata);
$this->m_serverrules[$rulename]=$rulevalue;
}
return true;
} else {
return false;
}
}
// ********************************************* *************************
// getServerinfo
// Read information about the gameserver into m_servervars
// Serveraddress,servername,current map etc etc
// Return true if successful
// ********************************************* *************************
function getServerInfo($serveraddress,$portnumber,$wai ttime) {
$cmd="\xFF\xFF\xFF\xFF\x54";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime) ;
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Strip OOB data
$serverdata=substr($serverdata,5);
$this->m_servervars["servername"] =$this->getnextstring($serverdata);
$this->m_servervars["mapname"] =$this->getnextstring($serverdata);
$this->m_servervars["mapname1"] =$this->getnextstring($serverdata);
$this->m_servervars["game"] =$this->getnextstring($serverdata);
$this->m_servervars["currentplayers1"] =$this->getnextstring($serverdata);
$this->m_servervars["currentplayers2"] =$this->getnextbytevalue($serverdata);
$this->m_servervars["currentplayers"] =$this->getnextbytevalue($serverdata);
return true;
}
// ********************************************* *************************
// Get Playerinfo
// Read information about the players into m_playerinfo
// Name,frags,playtime
// Return true if successful
// ********************************************* *************************
function getServerPlayers($serveraddress,$portnumber,$ waittime) {
// Servercommand
$cmd="\xFF\xFF\xFF\xFF\x55";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime);
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Check number of players to read data for
$players=ord($serverdata[5]);
// Strip OOB data and other stuff
$serverdata=substr($serverdata,7);
for ($i=1;$i<=$players;$i++) {
$playername =htmlspecialchars($this->getnextstring($serverdata));
$frags =$this->getnextfragvalue($serverdata);
$playtime =$this->getnextplaytime($serverdata);
$this->m_playerinfo[$i] =array("name"=>$playername,"frags"=>$frags,"time"=>$playtime);
}
// Sort players in fragorder
if ($players>1) usort($this->m_playerinfo,"fragsort");
return true;
}
}
$ip = "64.156.56.83";
$port= "27015";
if(!$HTTP_POST_VARS["serveradr"] AND !$HTTP_POST_VARS["serverport"]){
$serveradr = $ip;
$serverport= $port;
}
else {
$serveradr = str_replace(".","",$HTTP_POST_VARS["serveradr"]);
if(is_numeric($serveradr) AND is_numeric($HTTP_POST_VARS["serverport"])){
$serveradr = trim($HTTP_POST_VARS["serveradr"]);
$serverport= trim($HTTP_POST_VARS["serverport"]);
}
else {
$serveradr = $ip;
$serverport= $port;
}
}
$csinfo = new CounterStrike;
$status = $csinfo->getServerInfo($serveradr,$serverport,1000);
if ($status) {
$status = $csinfo->getServerPlayers($serveradr,$serverport,1000) ;
$status = $csinfo->getServerRules($serveradr,$serverport,1000);
$rules = $csinfo->m_serverrules;
?>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="tblg">
<TR>
<TD COLSPAN="3"><DIV CLASS="titreblocg">Live Server View</DIV></TD>
</TR>
<TR>
<TD CLASS="map">Map in progress</TD>
<TD ROWSPAN="4">images/gfx_sep.jpg</TD>
<TD CLASS="data">Server Info</TD>
</TR>
<TR>
<TD ALIGN="center" ROWSPAN="3">images/mappics/<?php if (@filesize(m_servervars["mapname"].".jpg")!="") echo $csinfo->m_servervars["mapname"]; else echo "nomap"; ?>.jpg" BORDER="0" WIDTH="160" HEIGHT="120" ALT="<?php echo $csinfo->m_servervars["mapname"]?>" TITLE="<?php echo $csinfo->m_servervars["mapname"]?>"></TD>
<TD><U>IP</U>: <?php echo $serveradr ?> <U>Port</U>: <?php echo $serverport ?>
<U>Players</U>: <?php echo $csinfo->m_servervars["currentplayers"]?>
<U>Map in progress</U>: <?php echo $csinfo->m_servervars["mapname"]?>
<U>Friendly Fire</U>: <?php if($rules["mp_friendlyfire"]==0) echo "Off"; else echo "On"; ?>
<U>Server access</U>: <?php if($rules["sv_password"]==0) echo "Public"; else echo "Private"; ?>
<SELECT NAME="server_rules">
<OPTION VALUE="Configuration du serveur">Server configuration</OPTION>
<?php
reset ($rules);
ksort ($rules);
while (list($name,$value) = each ($rules)) {
?>
<OPTION VALUE="<?php echo $name ?>"><?php echo $name." = ".$value ?></OPTION>
<?php
}
?>
</SELECT></TD>
</TR>
<TR>
<TD CLASS="data">Monitor an other server</TD>
</TR>
<TR>
<TD><FORM ACTION="" METHOD="post"><INPUT TYPE="text" NAME="serveradr" SIZE="14" MAXLENGTH="40" VALUE=" Enter the IP and"> <INPUT TYPE="text" NAME="serverport" SIZE="6" MAXLENGTH="40" VALUE=" the port"> <INPUT TYPE="submit" VALUE="Go !"></FORM></TD>
</TR>
</TABLE>
<DIV CLASS="titreblocg">Players online</DIV>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="tblg">
<?php
if (is_array($csinfo->m_playerinfo)) {
?>
<TR>
<TH>Name</TH>
<TH ALIGN="center">Frags</TH>
<TH ALIGN="center">Time</TH>
</TR>
<?php
while (list(,$player) = each ($csinfo->m_playerinfo)) {
?>
<TR>
<TD><?=$player["name"]?></TD>
<TD ALIGN="center"><?=$player["frags"]?></TD>
<TD ALIGN="center"><?=$player["time"]?></TD>
</TR>
<?php
}
}
else {
?>
<TR>
<TD ALIGN="center">
The server is empty
</TD>
</TR>
<?php
}
?>
</TABLE>
<?php
}
else {
echo "Communication error with the server\n";
}
?>
It's hard to see what's wrong with that script exactly,
but I've got a working one on another PC at home,
I'll send it to you when I get there...
Guess in a week I'll have my serverinfo script ready,
which I'll post here aswell.
Best regards,
Tim
My scripts's now mostly done, meaning it already does
everything it's supposed to do, but if I've got the time I'll
expand it some more with off-topic addons.
(the useless stuff most people won't even use that is...)
It needs PHP3+, MySQL + Database, udp:// Socket and
image streaming support to be able to fully function.
As for now it does in fact:
-Retrieve information from your server every 5 minutes (gather.php)
-Show the serverstatus from multiple servers on a webpage (index.php)
-Show a small recap all serverstati in a block for a mainpage (small.php)
-Let you add and remove servers from a admin-only-webpage (admin.php)
-Let you create a personal avatar telling others your playingdetails,
in which if there are no details a chosen picture is displayed (avatar.php)
-Stuff it does but I forgot for now... (enjoy)
The download link is available here:
http://www.un4given.nl/tim/serverstatus_sql.zip
[3 MB, mostly small pictures from maps]
A main page demonstration is available here:
http://www.un4given.nl/tim/index.php
A small recap demonstration is available here:
http://www.un4given.nl/tim/small.php
Two avatar demonstrations here:
http://www.un4given.nl/tim/avatar.htm
The addons I'll be working on allow you to add serverinfo
into your server's MOTD and letting you create a signature
banner telling forum users where you are currently playing.
I'll also be working on writing the serverinformation-recap on
the actual mappicture that's being played, which I found better.
The addons above could just be plugged in without changing
settings so those I'll post here seperately once they're done.
Feel free to download / alter / use / distribute these codes,
as well as to thank / praise / flame / curse me for making
this and posting it here.
Best regards,
Tim
imported_YoMama
12-22-2004, 03:44
If anyone's interested, I can post some code here to display live server status. Instead of the actual webpage doing the querying (which can be a burden if you have lots of visitors), I use a perl-script which will query the server once a minute (can be once every x seconds, depending on the amount of servers to be queried), and insert the results into a MySQL (or whatever flavor) table.
The webpages then pull that info directly from the database.
For an example see: http://games.xs4all.nl
Currently I'm just displaying simple info. But rules, players scores and filtering can easily be applied. The nice part is that it supports loads of different games, so it's easily extend to other servers should you host any (like I do).
This method will also become available as an addon for SourceMod by the way.
manorastroman
12-22-2004, 07:55
the only problem with your script is that it keeps repeating 11 out of 20 players in the players section, any fixes?
Instead of the actual webpage doing the querying, I use a perl-script which will query the server once a minute, and insert the results into a MySQL table.
The webpages then pull that info directly from the database. :? That's almost the same as my script pack is doing, only the information is retrieved once every 5 minutes (also adjustable), and only retrieved if it's actually requested, not every x minutes of a day (better fit for smaller server setups).
The nice part is that it supports loads of different games, so it's easily extend to other servers should you host any (like I do).My script should support all Half-Life 1 & Half-Life 2 mods out there, so I figured that would be enough for 90% of the people here...
This method will also become available as an addon for SourceMod by the way.Posted such a request in "Ideas/Suggestions" part some time ago, good to hear it's come through.
As soon as SourceMod supports these features my script will become obsolete.
(though I might write a different back-end to it to get the same output)
the only problem with your script is that it keeps repeating 11 out of 20 players in the players section, any fixes?That's only because there are... 11 out of 20 players on that particular server???
If I got you wrong please post a screenshot so I know what you're talking about...
Best regards,
Tim
imported_Ard Choille
01-04-2005, 12:38
Try this
<?php
function fragsort ($a, $b) {
if ($a["frags"] == $b["frags"]) return 0;
if ($a["frags"] > $b["frags"]) {
return -1;
} else {
return 1;
}
}
Class CounterStrike {
var $m_playerinfo =""; // Info about players
var $m_servervars =""; // Info about the server current map, players etc
var $m_serverrules =""; // Serverrules
//
// Get exact time, used for timeout counting
//
function timenow() {
return doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()));
}
//
// Read raw data from server
//
function getServerData($command,$serveraddress,$portnu mber,$waittime) {
$serverdata ="";
$serverdatalen=0;
if ($waittime< 500) $waittime= 500;
if ($waittime>2000) $waittime=2000;
$waittime=doubleval($waittime/1000.0);
if (!$cssocket=fsockopen("udp://".$serveraddress,$portnumber,$errnr)) {
$this->errmsg="No connection";
return "";
}
socket_set_blocking($cssocket,true);
@socket_set_timeout($cssocket,0,500000);
fwrite($cssocket,$command,strlen($command));
// Mark
$starttime=$this->timenow();
do {
$serverdata.=fgetc($cssocket);
$serverdatalen++;
$socketstatus=socket_get_status($cssocket);
if ($this->timenow()>($starttime+$waittime)) {
$this->errmsg="Connection timed out";
fclose($cssocket);
return "";
}
} while ($socketstatus["unread_bytes"] );
fclose($cssocket);
return $serverdata;
}
function getnextstring(&$data) {
$temp="";
$counter=0;
while (ord($data[$counter++])!=0) $temp.=$data[$counter-1];
$data=substr($data,strlen($temp)+1);
return $temp;
}
function getnextbytevalue(&$data) {
$temp=ord($data[0]);
$data=substr($data,1);
return $temp;
}
function getnextfragvalue(&$data) {
$frags=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
if ($frags>=4294967294) $frags-=4294967296;
$data=substr($data,4);
return $frags;
}
function getnextplaytime(&$data) {
$decnumber=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
$binnumber=base_convert($decnumber,10,2);
while (strlen($binnumber) < 32) $binnumber="0".$binnumber;
$exp=abs(base_convert(substr($binnumber,1,8), 2,10))-127;
if (substr($binnumber,0,1)=="1") $exp=0-$exp;
$man=1;$manadd=0.5;
for ($counter=9;$counter<32;$counter++) {
if (substr($binnumber,$counter,1)=="1") $man+=$manadd;
$manadd=$manadd/2;
}
$time=round(pow(2,$exp)*$man);
$playtime="";
if ($time>3600) {
$playtime=sprintf("%02d:",$time/3600); //heures
}
$time%=3600;
$playtime=$playtime.sprintf("%02d:",$time/60); //minutes
$time%=60;
$playtime=$playtime.sprintf("%02d",$time); //secondes
$data=substr($data,5);
if(strlen($playtime)==5) $playtime="00:".$playtime;
if(strlen($playtime)==2) $playtime="00:00:".$playtime;
return $playtime;
}
//********************************************* *************************
// getServerRules
// Read rules/setup from the gameserver into m_serverrules
// Return true if successful
//********************************************* *************************
function getServerRules($serveraddress,$portnumber,$wa ittime) {
$cmd="\xFF\xFF\xFF\xFFV";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime) ;
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Figure out how many rules there are
$rules=(ord($serverdata[5]))+(ord($serverdata [6])*256);
if ($rules!=0) {
// Strip OOB data
$serverdata=substr($serverdata,7);
for ($i=1;$i<=$rules;$i++) {
$rulename =$this->getnextstring($serverdata);
$rulevalue =$this->getnextstring($serverdata);
$this->m_serverrules[$rulename]=$rulevalue;
}
return true;
} else {
return false;
}
}
//********************************************* *************************
// getServerinfo
// Read information about the gameserver into m_servervars
// Serveraddress,servername,current map etc etc
// Return true if successful
//********************************************* *************************
function getServerInfo($serveraddress,$portnumber,$wai ttime) {
$cmd="\xFF\xFF\xFF\xFFT";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime) ;
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Strip OOB data
$serverdata=substr($serverdata,5);
$this->m_servervars["servername"] =$this->getnextstring($serverdata);
$this->m_servervars["mapname"] =$this->getnextstring($serverdata);
$this->m_servervars["game"] =$this->getnextstring($serverdata);
$this->m_servervars["gamename"] =$this->getnextstring($serverdata);
$this->m_servervars["currentplayers"] =$this->getnextbytevalue($serverdata);
$this->m_servervars["maxplayers"] =$this->getnextbytevalue($serverdata);
return true;
}
//********************************************* *************************
// Get Playerinfo
// Read information about the players into m_playerinfo
// Name,frags,playtime
// Return true if successful
//********************************************* *************************
function getServerPlayers($serveraddress,$portnumber,$ waittime) {
// Servercommand
$cmd="\xFF\xFF\xFF\xFFU";
$serverdata=$this->getServerData($cmd,$serveraddress,$portnumber ,$waittime);
// Check length of returned data, if < 5 something went wrong
if (strlen($serverdata)<5) return false;
// Check number of players to read data for
$players=ord($serverdata[5]);
// Strip OOB data and other stuff
$serverdata=substr($serverdata,7);
for ($i=1;$i<=$players;$i++) {
$playername =htmlspecialchars($this->getnextstring($serverdata));
$frags =$this->getnextfragvalue($serverdata);
$playtime =$this->getnextplaytime($serverdata);
$this->m_playerinfo[$i] =array("name"=>$playername,"frags"=>$frags,"time"=>$playtime);
}
// Sort players in fragorder
if ($players>1) usort($this->m_playerinfo,"fragsort");
return true;
}
}
$ip = "64.156.56.83";
$port= "27015";
if(!$HTTP_POST_VARS["serveradr"] AND !$HTTP_POST_VARS["serverport"]){
$serveradr = $ip;
$serverport= $port;
}
else {
$serveradr = str_replace(".","",$HTTP_POST_VARS["serveradr"]);
if(is_numeric($serveradr) AND is_numeric($HTTP_POST_VARS["serverport"])){
$serveradr = trim($HTTP_POST_VARS["serveradr"]);
$serverport= trim($HTTP_POST_VARS["serverport"]);
}
else {
$serveradr = $ip;
$serverport= $port;
}
}
$csinfo = new CounterStrike;
$status = $csinfo->getServerInfo($serveradr,$serverport,1000);
if ($status) {
$status = $csinfo->getServerPlayers($serveradr,$serverport,1000) ;
$status = $csinfo->getServerRules($serveradr,$serverport,1000);
$rules = $csinfo->m_serverrules;
?>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="tblg">
<TR>
<TD COLSPAN="3" CLASS="serveur">images/sub.gif <?php echo $csinfo->m_servervars["servername"] ?></TD>
</TR>
<TR>
<TD CLASS="map">Map in progress</TD>
<TD ROWSPAN="4">images/gfx_sep.jpg</TD>
<TD CLASS="data">Server Info</TD>
</TR>
<TR>
<TD ALIGN="center" ROWSPAN="3">images/mappics/<?php if (@filesize(m_servervars["mapname"].".jpg")!="") echo $csinfo->m_servervars["mapname"]; else echo "nomap"; ?>.jpg" BORDER="0" WIDTH="160" HEIGHT="120" ALT="<?php echo $csinfo->m_servervars["mapname"]?>" TITLE="<?php echo $csinfo->m_servervars["mapname"]?>"></TD>
<TD><U>IP</U>: <?php echo $serveradr ?> <U>Port</U>: <?php echo $serverport ?>
<U>Players</U>: <?php echo $csinfo->m_servervars["currentplayers"] ?> on <?php echo $csinfo->m_servervars["maxplayers"]?>
<U>Map in progress</U>: <?php echo $csinfo->m_servervars["mapname"]?>
<U>Friendly Fire</U>: <?php if($rules["mp_friendlyfire"]==0) echo "Off"; else echo "On"; ?>
<U>Server access</U>: <?php if($rules["sv_password"]==0) echo "Public"; else echo "Private"; ?>
<SELECT NAME="server_rules">
<OPTION VALUE="Configuration du serveur">Server configuration</OPTION>
<?php
reset ($rules);
ksort ($rules);
while (list($name,$value) = each ($rules)) {
?>
<OPTION VALUE="<?php echo $name ?>"><?php echo $name." = ".$value ?></OPTION>
<?php
}
?>
</SELECT></TD>
</TR>
<TR>
<TD CLASS="data">Monitor an other server</TD>
</TR>
<TR>
<TD><FORM ACTION="" METHOD="post"><INPUT TYPE="text" NAME="serveradr" SIZE="14" MAXLENGTH="40" VALUE=" Enter the IP and"> <INPUT TYPE="text" NAME="serverport" SIZE="6" MAXLENGTH="40" VALUE=" the port"> <INPUT TYPE="submit" VALUE="Go !"></FORM></TD>
</TR>
</TABLE>
<DIV CLASS="titreblocg">Players online</DIV>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="tblg">
<?php
if (is_array($csinfo->m_playerinfo)) {
?>
<TR>
<TH>Name</TH>
<TH ALIGN="center">Frags</TH>
<TH ALIGN="center">Time</TH>
</TR>
<?php
while (list(,$player) = each ($csinfo->m_playerinfo)) {
?>
<TR>
<TD><?=$player["name"]?></TD>
<TD ALIGN="center"><?=$player["frags"]?></TD>
<TD ALIGN="center"><?=$player["time"]?></TD>
</TR>
<?php
}
}
else {
?>
<TR>
<TD ALIGN="center">
The server is empty
</TD>
</TR>
<?php
}
?>
</TABLE>
<?php
}
else {
echo "Communication error with the server\n";
}
DopeFish
01-04-2005, 14:32
Two avatar demonstrations here:
http://www.un4given.nl/tim/avatar.htm
ahh thanks, you just reminded me to do dynmic images for signatures. i almost forgot that ;)
Two avatar demonstrations here:
http://www.un4given.nl/tim/avatar.htm
ahh thanks, you just reminded me to do dynmic images for signatures. i almost forgot that ;)Doing that myself as we speak, only problem is that I can't find any decent .gdf fonts to work with my PHP...
So untill I find a not too bad one I think I'll hold off using it...
manorastroman
01-04-2005, 16:33
heres a SS of the bug i was talking about, i think its showing way too many dynamic images or something, it just goes crazy on it
http://img33.exs.cx/img33/9809/bug3ax.jpg
DopeFish
01-04-2005, 16:57
the only gdf fonts I could find were theese http://www.widgnet.com/gdf_fonts/fonts.html
but they are't all to great (and most of them too lage for signature images).
using imagettftext() (http://de2.php.net/manual/de/function.imagettftext.php) might by an alternative.
manorastroman
01-04-2005, 17:04
dopefish, do you think you can make me a sig like that for my server?
@ DopeFish:
Thanks a LOT! Knew there had to be something like that,
couldn't find it though (Idiot me)
@Man or Astroman?:
Working on that right now, to be release along with my scriptpack.
Preview (needs some brushing up, technically ok...):
http://www.un4given.nl
Should display playing details, if not it's the same working steam gif
as in my signature...
The bug you mentioned is because there should be 20+ pictures interleaving
using CSS style sheets, which apperently Mozilla FireFox doesn't handle well...
Grey (http://www.un4given.nl/tim/pics/grey.gif) for offline, Green (http://www.un4given.nl/tim/pics/green.gif) for online.
Best regards,
Tim
Ok anyone got any pointers for me how I actually call my PHP script
that generates a picture from a .jpg / .gif / .png file??
Having quite the deadlock here... :(
Freecode
01-04-2005, 19:38
u need to change MIME type on ur hosting server.
Edit: AGA Thanks a lot, Going to give that a try now...
Edit2: I came, I tried, I failed miserably...
Doesn't seem to be working for me or my webserver...
Cpoied the .htaccess from the PHP manual, but that gets
me an internal server error...Action php-script /cgi-bin/php
AddHandler php-script .gif
Changed a simple PHP script into an gif, hoping it
would execute, but it just wouldn't work. :cry:
Is there any way I can have an empty .gif / .png / .jpg
link towards one of mij PHP scripts?
Or does anyone know what I'm doing wrong??
As a last resort, how have others managed to fix this?
Might be inspiring seeing a working version somewhere...
Tim
You define MIME-types in .htaccess. See this (http://www.wats.ca/resources/.htaccessandmimetypes/32) for reference.
DopeFish
01-05-2005, 05:43
there is a tutorial for creating .gif/.jpg/.png images with php (with apache .htaccess configuration)
http://www.phpmix.com/index.php?page=213&t=328
But remember your webhoster can also restrict which directives can be used in a .htaccess, so if everything fails, it might not be your fault.
For my sig images I went a different approach since I pass part of the filename requested as a variable to the script
RewriteEngine on
RewriteRule ^/serverstats/server_([0-9]{1,5})_.jpg$ http://si-ka.net/serverstats/serversig.php?id=$1 [P]
the image requested is called server_xy_.jpg, where xy is the numerical id of the server you want stats of.
@Man... or Astroman?
You can either
- follow the tutorial above and make your own (after you have written one (http://dopefish.de/projects/server/phpimg.html) or two (http://wc3.dopefish.de/wc3sig_STEAM_0:1:547895_.jpg) php image scripts you get the hang of it and it becomes really easy)
- or wait for Tim to finish his scriptpack (which will be more flexible for you since you can then adjust it to your needs without having to write it from scratch)
- or if you are lazy you can just add your server to my serverstats (http://si-ka.net/serverstats/) monitor and use the sig images it creates.
Thanks a lot, tutorail really got me through it,
now just to adjust my script to work with it...
So far: :D
http://www.un4given.nl/tim/test.png
manorastroman
01-05-2005, 17:39
ill take the lazy option, thanks man, works excellent
@DopeFish:
Trying to dot he same trich as you did, hiding the argument in the URL, but it simply won't work... =\
By now I've tried everything (been at it couple of hours now), but I can't seem to make any .htaccess
like you showed in this codesnippet RewriteEngine on
RewriteRule ^/serverstats/server_([0-9]{1,5})_.jpg$ http://si-ka.net/serverstats/serversig.php?id=$1 [P]The working .htacces I'm using is this one, but it won't allow argument passing( obviously):<FilesMatch "^.*\.png">
SetHandler application/x-httpd-php
</FilesMatch>Am I missing anything significant?? Could you please post/pm/mail the entire .htaccess you're using,
or explain to me how my .htaccess should be build if I want to pass an argument consisting from an
unspecified amount of charaters??? (".*" I believe, googled the whole web for it...)
Best regards,
Tim
DopeFish
01-06-2005, 07:25
@DopeFish:
Trying to dot he same trich as you did, hiding the argument in the URL, but it simply won't work... =\
By now I've tried everything (been at it couple of hours now), but I can't seem to make any .htaccess
like you showed in this codesnippet RewriteEngine on
RewriteRule ^/serverstats/server_([0-9]{1,5})_.jpg$ http://si-ka.net/serverstats/serversig.php?id=$1 [P]The working .htacces I'm using is this one, but it won't allow argument passing( obviously):<FilesMatch "^.*\.png">
SetHandler application/x-httpd-php
</FilesMatch>Am I missing anything significant?? Could you please post/pm/mail the entire .htaccess you're using,
or explain to me how my .htaccess should be build if I want to pass an argument consisting from an
unspecified amount of charaters??? (".*" I believe, googled the whole web for it...)
Best regards,
Tim
Hmm, I should have mentioned that I stuck the directives in my httpd.conf because I already had some other rewrite rules there. Althougthey should work in .htaccess I haven't testet it there yet, sorry about that.
google for "Regular Expressions" or "regex", they can be pretty complicated or confusing, but powerful.
"." means "any character", and "*" means "zero or more times", you may want to use + instead of * ("+" means "one or more times")
Jimmy951
01-07-2005, 12:26
Tim...
How do you get this to work?
It creates the TIM_SETTINGS table, but nothing is being put into the table.
I keep getting a Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
You got an idea on how I can fix this?
Thx
Are you sure you've got your settings.php set up correctly??
should be at least 1 mentioning of a line like:
AddStandardServer("T4F 1.6","194.171.252.96","27015","hl1");
in there for things to work... (If I remember correctly)
That's the nly thig I can come up with in the codes, otherwise
your server might be outdated (unlikely, error points to function).
If all else fails, a fresh install perhaps?
Or supply me with the settings you'd like, I'll send you a custom
zip with all your data in it...
(mail would be best, since the script pack needs passwords)
Best regards,
Tim
PS: Just finished building this, as a temporary alternative:
http://www.un4given.nl/tim/serverstatus_java/index.php?server_ip=194.171.252.96&server_port=27015
(requires both me + some unknown to maintain the scripts)
Jimmy951
01-07-2005, 17:27
Yes all those are set correct.
It seems to be something with the database.
The TIM_SETTINGS table is created, the 12 fields are there, just no info is being put into them...
ex...ip, port, name....ect.
The script is calling for these, but they are not there?
The error is from fnc_index.php on line 40.
O well, just thought maybe you had an idea. I would really like to use this, it's just what I've been looking for but if you don't know I'll just mess with it some more.
Thanks
Like I said, I found line 40 you were talking about,
no problems on my own server with them...
Give me some details off the settings you'd like to
work with, I'll test & zip those for you...
It's hard to make a clear judgement without all the
acces / files / settings.
Best regards,
Tim
Small updates & fixes:
PHP & UDP & SQL version
-DL: http://www.un4given.nl/tim/serverstatus_sql.zip
-Demo: http://www.un4given.nl/tim/serverstatus_sql/
PHP & Java version (remote applet not included)
-DL: http://www.un4given.nl/tim/serverstatus_java.zip
-Demo: http://www.un4given.nl/tim/serverstatus_java/index.php?server_ip=194.171.252.96&server_port=27015
(Can be any IP or Port you specify)
Important note:
Mappics are now a loose download, available here:
http://www.un4given.nl/tim/mappics.zip
Best regards,
Tim
originalbob
01-09-2005, 23:46
Go try this out:
http://phpclasses.promoxy.com/browse/package/1815.html
It doesn't require MySQL. Just PHP.
I used it for my sig, and it has a great default index.php for querying any server.
DopeFish
01-10-2005, 03:51
I know that servers pratically get bombarded with query request as it is already. but having a dynamic sig that querys the server every time it is loaded by anybody viewing a thread you posted in really can push thoose queries to absurd amounts depending on how much you post and on how many forums you use the sig.
DopeFish is absolutely right!
Had that myself a while ago, turned out that every request
literally burried the server with the commands "status", "stats"
and "player XXXX" (20x).
It really doesn't get well appreciated by any server admin out
there, so I'd suggest taking a different approach.
For instance like I did: Requests only once every 5 minutes,
and store the information you got into a MySQL database.
This greatly improves the response time, and makes a lot less
requests to your game-server.
So to sum it up: I started out with the same type of script, but
added the SQL because it's less harsh on the game-server.
Best regards,
Tim
Edit: Firefox support here
http://www.un4given.nl/tim/serverstatus_sql.zip
shadowphreak
01-12-2005, 01:50
Tim: I'm trying your script pack on my web server, and it seems to only work with the default port. My cs: source server runs on 27014 and it keeps saying it's down, but I can see it in the steam server browser no problem. I'm gonna take a look at gather.php, as I assume that's where the problem would be (if indeed it is a problem with your scripts). Just thought you might want to know, and maybe see if you knew what was going wrong.
--quick edit to add that it does seem to work with any server running on 27015--
Got any links?
Both to your webserver & game-server...
I'll try to see what's wrong with it, shouldn't
be a problem to use that game port...
when done can you guys edit the orig post for a download. i want this VERY badly
YankeeDeuce
01-12-2005, 23:44
I had forgotten about this after I got it working. I edited the original post to the working code and the site example, also added another site for another PHP query script I had. If you want the code for the second one let me know.
shadowphreak
01-13-2005, 01:10
Tim: I tried it on your demo and it worked fine.. I can't see what would keep it from working for me.
webserver: http://cob.flawlessgaming.com/status
game server: 66.36.242.246:27014
I left the admin password set to default so you can work with it and try to see what's wrong. The only file I've modified is settings.php, and only the database settings. It seems to work for other servers that I add, so I'm a bit confused. Best of luck...
--Shadowphreak--
BTW, I know my way around PHP and MySql, so you can get technical with me :wink:
shadowphreak
01-13-2005, 01:26
Another thing I thought I'd mention. If you want to get rid of that mysql_fetch_array error on line 39 in fnc_index, just check if the result set is empty before starting the while loop. You can then display a message to the effect of "No servers in database. Use admin page to add servers"
Good thinking, I'll work it in as soon as I finish my last exam this afternoon...
As for your script: It's now working with my server, as with yours...
http://www.cob.flawlessgaming.com/status/index.php?server=2&sort=frags&order=2
Use admin.php to add/edit some servers, think I'll put mine as a default one for
versions to come, as many haven't found tehir way into using admin.php yet...
Greets,
Tim
shadowphreak
01-13-2005, 21:34
Umm, I hate to point it out, but that's not my server... My server is running on port 27014 at the same IP. That is another server hosted by my hosting company. I can't understand why it won't work with my server, and only on my web site. It's almost as if my web server won't allow outgoing connections to that port. I'll continue to experiment, maybe try running the script from a different server. I'll also talk to my hosting company to see if there is anything blocking the connection on the web server.
It works here:
http://www.un4given.nl/tim/serverstatus_java/index.php?server_ip=66.36.242.246&server_port=27014
I'm just getting into a big load of upgrades & fixes,
trying to reorganise the data in my script to fit a
common scheme, so updates within a couple of days...
Follow the above link (maybe put it in an Iframe)
untill I've sorted everything out here.
Best regards, Tim
All the above links etc. seam to be working nicely, only problem is i use asp!? Gonna try n convert it over but some of the stuff looks entirely unfamiliar to me, has anyone sean a working asp version?
Sorry, no ASP knowledge here...
If you're able to hook ASP up with this XML output:
http://www.un4given.nl/tim/serverstatus/xmlbuild.php?serverName=194.171.252.96&serverPort=27015
It should be fairly easy done getting an ASP cover...
(Though I still think your better of with PHP...)
I'll be sending out a new version of my script soon,
preview can be found here: (not finished though)
http://www.un4given.nl/tim/serverstatus/index.php?s=1
Greets,
Tim
DopeFish
01-24-2005, 08:28
*gg* I really like the new display of number of players playing. really nice idea
YankeeDeuce
01-31-2005, 19:51
Any update on that new version Tim? I'd love to have that on my site, the one I'm using right now is pretty ugly.
Hello Yankee,
Here's a nearly finished version, as my school's giving me hell right now...
I wanted to include playercount-graphs, but it seems like I'll have to throw
that one in a later release...
This version now supports both direct UDP request as well as request from
my own webserver. There is also the optional SQL support now, so any config
needed / wanted can be achieved by this one zippack.
The mappics are available as a loose download here:
www.un4given.nl/tim/mappics.zip
Preview here: www.un4given.nl/tim/serverstatus/
Best regards,
Tim
BigBaller
02-01-2005, 06:01
hehe I notice you used the html steam launching code, makes me feel special that I helped somewhat :)
Yeah thanks for that, it adds a nice touch to the whole purpose of the script:
Getting people to know and join your server when they see what map is on
and which people are playing there...
YankeeDeuce
02-01-2005, 16:25
Not working on my server :( I've had 2 different server queries but one never worked. That one did the same thing with yours; the other one said it couldn't connect to the server, yours says the server is down. Not sure what it can be, I know I can use fsockopen() and UDP ports. Great job though, it looks great, I hope I can figure out what's going on.
Edit the config.php, make sure you set this value, just as a test:
$use_sql = 0;
This would disable the SQL, after which it'll try to use either UDP
itself, or use remote files from my server to get your servers info.
So it should with either one of these enabled, got any links to show
me what is / isn't working on your webserver?
YankeeDeuce
02-01-2005, 17:43
www.wdgamers.net/server is where I have the files right now. I changed the config.php to use 0, it's still doing the same thing. I'm going look through and see if I have anything messed up.
Post / PM your config.php, I think you messed it up... ;P
Check PM...
To whom it may concern:
The script is fine, it could do with some better documentation though...
Haven't ranked that one high on my to-do-list, so you'd have to find
that out from the exmaples taht are posted in there (or ask me via PM).
Best regards,
Tim
YankeeDeuce
02-01-2005, 20:05
I'm guessing it's my webhost, still comes up as the Server is down, just like that other script. I'm go over the code between the one that works for me and yours, hopefully I can figure something out, yours looks A LOT better than the one I have now.
It's fixed, another demo here:
http://wdgamers.net/server/index.php
My demo still available here:
http://www.un4given.nl/tim/serverstatus/
It's already out halfway through page 3... Download link here:
http://www.sourcemod.net/~sourcemod/forums/download.php?id=189
where is the download link?
where is the download link?
You do realize this thread is five years old, right?
yes I realized, I asked about the link because there's always users that store and make backup scripts, and despite this ancient script is always useful to someone, and I think should be posted on the site.
HSFighter
04-13-2010, 18:44
Here a any discussion about "Website Server Status":http://forums.alliedmods.net/showthread.php?t=115107
vBulletin® v3.8.7, Copyright ©2000-2023, vBulletin Solutions, Inc.