edit_user.php
author peter
Tue, 29 Jan 2008 21:32:48 +0000
changeset 70 47248e2af079
parent 47 ae140472d97c
child 71 e1b918eaf69a
permissions -rw-r--r--
[feladat @ 117] Fixed a bug reported by Balazs Petrikovics. i18n doesn't work correctly on FreeBSD.
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
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
			clean_page($BASE_URL . $BASE_PATH . "users.php");
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
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    54
    <h2><? echo _('Edit user'); ?> "<? echo get_fullname_from_userid($_GET["id"]) ?>"</h2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
<?
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">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    60
     <input type="HIDDEN" name="number" value="<? echo $_GET["id"] ?>">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    61
     <table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    62
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    63
       <td class="n"><? echo _('User name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    64
       <td class="n"><input type="text" class="input" name="username" value="<? echo $r["username"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    65
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    66
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    67
       <td class="n"><? echo _('Full name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    68
       <td class="n"><input type="text" class="input" name="fullname" value="<? echo $r["fullname"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    69
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    70
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    71
       <td class="n"><? 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>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    75
       <td class="n"><? echo _('E-mail'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    76
       <td class="n"><input type="text" class="input" name="email" value="<? echo $r["email"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    77
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    78
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    79
       <td class="n"><? echo _('User level'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    80
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    81
        <select name="level">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    82
	 <option value="1" <? if($r["level"] == 1) { echo "selectED"; } ?>>1 (<? echo _('Normal user'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    83
	 <option value="5" <? if($r["level"] == 5) { echo "selectED"; } ?>>5 (<? echo _('Administrator'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    84
	 <option value="10" <? if($r["level"] == 10) { echo "selectED"; } ?>>10 (<? echo _('Administrator w/ user admin rights'); ?>)</option>
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>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    89
       <td class="n"><? echo _('Description'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    90
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    91
        <textarea rows="6" cols="30" class="inputarea" name="description"><? echo $r["description"]?></textarea>
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>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    95
       <td class="n"><? echo _('Active'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    96
       <td class="n"><input type="checkbox" name="active" value="1" <? if($r["active"]) { ?>CHECKED<? } ?>></td>
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>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
   100
       <td class="n"><input type="submit" class="button" name="commit" value="<? echo _('Commit changes'); ?>"></td>
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>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   104
<?
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
?>