<?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                                 */
/************************************************************************/
/********************************************************/
/* NukeSentinel(tm)                                     */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/

if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}

if(is_god($admin)) {
  $importad = $db->sql_query("SELECT `aid`, `name`, `pwd` FROM `".TABLE_AUTHORS."`");
  while(list($a_aid, $a_name, $a_pwd) = $db->sql_fetchrow($importad)) {
    $adminrow = $db->sql_numrows($db->sql_query("SELECT `aid` FROM `".TABLE_NSNST_ADMINS."` WHERE `aid`='$a_aid'"));
    if($adminrow == 0) {
      if(strtolower($a_name) == "god") { $is_god = 1; } else { $is_god = 0; }
      $result = $db->sql_query("INSERT INTO `".TABLE_NSNST_ADMINS."` (`aid`, `login`, `protected`) VALUES ('$a_aid', '$a_aid', '$is_god')");
      $db->sql_query("OPTIMIZE TABLE ".TABLE_NSNST_ADMINS."");
    }
  }
  $exportad = $db->sql_query("SELECT `aid` FROM `".TABLE_NSNST_ADMINS."`");
  while(list($a_aid) = $db->sql_fetchrow($exportad)) {
    $adminrow = $db->sql_numrows($db->sql_query("SELECT `aid` FROM `".TABLE_AUTHORS."` WHERE `aid`='$a_aid'"));
    if($adminrow == 0) {
      $result = $db->sql_query("DELETE FROM `".TABLE_NSNST_ADMINS."` WHERE `aid`='$a_aid'");
      $db->sql_query("OPTIMIZE TABLE `".TABLE_NSNST_ADMINS."`");
    }
  }
  $pagetitle = _AB_NUKESENTINEL.": "._AB_SCANADMINS;
  incoh();
  title($pagetitle);
  Max_OpenTable();
OpenMenu();
  ipbanmenu();
  CarryMenu();
  blankmenu();
  CloseMenu();
  Max_CloseTable();
  br('1');
  Max_OpenTable();
  echo "<center><b>"._AB_SCANADMINSDONE."</b></center>\n";
  Max_CloseTable();
  incof();
}