Tankbuster 1731 Posted August 15, 2005 Guy, I wonder if this is possible? I'd like to have a link on my webpage that displays a nice graphic when my standalone server is up and a not so nice one when it isn't. Maybe it should even say how may people are on the server. Has this already been done or is it easy to implement? Share this post Link to post Share on other sites
Placebo 28 Posted August 15, 2005 Sounds like a multiplayer question. Share this post Link to post Share on other sites
majorpwnage 0 Posted August 15, 2005 The guys from the WKK squad have created a server status query that you can display on your website. Â It displays many attributes - status, map name, island, number of players, etc. Â I believe this is the most popular server status query for OFP. Â It's just a couple of php files, and you only have to edit a couple things, pretty simple. The files can be downloaded from here: http://www.wkk.dk/modules.php?name=Downloads&d_op=getit&lid=17 Share this post Link to post Share on other sites
Daddl 10 Posted August 15, 2005 Guy, I wonder if this is possible?I'd like to have a link on my webpage that displays a nice graphic when my standalone server is up and a not so nice one when it isn't. Maybe it should even say how may people are on the server. Has this already been done or is it easy to implement? Try this: pDSSQ Check my signature and the images below for examples. Include the php script (php 4, but should run on a php5 server without troubles) as if it were a png picture: Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 16, 2005 I tried Daddl's one first, but I'll be honest I'm not particulary aufait with PHP, especially includes. Here's the code snippet from my index.htm page; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> <table width="85%" border="0" cellspacing="0" cellpadding="0">      <tr>       <td><font color="#000000"> </font></td> <?php include 'http://www.teamspaff.co.uk/pDSSQ.php'; ?>      </tr>     </table> However, this doesn't get parsed. If I look at the source code from the resulting webpage, the php hasn't been parsed. So, I tried plan B. have the include statement in a small php file of its own and calling that. This doesn't produce expected result either after a pause it produces; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Warning: main(http://www.teamspaff.co.uk/pDSSQ.php): failed to open stream: HTTP request failed! $Ôl¶ą in /home/teamsp1/public_html/serverquery.php on line 2 Warning: main(): Failed opening 'http://www.teamspaff.co.uk/pDSSQ.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/teamsp1/public_html/serverquery.php on line 2 Share this post Link to post Share on other sites
Daddl 10 Posted August 16, 2005 just use a standard html image tag: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"><img src="http://www.teamspaff.co.uk/pDSSQ.php" alt="Teamspaff Server Stats" width="250" height="100"></img> What you include is just an image - the pDSSQ.php script generates the image on the fly whenever a browser tries to access the 'image'. Adjust the height and width to your needs - and check the link by simply typing it into the browser. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 16, 2005 Yeh. One thing though, remeber you can't put PHP commands on a .htm page on most servers So if you did need to include the page, it still wouldn't have worked, you'd need to change the index.htm to index.php - Ben Share this post Link to post Share on other sites
majorpwnage 0 Posted August 16, 2005 Yeh. One thing though, remeber you can't put PHP commands on a .htm page on most servers So if you did need to include the page, it still wouldn't have worked, you'd need to change the index.htm to index.php - Ben You could also include the entire php page in an iframe, if sized properly. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 16, 2005 Yep, but that's because it isn't a PHP command, so it works in .htm files Anyway, kinda off topic - Ben Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 17, 2005 Aha. I've been told off for just plopping php into an html file and expecting it to work before. Please continue to take the mickey! Anyhoo... I've changed it as Daddl suggested but it's still not working. After a pause of 1 minute, the page generates the infamous "image broken" red cross. The script and htm live in the same directory and I've tried using the entire url or just the file name with the same result. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 17, 2005 You changed the server IP, port and calll type? (Try 0, 1 or 5 for OFP) Ah, more importantly, does your hosting support the GD image libary? (Save a new php file, containing.. <?PHP php_info(); ?> and open it, then find GD, if it's on that page, you have it) If you don't, that will explain the script not working - Ben Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 17, 2005 I'd already checked GD is enabled and yes, it is. I've tried all 3 of the call types with the same result (and yes, I am refreshing the browser properly each time ) Still little red cross. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 17, 2005 Hmm, if you posted either here or PMed the server IP/port, I'll try it on my hosting and that'll narrow it down to either the server, or your hosting - Ben Share this post Link to post Share on other sites
HitmanFF 6 Posted August 17, 2005 You should probably check for Truetype font support as well in the phpinfo() information. If you open the link in IE, try to save the result (the red cross) as a text file and read the contents. You may have a readable error message there that will tell you what's wrong. Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 17, 2005 server ip 80.0.199.181 or homeip.tankbuster.net port 2302 Can't see any reference to truetype in the phpinfo list. Share this post Link to post Share on other sites
HitmanFF 6 Posted August 17, 2005 server ip 80.0.199.181 or homeip.tankbuster.net port 2302Can't see any reference to truetype in the phpinfo list. Alternatively, freetype could be enabled. Could you check for that as well in the phpinfo listing? It should be listed in the gd section as FreeType Support. If that is lacking as well, the php script is unable to draw the text (imagettftext function). Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 17, 2005 Here's the output of the GD section. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GD Support  enabled  GD Version  bundled (2.0.28 compatible)  GIF Read Support  enabled  GIF Create Support  enabled  JPG Support  enabled  PNG Support  enabled  WBMP Support  enabled  XBM Support  enabled  Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 17, 2005 Weird, I've tried it on a hosting that that I know for a fact the GD lib works (With true type fonts), and it doesn't display : "The image “....../pDSSQ.php†cannot be displayed, because it contains errors." Same error running it of Apache on my PC (Which I dont think has the GD stuff, but worth a try ) But the hosting I tried it on is being used for a friend and I's project that makes a large use of the GD functions.. - Ben Share this post Link to post Share on other sites
HitmanFF 6 Posted August 17, 2005 Here's the output of the GD section.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GD Support enabled GD Version bundled (2.0.28 compatible) GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled Freetype support is missing. Ypu should see something like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">FreeType Support enabled FreeType Linkage with freetype Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 17, 2005 Yeah, I see that. I have another host available. I'll pinch some of Mrs Tanks webspace (that does have freetype) and test it there in the morning. Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 18, 2005 Righty. I'm using another webhost, this one does have freetype. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype But I'm still getting the image broken red cross after 60 seconds of pause. I'm beginning to worry I've made some embarresing newbie error. Share this post Link to post Share on other sites
HitmanFF 6 Posted August 18, 2005 Righty.I'm using another webhost, this one does have freetype. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype But I'm still getting the image broken red cross after 60 seconds of pause. I'm beginning to worry I've made some embarresing newbie error. Could you try to open with IE and save the result as a text file? The text file most likely contains an error message indicating what's wrong Share this post Link to post Share on other sites
majorpwnage 0 Posted August 18, 2005 Quote[/b] ]server ip 80.0.199.181 or homeip.tankbuster.net port 2302 Are you sure that the IP and port are correct? Â I have tested it with several web query programs and came up with nothing for that ip/port. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted August 18, 2005 The IP is alive, it pings okay Try.. Commenting out the line (put // before it) header("content type:image/png"); And see if theres anything like an error.. If it's a bunch of extremely random gibberish, I have no idea what the problem is, if you see an error, post it here - Ben Share this post Link to post Share on other sites
Tankbuster 1731 Posted August 18, 2005 Quote[/b] ]server ip 80.0.199.181 or homeip.tankbuster.net port 2302 Are you sure that the IP and port are correct? Â I have tested it with several web query programs and came up with nothing for that ip/port. definately. At the time you did that, I was playing Operation Stormhammer with a few team mates. Share this post Link to post Share on other sites