Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  1. <?php
  2. // Create connection
  3. $conn = new mysqli("localhost", "root", "", "enohub");
  4.  
  5. // Check connection
  6. if ($conn->connect_error) {
  7. die("Connection failed: " . $conn->connect_error);
  8. }
  9.  
  10. $stmt = $conn->prepare("SELECT is_full FROM info");
  11. $stmt->execute();
  12. $res = $stmt->get_result();
  13. $row = $res->fetch_assoc();
  14.  
  15. if($row['is_full'] == 0) {
  16. echo "Certs got room";
  17. } else {
  18. echo "Certs be full";
  19. }
  20.  
  21. $stmt->close();
  22. ?>
  23. <!DOCTYPE html>
  24. <html>
  25. <title>Admin</title>
  26. <link rel="stylesheet" href="css/main.css">
  27. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  28. <head>
  29. <style>
  30.  
  31. body{
  32. font-family:helvetica;
  33. }
  34.  
  35. @media (prefers-color-scheme: dark) {
  36.  
  37. body{
  38. background-color:#000;
  39. color:#fff;
  40. }
  41.  
  42. p{
  43. color:#fff;
  44. }
  45.  
  46. .card-block{
  47. background-color:#0f0f0f;
  48. box-shadow:none;
  49. }
  50.  
  51. .top{
  52. box-shadow:none;
  53. }
  54.  
  55. .contact-form{
  56. background-color:#111;
  57. padding:20px;
  58. width:90%;
  59. margin:10px;
  60. border-radius:10px;
  61. box-shadow:none;
  62. }
  63.  
  64. .contact-form h1{
  65. font-size:30px;
  66. color:#fff;
  67. }
  68.  
  69. .contact-form input{
  70. max-width:300px;
  71. display:block;
  72. padding:10px;
  73. border-radius:10px;
  74. margin:10px;
  75. border:none;
  76. background-color:#222;
  77. color:#fff;
  78. width:90%;
  79. }
  80.  
  81. .contact-form textarea{
  82. padding:10px;
  83. border-radius:20px;
  84. max-width:300px;
  85. border:none;
  86. background-color:#222;
  87. color:#fff;
  88. width:90%;
  89. }
  90.  
  91. }
  92.  
  93. </style>
  94. </head>
  95. <body>
  96. <center>
  97. <form class="contact-form" action="dashboard_handler.php" method="post" enctype="multipart/form-data">
  98. <input type="file" name="ipa_zip">
  99. <select style="max-width:300px;display:block;padding:10px;border-radius:10px;margin:10px;border:none;background-color:#222;color:#fff;width:90%;" id="group-number" name="group">
  100. <?php
  101. $groups = 0;
  102.  
  103. while (true) {
  104. if(!$stmt = $conn->prepare("SELECT * FROM group" . $groups)) {
  105. break;
  106. } else {
  107. echo "<option value='" . $groups . "'>Group " . $groups . "</option>";
  108.  
  109. $groups++;
  110. }
  111. }
  112. ?>
  113. </select>
  114. <br>
  115. <br>
  116. <button style="padding:10px;border-radius:30px;width:90%;max-width:300px;border:none;color:#fff;background-color:#303066;" type="submit" name="submit_ipa_zip">Submit</button>
  117. </form>
  118. <form class="contact-form" action="dashboard_handler.php" method="post" enctype="multipart/form-data">
  119. <input type="file" name="config">
  120. <button style="padding:10px;border-radius:30px;width:90%;max-width:300px;border:none;color:#fff;background-color:#303066;" type="submit" name="submit_config">Submit</button>
  121. </form>
  122. <form class="contact-form" action="dashboard_handler.php" method="post">
  123. <button style="padding:10px;border-radius:30px;width:90%;max-width:300px;border:none;color:#fff;background-color:#303066;" type="submit" name="new_group">Add a new cert Group</button>
  124. </form>
  125. <br>
  126. <h1>Certficiate Groups</h1>
  127. <table>
  128. <tr>
  129. <th>Group</th>
  130. <th>Number Of Users</th>
  131. </tr>
  132. <?php
  133. $groups = 0;
  134.  
  135. while (true) {
  136. if(!$stmt = $conn->prepare("SELECT COUNT(*) FROM group" . $groups)) {
  137. break;
  138. } else {
  139. $stmt = $conn->prepare("SELECT COUNT(*) FROM group" . $groups);
  140. $stmt->execute();
  141. $res = $stmt->get_result();
  142. $row = $res->fetch_assoc();
  143.  
  144. echo "<tr>
  145. <td>Group " . $groups . "</td>
  146. <td>" . $row['COUNT(*)'] . "</td>
  147. </tr>";
  148.  
  149. $stmt->close();
  150.  
  151. $groups++;
  152. }
  153. }
  154. ?>
  155. </table>
  156. <br>
  157. <h1>UUIDs to Add</h1>
  158. <table>
  159. <tr>
  160. <th>Username</th>
  161. <th>UUID</th>
  162. <th>Group</th>
  163. <th>Status Change</th>
  164. </tr>
  165. <?php
  166. $groups = 0;
  167.  
  168. while (true) {
  169. if(!$stmt = $conn->prepare("SELECT username, uuid, group_num FROM group" . $groups . " WHERE status='0'")) {
  170. break;
  171. } else {
  172. $stmt = $conn->prepare("SELECT username, uuid, group_num FROM group" . $groups . " WHERE status='0'");
  173. $stmt->execute();
  174. $res = $stmt->get_result();
  175.  
  176. while ($row = $res->fetch_assoc()) {
  177. echo "<tr>
  178. <td>" . $row['username'] . "</td>
  179. <td>" . $row['uuid'] . "</td>
  180. <td>" . $row['group_num'] . "</td>
  181. <td><form class="contact-form" action=\"dashboard_handler.php\" method=\"post\">
  182. <input type=\"hidden\" name=\"username_pointer\" value=" . $row['username'] . ">
  183. <input type=\"hidden\" name=\"group_pointer\" value=" . $row['group_num'] . ">
  184. <button style="padding:10px;border-radius:30px;width:90%;max-width:300px;border:none;color:#fff;background-color:#303066;" type=\"submit\" name=\"status_change\">Done!</button>
  185. <br>
  186. <br>
  187. <button style="padding:10px;border-radius:30px;width:90%;max-width:300px;border:none;color:#fff;background-color:#303066;" type=\"submit\" name=\"bad_uuid\">Bad UUID!</button>
  188. </form></td>
  189. </tr>";
  190. }
  191.  
  192. $stmt->close();
  193.  
  194. $groups++;
  195. }
  196. }
  197. ?>
  198. </table>
  199. </center>
  200. </body>
  201. <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  202. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  203. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  204. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement