Broomball Association of South Australia |
|
Contact Us | |
Noarlunga Ice Sports
P.O. Box 10351, Adelaide Business Centre South Australia 5000 32 David Witton Drive, Noarlunga Centre South Australia Phone: (08) 8186 1588 email: sbl@basa.org.au Thursday 7.30pm - 9:45pm Web:Noarlunga Ice Sports | |
BASA Mobile Home |
/**
*
* TG WHO'S ONLINE
* Copyright 2005 - 2006 (c) TOXIC GOBLIN
* http://www.toxicgoblin.com
*
*/
include("commondb.inc.php");
//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", "username", "password") or die("Could not connect");
//mysql_select_db("database_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 TG_whos_online.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 Online \n");
} else {
print(" $users Online \n");
}
$result = mysql_query("SELECT id FROM TG_whos_online order by id desc limit 0,1") or die("Error in who's online result query!");
$row = mysql_fetch_array($result);
//Show Who's Online
print("and $row[id] visits. \n");
// $result = mysql_query("SELECT DISTINCT ip, file FROM TG_whos_online") or die("Error in who's online read result query!");
// while ($row = mysql_fetch_array ($result) )
//{
// Query for getting visitor countrycode
$country_query = "SELECT country_code2,country_name FROM iptocountry WHERE IP_FROM<=inet_aton('".$_SERVER['REMOTE_ADDR']."') AND IP_TO>=inet_aton('".$_SERVER['REMOTE_ADDR']."')";
// Executing above query
$country_exec = mysql_query($country_query);
// Fetching the record set into an array
$ccode_array=mysql_fetch_array($country_exec);
// getting the country code from the array
$country_code=$ccode_array['country_code2'];
// getting the country name from the array
$country_name=$ccode_array['country_name'];
$insert = mysql_query("INSERT INTO BASA_WEB_STATS (ip, page,country) VALUES('".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."','$country_name')") or die("Error in who's online insert query!");
// }
mysql_close($Link);
?> |