]>
git.datanom.net - webcal.git/blob - utils/users.php
3 require_once 'config.inc.php';
4 require_once 'user_validate.php';
5 require_once 'helper.php';
9 if (! defined($_SESSION['__ROOT__']) && empty($_SESSION['__ROOT__'])) {
12 header('Location: ' . WEB_ROOT
. 'error.html');
16 if (! has_admin_role()) {
19 header('Location: ' . WEB_ROOT
. 'error.html');
23 require_once 'persistens.php';
25 include TOP_FOLDER
.'/include/header.inc.php';
26 include TOP_FOLDER
.'/include/menu.inc.php';
27 $self =$_SERVER['PHP_SELF'];
28 $db = Persistens
::getInstance(DBDRIVER
);
30 if (count($_POST) > 0 && isset($_POST['action'])) {
32 $action = strtolower($_POST['action']);
36 if (isset($_POST['uid']) && ! empty($_POST['uid'])) {
37 foreach ($_POST['uid'] as $uid) {
38 $result = $db->deleteUser($uid);
39 if ($result !== TRUE) {
40 $error .= "$result<br/>";
45 $error = 'No user selected for deletion';
47 $result = "Users was succesfully delete";
51 case 'reset password':
54 if (isset($_POST['uid']) && ! empty($_POST['uid'])) {
55 foreach ($_POST['uid'] as $uid) {
56 $pwd = substr(md5($_POST['uid'] . microtime()), 0, 8);
57 $result = $db->changePassword($uid, sha1($pwd));
59 $res .= $_POST['uid'] .": No change<br/>";
61 $res .= $uid .": $pwd<br/>";
65 $error = 'No user selected for resetting password';
72 $result = "$action: Unknown action";
76 <p style="text-align: center">
83 <form action
="$self" method
="post" id
="form">
85 <table
class="config">
87 <td colspan
="3" style
="text-align: center;
88 font-weight: bold;font-size: 2.0em;">
93 <th
>Username
</th
><th
>Role
</th
><th
> 
;</th
>
96 $users = $db->getAllUsers();
97 foreach ($users as $user) {
98 if (strtoupper($user['uid']) == 'ADMIN') {
99 $pageView .= "<tr><td>{$user['uid']}</td><td>{$user['userrole']}</td>
104 $pageView .= "<tr><td>{$user['uid']}</td><td>{$user['userrole']}</td>
105 <td style=\"text-align: center\"><input type=\"checkbox\" name=\"uid[]\"
106 value=\"{$user['uid']}\"/></td></tr>";
109 $pageView .= '<tr><td class="config" colspan="3" style="text-align: center">
110 <input type="submit" name="action" value="Delete"/>
111 <input type="button" value="New user"
112 onclick="document.location.href=\'newuser.php\'" />
113 <input type="submit" name="action" value="Reset password" />
114 </td></tr></table></p></form>';
117 print "<div id=\"ui\">$pageView</div>";
119 include TOP_FOLDER
.'/include/footer.inc.php';
This page took 0.075663 seconds and 6 git commands to generate.