[php] Game status script

Joined
Feb 29, 2008
Messages
4
Reaction score
0
Hi have have a game that calls Deer Hunter 2005 and i want a script that show my members if server is online or offline
have tested some scripts but when i start server do the script shows offline everytime have tested diffrent ports but cant seems to find the right port or is the script crap?

its for phpnuke
Code:
<?php
// Edit IPs below
$loginIP = ""; // login server
$gameIP = ""; // game server
// Edit Ports if needed
$loginPORT= "";
$gamePORT= "";

// No need to edit below unless you want to skin it
$flogin = fsockopen ("$loginIP",$loginPORT, $errno, $errstr, 1);
if(empty($loginIP) || empty($gameIP){$loginIP="No IP selected";$gameIP="No IP Selected";**
if ($flogin){print "Login Server [$loginIP:$loginPORT]<img src='images/online.png'>";**
else {print "Login Server [$loginIP:$loginPORT]<img src='images/offline.png'>";**

$fgame = fsockopen ("$gameIP",$gamePORT, $errno, $errstr, 1);
if ($fgame){print "Game Server [$gameIP:$gamePORT]<img src='images/online.png'>";**
else {print "Game Server [$gameIP:$gamePORT]<img src='images/offline.png'>";**
?>
but this dont work right
 
Last edited:
Re: Game status script

Ok your game has the loginserver and gameserver with those exact names? A lil more dtail on how your server is setup would help me help you.
 
Try using @fsockopen, that will cancel out the false reading for the if statement and show the script it's online.
 
No that did not help at all :throw:is there any that can fix a script that works for Deer Hunter 2005 server and only offline or online......... i will pay for it when i see it works ...skip the script above only i need is ip and game port not any login
 
Try this:
PHP:
<?php
$timeout = "1";
$status =  @fsockopen($ip, $port, $errno, $errstr, $timeout);
if($status){
 print "<font color=\"green\">Online</font>";
		} else {
 print "<font color=\"red\">Offline</font>";
			}
?>
It's the exact one I use so it should work.
 
Try ;
Code:
<?php
  $server  = "YOURIP";
  $poort   = "YOURPORT";
  $timeout = "10";
  if ($server and $poort and $timeout) {
    $verbinding =  @fsockopen("$server", $poort, $errno, $errstr, $timeout);
  }
  if(!$verbinding) {
    include ('online.php');
  }
  else {
    include ('offline.php');
  }
?>
 
Nope nothing works at all last script shows online all time i set in 4 digits and offline when i set in 2 lol.......Please help out i will pay for it
 
First off, try to increase the timeout to more than 1, say 5 or 10.

Next, if you are testing your php script on a computer different from your game server, make sure your server computer has it's port opened, and make sure the server itself is properly configured and able to accept connections.

If the game server is running on a different computer in your local network, try to use it's LAN ip address instead of global. If using LAN works, then your router is misconfigured.

If you're testing both script and server on the same computer, then first try running the script using ip 127.0.0.1 (localhost). If that works, but global does not, then your router is misconfigured.

If your testing on a computer outside your local network, make sure your IP is correct, and make sure it's the global ip and not the local.

Lastly, change your script (for now while you have problems) to print out the error string and number if the fsockopen fails so that you can have at least some insight on what the problem might be.
 
thanks for respons...i will clear it up so you understand
first i run my site by my self and run even server on same machine...so
first so is my port 80 open b4 site show and then i use the script do it show me offline and if i take a alest 4 digits so will it show online and i can take 50 numbers so will it show online weird so many ports are there not lol...and deer hunter 2005 use query port 6500 i hope it is query port i should use and if not how do i find out which port then? ...i did try all you did say above but not any what i want lol

and you did say this on 1 line

to print out the error string and number if the fsockopen fails so that you can have at least some insight on what the problem might be.

iam not a coder so that line can maybe help me out lol but i dont know how...I pay you 30 bucks if you help me out and the script works!
do you have MSN so pm me your adress so will it go faster lol

opps i do not have any router
 
Back