add_user.php
author rejo
Thu, 27 Mar 2008 21:10:34 +0000
changeset 105 df46fd74c2ee
parent 102 f6d414c0ce89
child 110 455405c757e1
permissions -rw-r--r--
[feladat @ 205] Bugfix. A user with with at least view access could change user details, including the assigned permission template, for which he did have rights. Reported by Maarten te Paske.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     1
<?php
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     2
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     5
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     7
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    11
 *  (at your option) any later version.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    12
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    16
 *  GNU General Public License for more details.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    17
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    20
 */
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    21
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    23
include_once("inc/header.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    24
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    25
if (!verify_permission(user_add_new)) {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    26
	error(ERR_PERM_ADD_USER);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    27
} else {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    28
	if($_POST["commit"]) {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    29
		add_new_user($_POST);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    30
		success(SUC_USER_ADD);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    31
	}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    32
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    33
	echo "     <h2>" . _('Add a  user') . "</h2>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    34
	echo "     <form method=\"post\">\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    35
	echo "      <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    36
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    37
	echo "        <td class=\"n\">" . _('Username') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    38
	echo "        <td class=\"n\"><input type=\"text\" class=\"input\" name=\"username\" value=\"\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    39
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    40
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    41
	echo "        <td class=\"n\">" . _('Fullname') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    42
	echo "        <td class=\"n\"><input type=\"text\" class=\"input\" name=\"fullname\" value=\"\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    43
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    44
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    45
	echo "        <td class=\"n\">" . _('Password') . "</td>\n";
102
f6d414c0ce89 [feladat @ 202]
rejo
parents: 82
diff changeset
    46
	echo "        <td class=\"n\"><input type=\"password\" class=\"input\" name=\"password\"></td>\n";
82
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    47
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    48
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    49
	echo "        <td class=\"n\">" . _('Email') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    50
	echo "        <td class=\"n\"><input type=\"text\" class=\"input\" name=\"email\" value=\"\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    51
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    52
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    53
	echo "        <td class=\"n\">" . _('Permission template') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    54
	echo "        <td class=\"n\">\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    55
	echo "         <select name=\"perm_templ\">\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    56
	foreach (list_permission_templates() as $template) {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    57
		echo "          <option value=\"" . $template['id'] . "\">" . $template['name'] . "</option>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    58
	}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    59
	echo "         </select>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    60
	echo "       </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    61
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    62
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    63
	echo "        <td class=\"n\">" . _('Description') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    64
	echo "        <td class=\"n\"><textarea rows=\"4\" cols=\"30\" class=\"inputarea\" name=\"descr\"></textarea></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    65
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    66
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    67
	echo "        <td class=\"n\">" . _('Enabled') . "</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    68
	echo "        <td class=\"n\"><input type=\"checkbox\" class=\"input\" name=\"active\" value=\"1\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    69
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    70
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    71
	echo "        <td class=\"n\">&nbsp;</td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    72
	echo "        <td class=\"n\"><input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\"></td>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    73
	echo "      </table>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    74
	echo "     </form>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    75
}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    76
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    77
include_once("inc/footer.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    78
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    79
?>