get around to this eventually
PHP Code:
$DBhost = "host_server";
$DBuser = "UserName";
$DBPass = "PassWord";
$DBName = "Database";
function tracker() {
global $HTTP_SERVER_VARS;
if (array_key_exists("HTTP_REFERER",$_SERVER)) {
$referer = "'". $HTTP_SERVER_VARS["HTTP_REFERER"] . "'";
} else {
$referer = "'--'";
}
if (array_key_exists("QUERY_STRING",$_SERVER)) {
$querystring = "'". $HTTP_SERVER_VARS["QUERY_STRING"] . "'";
} else {
$querystring = "'--'";
}
$today = "'" . date('Y/m/d') . "'" ;
$now = "'" . date('H:i:s') . "'" ;
$remoteip = "'" . $HTTP_SERVER_VARS["REMOTE_ADDR"] . "'" ;
$page = "'" . $HTTP_SERVER_VARS["PHP_SELF"] . "'" ;
$method = "'" . $HTTP_SERVER_VARS["REQUEST_METHOD"] . "'" ;
$useragent = "'" . $HTTP_SERVER_VARS["HTTP_USER_AGENT"] . "'" ;
$db = mysql_connect($DBhost, $DBuser, $DBpass);
mysql_select_db($DBName, $db);
//$sql ="SELECT * FROM _tracker";
//$result = mysql_query($sql);
$sql = "INSERT INTO _tracker (accessdate,accesstime,remoteip,refererurl,siteurl,querystr,method,useragent) VALUES ($today,$now,$remoteip,$referer,$page,$querystring,$method,$useragent)";
$result = mysql_query($sql);
mysql_close($db);
}
SQL code for creating the DB and tables
Code:
# HeidiSQL Dump
#
# --------------------------------------------------------
# Host: 192.168.5.10
# Database: remote
# Server version: 5.0.27-community-nt
# Server OS: Win32
# max_allowed_packet: 1048576
# HeidiSQL version: 3.0 RC4 Revision: 334
# --------------------------------------------------------
/*!40100 SET CHARACTER SET latin1;*/
#
# Database structure for database
#
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `change_database_name` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE change_database_name;
#
# Table structure
#
CREATE TABLE /*!32312 IF NOT EXISTS*/ `_tracker` (
`id` int(6) unsigned NOT NULL auto_increment,
`accessdate` date default NULL,
`accesstime` time default NULL,
`remoteip` char(15) default NULL,
`refererurl` char(254) default NULL,
`siteurl` char(254) default NULL,
`querystr` char(254) default NULL,
`method` char(6) default NULL,
`useragent` char(254) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3425 DEFAULT CHARSET=latin1;
If you need it to get a specific querystring value add it to the script and a database field.
It just needs an admin panel with some built in queries to filter and extract the required records.