#http://www.accounting-123.com/a.php?a=153/GPLv3 # # # # # # # # # # # require "settings.php"; //dont know why this is here ... just causes quick links not to work ... i_am_the_true_xml(); $OUTPUT = printUsers(); require "template.php"; function printUsers() { $OUTPUT = "\n\t\t<h3>View current users</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Username</th>\n\t\t\t\t<th>Employee</th>\n\t\t\t\t<th>Branch</th>\n\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t</tr>"; $sql = "SELECT username, div, empnum FROM cubit.users"; $user_rslt = db_exec($sql) or errDie("Unable to retrieve employee."); while ($row = pg_fetch_array($user_rslt)) { $sql = "SELECT enum, sname, fnames FROM cubit.employees\n\t\t\t\tWHERE empnum='{$row['empnum']}'"; $emp_rslt = db_exec($sql) or errDie("Unable to retrieve employee."); $emp_data = pg_fetch_array($emp_rslt); $employee = "{$emp_data['sname']} {$emp_data['fnames']} - {$emp_data['enum']}"; $bran = qryBranch($row["div"]); $OUTPUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$row['username']}</td>\n\t\t\t\t<td>{$employee}</td>\n\t\t\t\t<td>{$bran['branname']}</td>\n\t\t\t\t<td><a href='admin-usredit.php?username={$row['username']}'>Edit</a></td>\n\t\t\t\t<td><a href='admin-usrrem.php?username={$row['username']}'>Remove</a></td>\n\t\t\t</tr>"; } $OUTPUT .= "</table>";
} else { if (isset($msg)) { echo "<p class='message'>{$msg}</p>"; } else { ?> <section class="selector"> <ul> <li class="select" onclick='$("#listUser").slideToggle("normal")'> <input id="username" type="text" name="USERNAME" value="" placeholder="Select User" onfocus="this.blur()" readonly/> <span></span> </li> </ul> <ul class="list" id="listUser"> <?php printUsers("username", "listUser"); ?> </ul> </section> <div class="switch"> <p>Active:</p> <label class="on" for="checkActive" onclick="selectBtn(this)">YES</label> <input type="checkbox" name="ACTIVE" id="checkActive" checked> </div> <div class="switch"> <p>Admin:</p> <label class="off" for="checkAdmin" onclick="selectBtn(this)">NO</label> <input type="checkbox" name="ADMIN" id="checkAdmin"> </div> <p class="input button" id="moduser" onclick="submitForm(this)">MODIFY</p>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link rel="stylesheet" type="text/css" href="table.css"> </head> <body> <h3>Users:</h3> <table class='bordered'> <tr bgcolor='#cccccc'> <th>user_id</th> <th>mobile</th> <th>role_id</th> <th>name</th> <th>create_time</th> <th>update_time</th> <th>logout_time</th> <th>del</th> </tr> <?php printUsers(); ?> </table> </body> </html>
<?php include_once 'menu.php'; ?> <div id="main"> <div class="container"> <div class="news"> <div class="box"> <?php if ($data->userCan($_SESSION['privilegeid'], "editUsers")) { ?> <h1>Manage Users</h1> Here you can manage the users and promote them to admin and editors. <div class="userlist"> <?php printUsers($data->getUsers()); ?> </div> <?php } else { ?> <h1>You can't edit users</h1> <?php } ?> </div> </div> <div class="sidebar"> <?php include_once 'userbox.php'; ?>