I DONT use classes but i created a file called protect.php and it is the FIRST line in all my scripts
<? include("protect.php") ?>
Protect has the foll. code.
<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ip = GetHostByName($hostname);
$t1 = date('Y-m-d H:i:s');
$page = $_SERVER['PHP_SELF'];
$url = $PHP_SELF."?".$_SERVER['QUERY_STRING'];
?>
<input type="hidden" name="ip" value="<? echo $ip?>" >
<input type="hidden" name="userid" value="<? echo $userid ?>" >
<input type="hidden" name="t1" value="<? echo $t1 ?>" >
<input type="hidden" name="page" value="<? echo $page ?>" >
<input type="hidden" name="url" value="<? echo $url ?>" >
<?
mysql_connect("localhost", $dbname, $dbpasswd )
or die ("Unable to connect to server.");
mysql_select_db($database)
or die ("Unable to select database.");
$sqla = "INSERT INTO `Log` (uid, Date, ip, File) VALUES ('$userid', '$t1', '$ip', '$url')" ;
// echo $sqla;
// echo $page;
$resulta = mysql_query($sqla)
or die (mysql_error());
$sqlb="select max(LID) from `Log`";
$resultb = mysql_query($sqlb)
or die (mysql_error());
$myrowb = mysql_fetch_row($resultb);
$lid = $myrowb[0];
?>
HTH,
Swati