Advertisement
Guest User

Untitled

a guest
May 4th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. <?php include $_SERVER["DOCUMENT_ROOT"] . '/includes/config.php'; ?>
  2. <script type="text/javascript" src="/includes/jquery/js/jquery.users.js"></script>
  3. <?php if ($_SESSION['level'] == 9) {
  4. echo <<< EOD
  5. <div class="hcenter">
  6. <button id="newUser" class="ui-state-default ui-corner-all">Create New User</button>
  7. </div>
  8. EOD;
  9. }?>
  10. <br />
  11. <table id="userTable" class="hcenter no-center-text ui-state-default ui-corner-all">
  12. <tr class="hcenter">
  13. <th>First Name</th>
  14. <th>Last Name</th>
  15. <th>Username</th>
  16. <th>Email</th>
  17. <th>Branch</th>
  18. <th>Status</th>
  19. <th>Level</th>
  20. </tr>
  21. <?php
  22. $prefix = $sql->tblPrefix();
  23. $query = "Select * from " . $prefix . "users";
  24.  
  25. $users = $sql->sqlQuery($query);
  26. $rows = $sql->sqlRows($users);
  27.  
  28. for ($i=0; $i<$rows; $i++) {
  29. $branchQuery = "Select City from " . $prefix . "branches where id='" . $sql->sqlResult($users,$i,'Branch') . "';";
  30. $branchResult = $sql->sqlQuery($branchQuery);
  31. $branch = $sql->sqlResult($branchResult,0,'City');
  32.  
  33. if ($sql->sqlResult($users,$i,'Enabled')) {
  34. $status = "Enabled";
  35. } else {
  36. $status = "Disabled";
  37. };
  38.  
  39. echo "<tr class='";
  40.  
  41. if ($i%2) {
  42. echo "odd'>\n";
  43. } else {
  44. echo "even'>\n";
  45. };
  46.  
  47. echo "<td>" . $sql->sqlResult($users,$i,'FirstName') . "</td>\n";
  48. echo "<td>" . $sql->sqlResult($users,$i,'LastName') . "</td>\n";
  49. echo "<td>" . $sql->sqlResult($users,$i,'Username') . "</td>\n";
  50. echo "<td>" . $sql->sqlResult($users,$i,'Email') . "</td>\n";
  51. echo "<td>" . $branch . "</td>\n";
  52. echo "<td>" . $status . "</td>\n";
  53. echo "<td>" . $sql->sqlResult($users,$i,'AccessLevel') . "</td>\n";
  54. echo "</tr>\n";
  55. };
  56. ?>
  57. </table>
  58.  
  59. <div id="addUserDiv" title="Add User" class="ui-state-default">
  60. <form id="addUserForm" name="addUserForm" method="post" action="includes/php/process.php">
  61. <fieldset>
  62. <input type="hidden" name="formID" value="addUser">
  63. <label for="firstname" class="ui-label">First Name:</label>
  64. <input type="text" id="firstname" name="firstname" />
  65. <br />
  66.  
  67. <label for="password" class="ui-label">Last Name:</label>
  68. <input type="text" id="lastname" name="lastname" />
  69. <br />
  70.  
  71. <label for="username" class="ui-label">Username:</label>
  72. <input type="text" id="username" name="username" />
  73. <br />
  74.  
  75. <label for="email" class="ui-label">Email Address:</label>
  76. <input type="text" id="email" name="email" />
  77. <br />
  78.  
  79. <label for="password" class="ui-label">Password:</label>
  80. <input type="text" id="password" name="password" />
  81. <br />
  82.  
  83. <label for="branch" class="ui-label">Branch:</label>
  84. <select name="branch" id="branch">
  85. <?php
  86. //this will populate the branch selector with info from the branch table
  87. $branchQuery = "select id,city from " . $prefix . "branches;";
  88. $branchResult = $sql->sqlQuery($branchQuery);
  89. $branchRows = $sql->sqlRows($branchResult);
  90.  
  91. for ($i=0; $i<$branchRows; $i++) {
  92. $id=$sql->sqlResult($branchResult, $i, 'id');
  93. $city=$sql->sqlResult($branchResult, $i, 'city');
  94. echo "<option value=\"" . $id . "\">" . $city . "</option>\n";
  95. };
  96. ?>
  97. </select>
  98. <br />
  99.  
  100. <label for="enabled">Status:</label>
  101. <select name="enabled" id="enabled">
  102. <option value="1">Enabled</option>
  103. <option value="0">Disabled</option>
  104. </select>
  105. <br />
  106.  
  107. <label for="accessLevel" class="ui-label">Access Level</label>
  108. <select name="accessLevel" id="accessLevel">
  109. <option value="3">Standard User</option>
  110. <option value="9">Full Admin</option>
  111. </select>
  112. </fieldset>
  113. </form>
  114. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement