Code:
<?
/**
*
* TG WHO'S ONLINE
* Copyright 2005 - 2006 (c) TOXIC GOBLIN
* http://www.toxicgoblin.com
*
*/
//Optional Database Connection Information
//**Uncomment the following 2 lines and edit the values if you do not already have an active database connection**
//
$db = mysql_connect("localhost", "db_name", "password") or die("Could not connect");
mysql_select_db("db_name");
//Fetch Time
$timestamp = time();
$timeout = $timestamp - 900;
//Insert User
$insert = mysql_query("INSERT INTO TG_whos_online (timestamp, ip, file) VALUES('$timestamp','".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."')") or die("Error in who's online insert query!");
//Delete Users
$delete = mysql_query("DELETE FROM TG_whos_online WHERE timestamp<$timeout") or die("Error in who's online delete query!");
//Fetch Users Online
$result = mysql_query("SELECT DISTINCT ip FROM TG_whos_online") or die("Error in who's online result query!");
$users = mysql_num_rows($result);
//Show Who's Online
if($users == 1) {
print("$users User Online\n");
} else {
print("$users Users Online\n");
}
?>
I've changed the user and name of db and user name - i hope that's ok.
Just an FYI, the script would be located at www.driftmedia.ca/network/online.php through url - so xfilesnews.com and fiction.xfilesnews.net would be calling it from the same path in file (i hope that makes sense.
basically the directory structure is:
pub_html/network/
pub_html/xfilesnew/
pub_html/xfnfic/
just for example - they're all at the same level, just both sites are using different domains.
|