users.php
changeset 2 9a485c41cfcf
parent 1 58094faf794d
child 3 64525a2eb098
equal deleted inserted replaced
1:58094faf794d 2:9a485c41cfcf
    31 		add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]);
    31 		add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]);
    32         	clean_page($BASE_URL . $BASE_PATH . "users.php");
    32         	clean_page($BASE_URL . $BASE_PATH . "users.php");
    33         }
    33         }
    34         else
    34         else
    35         {
    35         {
    36         	$error = "Usernames cant contain spaces";
    36         	$error = _('Usernames cant contain spaces');
    37         }
    37         }
    38 }
    38 }
    39 elseif($_POST["submit"])
    39 elseif($_POST["submit"])
    40 {
    40 {
    41 	$error = "Please fill in all fields";
    41 	$error = _('Please fill in all fields');
    42 }
    42 }
    43 
    43 
    44 // Dirty hack, maybe revise?
    44 // Dirty hack, maybe revise?
    45 include_once("inc/header.inc.php");
    45 include_once("inc/header.inc.php");
    46 ?>
    46 ?>
    47 <H2>User Admin</H2>
    47 <H2><? echo _('User Admin'); ?></H2>
    48 <P CLASS="nav">
    48 <P CLASS="nav">
    49 <A HREF="index.php">DNS Admin</A>
    49 <A HREF="index.php"><? echo _('DNS Admin'); ?></A>
    50 <?
    50 <?
    51 if (level(10))
    51 if (level(10))
    52 {
    52 {
    53 	?> <A HREF="seq_update.php">Synchronize Database</A> <?
    53 	?> <A HREF="seq_update.php"><? echo _('Synchronize Database'); ?></A> <?
    54 }
    54 }
    55 ?><A HREF="search.php">Search records</A></P><BR><?
    55 ?><A HREF="search.php"><? echo _('Search records'); ?></A></P><BR><?
    56 // End
    56 // End
    57 
    57 
    58 if (!level(10)) 
    58 if (!level(10)) 
    59 {
    59 {
    60 	error(ERR_LEVEL_10);
    60 	error(ERR_LEVEL_10);
    61 }
    61 }
    62 
    62 
    63 if ($error != "") 
    63 if ($error != "") 
    64 {
    64 {
    65         ?><H3><FONT COLOR="red">Error: <?= $error ?></FONT></H3><?
    65         ?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><?
    66 }
    66 }
    67 
    67 
    68 echo "<B>Current users (click to edit):</B>";
    68 echo "<B>" . _('Current users (click to edit)') . ":</B>";
    69 
    69 
    70 $users = show_users('');
    70 $users = show_users('');
    71 
    71 
    72 echo "<br /><br /><small><b>Number of users:</b> ".count($users);
    72 echo "<br /><br /><small><b>" . _('Number of users') . ":</b> ".count($users);
    73 
    73 
    74 show_pages(count($users),ROWAMOUNT);
    74 show_pages(count($users),ROWAMOUNT);
    75 ?>
    75 ?>
    76 
    76 
    77 <br /><br /><TABLE BORDER="0" CELLSPACING="4">
    77 <br /><br /><TABLE BORDER="0" CELLSPACING="4">
    78 <TR STYLE="font-weight: Bold;"><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg">Name</TD><TD CLASS="tdbg">Domains</TD><TD CLASS="tdbg">Domain list</TD><TD CLASS="tdbg">Level</TD><TD CLASS="tdbg">Status</TD></TR>
    78 <TR STYLE="font-weight: Bold;"><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg"><? echo _('Name'); ?></TD><TD CLASS="tdbg"><? echo _('Domains'); ?></TD><TD CLASS="tdbg"><? echo _('Domain list'); ?></TD><TD CLASS="tdbg"><? echo _('Level'); ?></TD><TD CLASS="tdbg"><? echo _('Status'); ?></TD></TR>
    79 <?
    79 <?
    80 $users = show_users('',ROWSTART,ROWAMOUNT);
    80 $users = show_users('',ROWSTART,ROWAMOUNT);
    81 foreach ($users as $c)
    81 foreach ($users as $c)
    82 {
    82 {
    83         ?>
    83         ?>
    84         <TR>
    84         <TR>
    85         <TD VALIGN="top" CLASS="tdbg"><A HREF="delete_user.php?id=<?= $c["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ delete user ]" BORDER="0"></A></TD>
    85         <TD VALIGN="top" CLASS="tdbg"><A HREF="delete_user.php?id=<?= $c["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('delete user'); ?> ]" BORDER="0"></A></TD>
    86         <TD VALIGN="top" CLASS="tdbg"><A HREF="edit_user.php?id=<?= $c["id"] ?>"><?= $c["fullname"] ?></A> (<?= $c["username"] ?>)</TD>
    86         <TD VALIGN="top" CLASS="tdbg"><A HREF="edit_user.php?id=<?= $c["id"] ?>"><?= $c["fullname"] ?></A> (<?= $c["username"] ?>)</TD>
    87         <TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD>
    87         <TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD>
    88         <TD CLASS="tdbg">
    88         <TD CLASS="tdbg">
    89         <?
    89         <?
    90         $domains = get_domains_from_userid($c["id"]);
    90         $domains = get_domains_from_userid($c["id"]);
    91         foreach ($domains as $d)
    91         foreach ($domains as $d)
    92         {
    92         {
    93                 ?><A HREF="delete_domain.php?id=<?= $d["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ delete domain ]" BORDER="0"></A>&nbsp;<A HREF="edit.php?id=<?= $d["id"] ?>"><?= $d["name"] ?></A><BR><?
    93                 ?><A HREF="delete_domain.php?id=<?= $d["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('delete domain'); ?> ]" BORDER="0"></A>&nbsp;<A HREF="edit.php?id=<?= $d["id"] ?>"><?= $d["name"] ?></A><BR><?
    94         }
    94         }
    95         ?></TD><TD CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="middle" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><?
    95         ?></TD><TD CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="middle" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><?
    96         print "\n";
    96         print "\n";
    97 }
    97 }
    98 ?>
    98 ?>
    99 </TABLE>
    99 </TABLE>
   100 <BR><BR>
   100 <BR><BR>
   101 
   101 
   102 <FORM METHOD="post" action="users.php">
   102 <FORM METHOD="post" action="users.php">
   103 <B>Create new user:</B><BR>
   103 <B><? echo _('Create new user'); ?>:</B><BR>
   104 <TABLE BORDER="0" CELLSPACING="4">
   104 <TABLE BORDER="0" CELLSPACING="4">
   105 <TR><TD CLASS="tdbg">User name:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="username" VALUE="<? if ($error) print $_POST["username"]; ?>"></TD></TR>
   105 <TR><TD CLASS="tdbg"><? echo _('User name'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="username" VALUE="<? if ($error) print $_POST["username"]; ?>"></TD></TR>
   106 <TR><TD CLASS="tdbg">Full name:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="fullname" VALUE="<? if ($error) print $_POST["fullname"]; ?>"></TD></TR>
   106 <TR><TD CLASS="tdbg"><? echo _('Full name'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="fullname" VALUE="<? if ($error) print $_POST["fullname"]; ?>"></TD></TR>
   107 <TR><TD CLASS="tdbg">Password:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="password" VALUE="<? if ($error) print $_POST["password"]; ?>"></TD></TR>
   107 <TR><TD CLASS="tdbg"><? echo _('Password'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="password" VALUE="<? if ($error) print $_POST["password"]; ?>"></TD></TR>
   108 <TR><TD CLASS="tdbg">E-mail:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="email" VALUE="<? if ($error) print $_POST["email"]; ?>"></TD></TR>
   108 <TR><TD CLASS="tdbg"><? echo _('E-mail'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="email" VALUE="<? if ($error) print $_POST["email"]; ?>"></TD></TR>
   109 <TR><TD CLASS="tdbg">User level:</TD><TD CLASS="tdbg"><SELECT NAME="level"><OPTION VALUE="1">1 (<?= leveldescription(1) ?>)</OPTION><OPTION VALUE="5">5 (<?= leveldescription(5) ?>)</OPTION><OPTION VALUE="10">10 (<?= leveldescription(10) ?>)</OPTION></SELECT></TD></TR>
   109 <TR><TD CLASS="tdbg"><? echo _('User level'); ?>:</TD><TD CLASS="tdbg"><SELECT NAME="level"><OPTION VALUE="1">1 (<?= leveldescription(1) ?>)</OPTION><OPTION VALUE="5">5 (<?= leveldescription(5) ?>)</OPTION><OPTION VALUE="10">10 (<?= leveldescription(10) ?>)</OPTION></SELECT></TD></TR>
   110 <TR><TD CLASS="tdbg">Description:</TD><TD CLASS="tdbg"><TEXTAREA ROWS="6" COLS="30" CLASS="inputarea" NAME="description"><? if ($error) print $_POST["description"]; ?></TEXTAREA></TD></TR>
   110 <TR><TD CLASS="tdbg"><? echo _('Description'); ?>:</TD><TD CLASS="tdbg"><TEXTAREA ROWS="6" COLS="30" CLASS="inputarea" NAME="description"><? if ($error) print $_POST["description"]; ?></TEXTAREA></TD></TR>
   111 <TR><TD CLASS="tdbg">Active:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="active" VALUE="1" CHECKED></TD></TR>
   111 <TR><TD CLASS="tdbg"><? echo _('Active'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="active" VALUE="1" CHECKED></TD></TR>
   112 <TR><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="Add user"></TD></TR>
   112 <TR><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="<? echo _('Add user'); ?>"></TD></TR>
   113 </TABLE>
   113 </TABLE>
   114 </FORM>
   114 </FORM>
   115 <?
   115 <?
   116 include_once("inc/footer.inc.php");
   116 include_once("inc/footer.inc.php");
   117 ?>
   117 ?>