<?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");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {

if (!defined('SECUR_MAX')) {
	die ();
}

if (!is_god($admin)) { redirect_url("".$admin_file.".php"); }
if (!is_admin($admin)) { redirect_url("".$admin_file.".php"); }
if (!is_user($user)) { redirect_url("".$admin_file.".php"); }

		$del_aid = trim($del_aid);
		$GLOBALS['db']->sql_query("DELETE FROM `".TABLE_AUTHORS."` where `aid`='$del_aid'");
		$GLOBALS['db']->sql_query("DELETE FROM `".TABLE_NSNSECUREADMIN."` WHERE `name`='$del_aid'");
		$result = $GLOBALS['db']->sql_query("SELECT `mid`, `admins` FROM `".TABLE_MODULES."`");
		while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
			$admins = explode(",", $row[admins]);
			$adm = "";
			for ($a=0; $a < sizeof($admins); $a++) {
				if ($admins[$a] != "$del_aid" AND $admins[$a] != "") {
					$adm .= "$admins[$a],";
				}
			}
			$GLOBALS['db']->sql_query("UPDATE `".TABLE_MODULES."` SET `admins`='$adm' WHERE `mid`='$row[mid]'");
		}
		redirect_url("".$admin_file.".php?op=promotion");


}
}else {
	echo "Access Denied";
}