Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>summary</title>
  6. <link href="stylesheet.css" rel="stylesheet" type="text/css">
  7. </head>
  8.  
  9.  
  10. <?php
  11.  
  12. session_start();
  13.  
  14. if (isset($_SESSION['UID']) != true){
  15. header("Location: logintesterv5.php");
  16. }
  17.  
  18. ?>
  19.  
  20. <body>
  21. <div id="header">
  22. <div class="login">
  23. <div class="sublogin">
  24. <form method = "post">
  25. <input type="submit" name = 'logout' value = "log out">
  26. </form>
  27. </div>
  28. </div>
  29. <div id="webname">Point hunting admin panel</div>
  30. </div>
  31. <div class="sideleft">
  32.  
  33. <othercat>
  34. <p><a href="summaryv2.php"> SUMMARY</a> </p>
  35. </othercat>
  36.  
  37. <ccategory>
  38. <p><a href="createteam.php">CREATE TEAMS</a></p>
  39. </ccategory>
  40.  
  41. <othercat>
  42. <p><a href="calculator.php">CHANGE TEAMS</a></p>
  43. </othercat>
  44.  
  45. <othercat>
  46. <p><a href="settings.php">ACCOUNT SETTINGS</a></p>
  47. </othercat>
  48.  
  49. </div>
  50.  
  51.  
  52. <div class="maincontent">
  53. <div class="submain1">
  54. <p>
  55. <form method = "post" novalidate>
  56. How many teams do you want to make?<br>
  57. <select name="noOfTeams">
  58. <option value="">Select...</option>
  59. <option value=1>1</option>
  60. <option value=3>3</option>
  61. <option value=4>4</option>
  62. <option value=5>5</option>
  63. <option value=6>6</option>
  64. <option value=7>7</option>
  65. </select>
  66. </p>
  67.  
  68. <p>
  69. How many checkpoints?<br>
  70. <select name="noOfCp">
  71. <option value="">Select...</option>
  72. <option value=1>1</option>
  73. <option value=3>3</option>
  74. <option value=4>4</option>
  75. <option value=5>5</option>
  76. <option value=6>6</option>
  77. <option value=7>7</option>
  78. <option value=8>8</option>
  79. <option value=9>9</option>
  80. </select>
  81. <br>
  82. <br>
  83. <br>
  84.  
  85.  
  86. <input type="submit" name = 'create' value = "Create teams">
  87. </form>
  88. </p>
  89. <?php
  90.  
  91. function randomString($length) {
  92. $str = "";
  93. $characters = array_merge(range('0','9'));
  94. $max = count($characters) - 1;
  95. for ($i = 0; $i < $length; $i++) {
  96. $rand = mt_rand(0, $max);
  97. $str .= $characters[$rand];
  98. }
  99. return $str;
  100. }
  101.  
  102.  
  103. if(isset($_POST['create']))
  104. {
  105. $numberOfTeams = strip_tags($_POST['noOfTeams']);
  106. $numberOfCheckpoints = strip_tags($_POST['noOfCp']);
  107.  
  108. if ($numberOfTeams != "" and $numberOfCheckpoints != "") {
  109. $servername = "127.0.0.1";
  110. $username = "root";
  111. $password = "";
  112. $dbname = "pf";
  113. $conn = new mysqli($servername, $username, $password, $dbname);
  114.  
  115.  
  116. echo "<br>";
  117. foreach(range(1,$numberOfTeams) as $i) {
  118. $ID = randomString(4);
  119. $sql = "INSERT INTO teams (teamID)
  120. VALUES ('$ID')";
  121. mysqli_query($conn, $sql);
  122. foreach(range(1,$numberOfCheckpoints) as $i) {
  123. $cpid = rand(1,9);
  124. $sql = "INSERT INTO timerecords (teamID, checkpointID)
  125. VALUES ('$ID','$cpid')";
  126. mysqli_query($conn, $sql);
  127. }
  128. }
  129. echo $numberOfTeams, " teams were created!";
  130. }else {
  131. echo "You need to make all the required choices!";
  132. }
  133.  
  134. }
  135.  
  136. ?>
  137.  
  138.  
  139. </div>
  140.  
  141. <div class="submain2">
  142. <p>
  143. <?php
  144. $servername = "127.0.0.1";
  145. $username = "root";
  146. $password = "";
  147. $dbname = "pf";
  148. $conn = new mysqli($servername, $username, $password, $dbname);
  149. $counter = 1;
  150. $not = mysqli_query($conn,"SELECT teamID FROM teams WHERE name IS NULL");
  151. if (mysqli_num_rows($not) > 1) {
  152. echo "Players in teams<br><br>";
  153. foreach ($not as $tid) {
  154. $localteamid = $tid['teamID'];
  155.  
  156. $nop = mysqli_query($conn,"SELECT teamID FROM teams WHERE teamID='$localteamid'");
  157. echo "Team number ", $counter, "<br>";
  158. echo "Players: ", mysqli_num_rows($nop)-1,"<br>";
  159. $counter ++;
  160.  
  161. }
  162. } else{
  163. echo "There aren't any teams yet!";
  164. }
  165. ?>
  166. </p>
  167. </div>
  168.  
  169. <div class="submain3">
  170. <p>abb</p>
  171. </div>
  172.  
  173. <div class="submain4">
  174. <p>Select a team to inspect:<br><p>
  175. <form>
  176. <?php
  177. echo "<select name='teamToInspect'>";
  178.  
  179.  
  180. echo '<option value="">Select...</option>';
  181. for ($i = 1; $i <= mysqli_num_rows($not); $i++) {
  182. echo "<option value=$i>$i</option>";
  183.  
  184. }
  185. echo "</select>";
  186. echo "</form>";
  187.  
  188. echo '<input type="submit" name = "inspect" value = "inspect">';
  189.  
  190.  
  191.  
  192.  
  193. if(isset($_POST["inspect"])) {
  194. echo "test";
  195. /*
  196. $tts = strip_tags($_POST['teamToInspect']);
  197. echo "<p> benis";
  198. echo $tts;
  199. echo "</p>";
  200. */
  201. }
  202. echo "benis";
  203. ?>
  204.  
  205.  
  206.  
  207.  
  208. <?php
  209.  
  210.  
  211.  
  212. ?>
  213. </div>
  214.  
  215. </div>
  216. </body>
  217. </html>
  218.  
  219. <?php
  220.  
  221. session_start();
  222. if(isset($_POST['logout'])){
  223. header("Location: logout.php");
  224. }
  225.  
  226.  
  227.  
  228.  
  229.  
  230. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement