edit_user.php
author peter
Mon, 11 Feb 2008 19:52:20 +0000
changeset 74 43c31dc98305
parent 73 8a239565e9b3
child 82 c255196bc447
permissions -rw-r--r--
[feladat @ 121] Moved the constants down, so the ROWAMOUNT can be defined in the config.inc.php file. This to solve ticket:20. Fixed a bug which was introduced in r112. The used arguments in the setLimit function where in the wrong order.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
47
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 43
diff changeset
    21
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
if($_POST["commit"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
	if($_POST["username"] && $_POST["level"] && $_POST["fullname"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
		if(!isset($_POST["active"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
			$active = 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
			$active = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
		if(edit_user($_POST["number"], $_POST["username"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $active, $_POST["password"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
		{
73
8a239565e9b3 [feladat @ 120]
peter
parents: 71
diff changeset
    38
			clean_page("users.php");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
			error("Error editting user!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
if (!level(10))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
{
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    51
	error("You do not have the required access level.");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    54
    <h2><?php echo _('Edit user'); ?> "<?php echo get_fullname_from_userid($_GET["id"]) ?>"</h2>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    55
<?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
$r = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
$r = get_user_info($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    59
    <form method="post">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    60
     <input type="HIDDEN" name="number" value="<?php echo $_GET["id"] ?>">
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    61
     <table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    62
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    63
       <td class="n"><?php echo _('User name'); ?>:</td>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    64
       <td class="n"><input type="text" class="input" name="username" value="<?php echo $r["username"]?>"></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    65
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    66
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    67
       <td class="n"><?php echo _('Full name'); ?>:</td>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    68
       <td class="n"><input type="text" class="input" name="fullname" value="<?php echo $r["fullname"]?>"></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    69
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    70
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    71
       <td class="n"><?php echo _('Password'); ?>:</td>
43
2d7b36d12274 [feladat @ 90]
rejo
parents: 13
diff changeset
    72
       <td class="n"><input type="password" class="input" name="password" value=""></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    73
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    74
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    75
       <td class="n"><?php echo _('E-mail'); ?>:</td>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    76
       <td class="n"><input type="text" class="input" name="email" value="<?php echo $r["email"]?>"></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    77
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    78
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    79
       <td class="n"><?php echo _('User level'); ?>:</td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    80
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    81
        <select name="level">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    82
	 <option value="1" <?php if($r["level"] == 1) { echo "selectED"; } ?>>1 (<?php echo _('Normal user'); ?>)</option>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    83
	 <option value="5" <?php if($r["level"] == 5) { echo "selectED"; } ?>>5 (<?php echo _('Administrator'); ?>)</option>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    84
	 <option value="10" <?php if($r["level"] == 10) { echo "selectED"; } ?>>10 (<?php echo _('Administrator w/ user admin rights'); ?>)</option>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    85
	</select>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    86
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    87
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    88
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    89
       <td class="n"><?php echo _('Description'); ?>:</td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    90
       <td class="n">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    91
        <textarea rows="6" cols="30" class="inputarea" name="description"><?php echo $r["description"]?></textarea>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    92
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    93
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    94
      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    95
       <td class="n"><?php echo _('Active'); ?>:</td>
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    96
       <td class="n"><input type="checkbox" name="active" value="1" <?php if($r["active"]) { ?>CHECKED<?php } ?>></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    97
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    98
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    99
       <td class="n">&nbsp;</td>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
   100
       <td class="n"><input type="submit" class="button" name="commit" value="<?php echo _('Commit changes'); ?>"></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
   101
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
   102
     </table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
   103
    </form>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
   104
<?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   105
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   106
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   107
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   108
?>