<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or die ('Access denied http pref MAXIMUS directly...');

	$referer = htmlentities($_SERVER['HTTP_REFERER']);
	$referer = check_html($referer, "nohtml");
	if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
	} else {
	$result = $GLOBALS['db']->sql_query("INSERT INTO `".TABLE_REFERER."` VALUES (NULL, '$referer')");
	}
	$numrows = $GLOBALS['db']->sql_numrows($GLOBALS['db']->sql_query("SELECT `rid` FROM `".TABLE_REFERER."`"));
	if($numrows>=$httprefmax) {
	$result2 = $GLOBALS['db']->sql_query("DELETE FROM `".TABLE_REFERER."`");
	}