<!--Sniffer Script -->
<?php require_once ($_SERVER["DOCUMENT_ROOT"].'/Connections/freecrm.php'); ?>
<?php
//connection
//database selection
<?php
$userloggedin=$HTTP_SESSION_VARS['MM_Username'];//take username from session if you are using it.
$ip=$_SERVER['REMOTE_ADDR'];//get ip address
$when = time();//get time page was hit
$clientbrowser = getenv(HTTP_USER_AGENT);//get system and browser info
$referer = getenv(HTTP_REFERER);// get refering page i.e. where it came from
function getAddress()
{
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
$clienturl=getAddress();//call address function above to get URL visited
$clienthost=gethostbyaddr($_SERVER['REMOTE_ADDR']);//get hostname
$clientlanguage=$_SERVER["HTTP_ACCEPT_LANGUAGE"];// get language
?>
<!--end sniffer script -->
<!--Start of sniffer insert -->
<?php
mysql_query("
INSERT INTO LOG (IP, BROWSER, VISDATETIME, REFERAL, URL, LANGUAGE, HOST) VALUES('$ip', '$clientbrowser', '$when', '$referer', '$clienturl' ,'$clientlanguage', '$clienthost')
") or die(mysql_error()); //insert record into db
?>
<!--End of sniffer insert -->