File size: 625B
<?php
include './db.php';
ini_set('session.save_path', './tmp/');
session_name('sid');
session_start();
if(!empty($_SERVER['HTTP_REFERER']) && parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) != $site && @$_SESSION['referer'] != htmlspecialchars(trim($_SERVER['HTTP_REFERER']))) {
$_SESSION['referer'] = htmlspecialchars(trim($_SERVER['HTTP_REFERER']));
mysql_query("INSERT INTO `referers` SET
`ip` = '". $_SERVER['REMOTE_ADDR'] ."',
`ua` = '". mysql_real_escape_string(trim($_SERVER['HTTP_USER_AGENT'])) ."',
`url` = '". mysql_real_escape_string(trim($_SERVER['HTTP_REFERER'])) ."',
`time` = UNIX_TIMESTAMP()");
}
?>