• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook pagefor updates, or we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.)

Server Status + Online Players Count

Skilled Illusionist
Joined
Aug 18, 2005
Messages
305
Reaction score
78
Dont ask me how to use this. If you are to stupid to figure it out you shouldnt be hosting anything at all.

Server Status:
Code:
<?php
				$fp = @fsockopen("127.0.0.1", 5051, $errno, $errstr, 1);
if($fp >= 1){ 
echo '<font color=green>Online</font>';}
else{ echo '<font color=red>Offline</font>'; } 
			?>


Online Players:
Code:
<?php

include '/config/config.php';

$query = mysql_query("SELECT * FROM user WHERE online='1'");
$numrows = mysql_num_rows($query);
echo $numrows;

?>

As for the config.php you need something that connects to the DB... I would guess you could use something like..
Code:
$server['address'] 				= 		'127.0.0.1';
$server['user'] 				= 		'root';	
$server['pass']					= 		'';
$server['port'] 				= 		'3306';

Work on this part for yourself. Trying to keep the leechers out.


Have fun.
 
Junior Spellweaver
Joined
May 23, 2013
Messages
154
Reaction score
45
Nice release, good for those new to web code, not sure about the "if you're too stupid" wording even though I agree with it's meaning the phrasing isn't so diplomatic. xD

The final part about keeping out the leeches is good lol, I don't like leeches who do nothing for themselves. Overall good job.
 
Back
Top