<?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)  {

   incoh();

    $sql = "SELECT `graphic_admin` from `".TABLE_NSNSECUREADMIN_CONFIG."`";
    if ( !($graf = $db->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain config nsnsecureadmin', '', __LINE__, __FILE__, $sql);}
    $row = $db->sql_fetchrow($graf);
    $grafic_admin = $db->XMFnum($row['graphic_admin']);

    if ($grafic_admin == 1) { GraphicAdmin();}

    nsnsecureadminmenu();

    Max_OpenTable();
    echo "<center><font class='title'>"._GWARNING."</FONT></center>";
    $alresult = $db->sql_numrows($db->sql_query("select * from ".TABLE_NSNSECUREADMIN_LOGS.""));
    IF ($alresult < 1) {echo "<br /><center><b>"._NOALERTES."</b></center><br />";} else {
    echo "<br /><center><b>"._WARNING." $alresult "._ALERTES."</b></center><br />";}
    Max_CloseTable();

    br('1');

    Max_OpenTable();
    $logs_ip = getenv("REMOTE_ADDR");
    $logs_host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    echo "<center><font class='title'><b>"._MEMBERSALLOW."</b></font><br /><br />"
        ."<font color='red'>"._YOURIP." : $logs_ip   &nbsp;&nbsp;-&nbsp;&nbsp;  "._YOURHOST." : $logs_host</font><br /><br />"
        ."<table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">"
        ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._ID."</b></td>"
	."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._NAME."</b></td>";
if ($ip_fixe == 1){
    echo "<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IPFIXE."</b></td>"
	."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._HOSTFIXE."</b></td>";
	} else {
    echo "<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._NOIPFIXE."</b></td>";
        }
    ECHO "<td bgcolor=\"$bgcolor2\" align=\"center\">&nbsp;<b>"._FUNCTIONS."</b>&nbsp;</td></tr>";
    $result = $db->sql_query("SELECT `id`, `name`, `ipfixe`, `host` from `".TABLE_NSNSECUREADMIN."`");
    while ($row = $db->sql_fetchrow($result)) {
    $id = $db->XMFnum($row['id']);
    $name   = stripslashes($row['name']);
    $ipfixe = stripslashes($row['ipfixe']);
    $host   = stripslashes($row['host']);
	echo "<tr><td align=\"center\" width=\"5%\"><b>$id</b>"
	    ."</td><td align=\"center\" width=\"15%\"><b>$name</b>";
if ($ip_fixe == 1){
        ECHO "</td><td align=\"center\" width=\"20%\"><b>$ipfixe</b>"
	    ."</td><td align=\"center\" width=\"30%\"><b>$host</b>";
	    } ELSE {
	ECHO "</td><td align=\"center\" width=\"30%\"><b>$logs_host</b>";
	}
if ($id!='1'){
        echo "</td><td align=\"center\" width=\"20%\" nowrap>(<a href=\"".$admin_file.".php?op=editnsnsecureadmin&id=$id\">" . _EDIT . "</a>-<a href=\"".$admin_file.".php?op=deletensnsecureadmin&id=$id\">" . _DELETE . "</a>)"
	    ."</td></tr>";
	} else {
        echo "</td><td align=\"center\" width=\"20%\" nowrap><a href=\"".$admin_file.".php?op=editnsnsecureadmin&id=$id\">!! " . _EDIT . " !!</a></td></tr>";
	    }
	    }
    echo "</table></center><br />";
    Max_CloseTable();

    br('1');

    Max_OpenTable();
    echo "<center><font class='title'><b>"._ADDNAME."</b></font></center><br />"
        ."<center><form action=\"".$admin_file.".php\" method=\"post\">"
	."<br /><b>". _NAME.":</b> "
	."<input type=\"text\" name=\"add_name\" value=\"\" size=\"50\" maxlength=\"100\"><br />";
if ($ip_fixe == 1){
    echo "<hr width='50%'><b>"._FORIPFIXE."</b><br />"
        ."<br /><b>"._HOSTFIXE.":&nbsp;&nbsp;</b>"
	."<input type=\"text\" name=\"add_host\" value=\"\" size=\"50\" maxlength=\"50\"><br /><i>"._HOSTCOMM."</i><br />"
	."<br /><b>"._IPFIXE.":&nbsp;&nbsp;</b>"
	."<input type=\"text\" name=\"add_ipfixe\" value=\"\" size=\"50\" maxlength=\"50\"><br /><i>"._IPFIXECOMM."</i><br /><br />";
	}
	echo "</select><br />"
	."<input type=\"hidden\" name=\"op\" value=\"addnsnsecureadmin\">"
	."<input type=\"submit\" value=\""._APPROVE."\">"
	."</form></center>";
    echo "<CENTER><a href=\"_GOBACK\">"._GOBACK."</A></CENTER>";
    Max_CloseTable();

    incof();

}
}else {
	echo "Access Denied";
}