Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>summary</title>
- <link href="stylesheet.css" rel="stylesheet" type="text/css">
- </head>
- <?php
- session_start();
- if (isset($_SESSION['UID']) != true){
- header("Location: logintesterv5.php");
- }
- ?>
- <body>
- <div id="header">
- <div class="login">
- <div class="sublogin">
- <form method = "post">
- <input type="submit" name = 'logout' value = "log out">
- </form>
- </div>
- </div>
- <div id="webname">Point hunting admin panel</div>
- </div>
- <div class="sideleft">
- <othercat>
- <p><a href="summaryv2.php"> SUMMARY</a> </p>
- </othercat>
- <ccategory>
- <p><a href="createteam.php">CREATE TEAMS</a></p>
- </ccategory>
- <othercat>
- <p><a href="calculator.php">CHANGE TEAMS</a></p>
- </othercat>
- <othercat>
- <p><a href="settings.php">ACCOUNT SETTINGS</a></p>
- </othercat>
- </div>
- <div class="maincontent">
- <div class="submain1">
- <p>
- <form method = "post" novalidate>
- How many teams do you want to make?<br>
- <select name="noOfTeams">
- <option value="">Select...</option>
- <option value=1>1</option>
- <option value=3>3</option>
- <option value=4>4</option>
- <option value=5>5</option>
- <option value=6>6</option>
- <option value=7>7</option>
- </select>
- </p>
- <p>
- How many checkpoints?<br>
- <select name="noOfCp">
- <option value="">Select...</option>
- <option value=1>1</option>
- <option value=3>3</option>
- <option value=4>4</option>
- <option value=5>5</option>
- <option value=6>6</option>
- <option value=7>7</option>
- <option value=8>8</option>
- <option value=9>9</option>
- </select>
- <br>
- <br>
- <br>
- <input type="submit" name = 'create' value = "Create teams">
- </form>
- </p>
- <?php
- function randomString($length) {
- $str = "";
- $characters = array_merge(range('0','9'));
- $max = count($characters) - 1;
- for ($i = 0; $i < $length; $i++) {
- $rand = mt_rand(0, $max);
- $str .= $characters[$rand];
- }
- return $str;
- }
- if(isset($_POST['create']))
- {
- $numberOfTeams = strip_tags($_POST['noOfTeams']);
- $numberOfCheckpoints = strip_tags($_POST['noOfCp']);
- if ($numberOfTeams != "" and $numberOfCheckpoints != "") {
- $servername = "127.0.0.1";
- $username = "root";
- $password = "";
- $dbname = "pf";
- $conn = new mysqli($servername, $username, $password, $dbname);
- echo "<br>";
- foreach(range(1,$numberOfTeams) as $i) {
- $ID = randomString(4);
- $sql = "INSERT INTO teams (teamID)
- VALUES ('$ID')";
- mysqli_query($conn, $sql);
- foreach(range(1,$numberOfCheckpoints) as $i) {
- $cpid = rand(1,9);
- $sql = "INSERT INTO timerecords (teamID, checkpointID)
- VALUES ('$ID','$cpid')";
- mysqli_query($conn, $sql);
- }
- }
- echo $numberOfTeams, " teams were created!";
- }else {
- echo "You need to make all the required choices!";
- }
- }
- ?>
- </div>
- <div class="submain2">
- <p>
- <?php
- $servername = "127.0.0.1";
- $username = "root";
- $password = "";
- $dbname = "pf";
- $conn = new mysqli($servername, $username, $password, $dbname);
- $counter = 1;
- $not = mysqli_query($conn,"SELECT teamID FROM teams WHERE name IS NULL");
- if (mysqli_num_rows($not) > 1) {
- echo "Players in teams<br><br>";
- foreach ($not as $tid) {
- $localteamid = $tid['teamID'];
- $nop = mysqli_query($conn,"SELECT teamID FROM teams WHERE teamID='$localteamid'");
- echo "Team number ", $counter, "<br>";
- echo "Players: ", mysqli_num_rows($nop)-1,"<br>";
- $counter ++;
- }
- } else{
- echo "There aren't any teams yet!";
- }
- ?>
- </p>
- </div>
- <div class="submain3">
- <p>abb</p>
- </div>
- <div class="submain4">
- <p>Select a team to inspect:<br><p>
- <form>
- <?php
- echo "<select name='teamToInspect'>";
- echo '<option value="">Select...</option>';
- for ($i = 1; $i <= mysqli_num_rows($not); $i++) {
- echo "<option value=$i>$i</option>";
- }
- echo "</select>";
- echo "</form>";
- echo '<input type="submit" name = "inspect" value = "inspect">';
- if(isset($_POST["inspect"])) {
- echo "test";
- /*
- $tts = strip_tags($_POST['teamToInspect']);
- echo "<p> benis";
- echo $tts;
- echo "</p>";
- */
- }
- echo "benis";
- ?>
- <?php
- ?>
- </div>
- </div>
- </body>
- </html>
- <?php
- session_start();
- if(isset($_POST['logout'])){
- header("Location: logout.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement