edit_user.php
author rejo
Mon, 25 Jun 2007 21:32:29 +0000
changeset 26 5d63f1e71d6e
parent 13 2ff220cfde13
child 43 2d7b36d12274
permissions -rw-r--r--
[feladat @ 73] All owners (not sub-owners though) of the zone are now shown when listing a zone. Added a new function to retrieve owners of zone by id without fetching all other zone details, which should improve perfomance. Both fixes by Peter Beernink.
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
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
if($_POST["commit"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
	if($_POST["username"] && $_POST["level"] && $_POST["fullname"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
		if(!isset($_POST["active"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
			$active = 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
			$active = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
		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
    18
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
			clean_page($BASE_URL . $BASE_PATH . "users.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
			error("Error editting user!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
if (!level(10))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
{
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    32
	error("You do not have the required access level.");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    35
    <h2><? echo _('Edit user'); ?> "<? echo get_fullname_from_userid($_GET["id"]) ?>"</h2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
$r = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
$r = get_user_info($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    40
    <form method="post">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    41
     <input type="HIDDEN" name="number" value="<? echo $_GET["id"] ?>">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    42
     <table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    43
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    44
       <td class="n"><? echo _('User name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    45
       <td class="n"><input type="text" class="input" name="username" value="<? echo $r["username"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    46
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    47
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    48
       <td class="n"><? echo _('Full name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    49
       <td class="n"><input type="text" class="input" name="fullname" value="<? echo $r["fullname"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    50
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    51
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    52
       <td class="n"><? echo _('Password'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    53
       <td class="n"><input type="text" class="input" name="password" value=""></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    54
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    55
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    56
       <td class="n"><? echo _('E-mail'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    57
       <td class="n"><input type="text" class="input" name="email" value="<? echo $r["email"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    58
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    59
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    60
       <td class="n"><? echo _('User level'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    61
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    62
        <select name="level">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    63
	 <option value="1" <? if($r["level"] == 1) { echo "selectED"; } ?>>1 (<? echo _('Normal user'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    64
	 <option value="5" <? if($r["level"] == 5) { echo "selectED"; } ?>>5 (<? echo _('Administrator'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    65
	 <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
    66
	</select>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    67
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    68
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    69
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    70
       <td class="n"><? echo _('Description'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    71
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    72
        <textarea rows="6" cols="30" class="inputarea" name="description"><? echo $r["description"]?></textarea>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    73
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    74
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    75
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    76
       <td class="n"><? echo _('Active'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    77
       <td class="n"><input type="checkbox" name="active" value="1" <? if($r["active"]) { ?>CHECKED<? } ?>></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    78
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    79
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    80
       <td class="n">&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    81
       <td class="n"><input type="submit" class="button" name="commit" value="<? echo _('Commit changes'); ?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    82
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    83
     </table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    84
    </form>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    87
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
?>