1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<?/*
+-------------------------------------------------------------------------+
| Copyright (C) 2002 Ian Berry |
| |
| 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, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any |
| questions or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/?>
<? header("Cache-control: no-cache");
include ('include/database.php');
$section = "User Administration"; include ('auth/include/auth.php');
include_once ('include/form.php');
include ('include/config.php');
switch ($action) {
case 'save':
mysql_query("replace into auth_hosts (id,hostname,userid,type) values($id,\"$hostname\",$userid,$type)",$cnn_id);
header("Location: user_admin_ip.php?id=$uid"); exit;
break;
case 'delete':
mysql_query("delete from auth_hosts where id=$id",$cnn_id);
header("Location: user_admin_ip.php?id=$uid"); exit;
break;
case 'edit':
include_once ('include/top_header.php');
if ($id != "") {
$sql_id = mysql_query("select * from auth_hosts where id=$id", $cnn_id);
}
DrawFormHeader("Edit Hostname","",false);
DrawFormItem("Hostname","");
DrawFormItemTextBox("hostname",$sql_id,"","");
DrawFormSaveButton();
DrawFormItemHiddenIDField("id",$id);
DrawFormItemHiddenIDField("type",$type);
DrawFormItemHiddenIDField("userid",$uid);
DrawFormFooter();
break;
default:
include_once ("include/top_header.php");
DrawMatrixTableBegin(false);
DrawMatrixRowBegin();
DrawMatrixHeaderTop("IP Security (Listed by Precedence)",$color_dark_bar,$color_panel_text,"1");
DrawMatrixRowEnd();
DrawMatrixRowBegin();
DrawMatrixHeaderItem("Deny Only These IP's",$color_panel,$color_panel_text);
DrawMatrixHeaderAdd($color_panel,"","user_admin_ip.php?action=edit&uid=$id&type=1");
DrawMatrixRowEnd();
$sql_id = mysql_query("select * from auth_hosts where type=1 and userid=$id order by hostname", $cnn_id);
$rows = mysql_num_rows($sql_id); $i = 0;
while ($i < $rows) {
DrawMatrixRowBegin();
DrawMatrixLoopItem($sql_id,"hostname",$i,false,"user_admin_ip.php?action=edit&id=" . mysql_result($sql_id, $i, "id") . "&uid=$id&type=1");
DrawMatrixLoopItemAction("Delete",$color_panel,$color_panel_text,false,"user_admin_ip.php?action=delete&id=" . mysql_result($sql_id, $i, "id") . "&uid=$id");
DrawMatrixRowEnd();
$i++;
}
DrawMatrixRowBegin();
DrawMatrixHeaderItem("Only Allow These IP's",$color_panel,$color_panel_text);
DrawMatrixHeaderAdd($color_panel,"","user_admin_ip.php?action=edit&uid=$id&type=2");
DrawMatrixRowEnd();
$sql_id = mysql_query("select * from auth_hosts where type=2 and userid=$id order by hostname", $cnn_id);
$rows = mysql_num_rows($sql_id); $i = 0;
while ($i < $rows) {
DrawMatrixRowBegin();
DrawMatrixLoopItem($sql_id,"hostname",$i,false,"user_admin_ip.php?action=edit&id=" . mysql_result($sql_id, $i, "id") . "&uid=$id&type=2");
DrawMatrixLoopItemAction("Remove",$color_panel,"",false,"user_admin_ip.php?action=delete&id=" . mysql_result($sql_id, $i, "id") . "&uid=$id");
DrawMatrixRowEnd();
$i++;
}
DrawMatrixTableEnd();
DrawBodyFooter(true);
break;
} ?>
|