<?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                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
global $admin_file;
$aid = substr("$aid", 0,25);
$row = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `radminsuper` FROM `".TABLE_AUTHORS."` WHERE `aid`='$aid'"));
$acces = $GLOBALS['db']->XMFbin($row['radminsuper']);
if ($acces == 1) {

	/*********************************************************/
	/* Referer Functions to know who links us                */
	/*********************************************************/

	function hreferer() {
		global $bgcolor2, $admin_file, $httpref;
		incoh();
		Max_OpenTable();
		echo "<center><font class='title'><b>" . _HTTPREFERERS . "</b></font></center>";
		Max_CloseTable();
		br('1');
		Max_OpenTable();

if ( empty($httpref) ) {
br('1');
echo "<center><font color='red'>"._HTTPREF_NO_ACTIVE."</font></center>";
br('1');
} else {


		echo "<center><b>" . _WHOLINKS . "</b></center><br /><br />"
		."<table border=\"0\" width=\"100%\">";
		$result = $GLOBALS['db']->sql_query("SELECT `rid`, `url` FROM `".TABLE_REFERER."`");
		while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
			$rid = $GLOBALS['db']->XMFnum($row['rid']);
			$url = stripslashes($row['url']);
			echo "<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">$rid</td>"
			."<td bgcolor=\"$bgcolor2\"><font class=\"content\"><a href=\"$url\" target=\"_blank\">$url</a></td></tr>";
		}
		echo "</table>"
		."<form action=\"".$admin_file.".php\" method=\"post\">"
		."<input type=\"hidden\" name=\"op\" value=\"delreferer\" />"
		."<center><input type=\"submit\" value=\"" . _DELETEREFERERS . "\" /></center></form>";

}
		Max_CloseTable();
		incof();
	}

	function delreferer() {
		global $admin_file;
		$GLOBALS['db']->sql_query("DELETE FROM `".TABLE_REFERER."`");
		redirect_url("".$admin_file.".php?op=adminMain");
	}
if($admintest && $adminsecu)  {
	switch($op) {

		case "hreferer":
		hreferer();
		break;

		case "delreferer":
		delreferer();
		break;

	}
}
} else {
	echo "Access Denied";
}