<file_sep><?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
    header("location: login.php");
    exit;
}

?>


<!doctype html>
<html>
<head>
    <style>
        .button3 {width: 80%;}
    
    </style>
<meta charset="utf-8">
<title>Golfzilla</title>
<link rel="stylesheet" href= "stylesheet.css">
</head>



<br><img src="golfzillalogo.png" alt="Logo"><br>
<br>
<br>
<h1>Welcome to Golfzilla!</h1> <br>
<input type = "submit" class="button button3" onclick="document.location = 'golfzilla2.php'" name = "start" value = "Start Round"></button><br>
<button class="button button3" onclick="document.location = 'pastscores.php'">View Past Scores</button>

   
    


<p>
        <button onclick="document.location = 'reset-password.php'">Reset Your Password</button>
        <button onclick="document.location = 'logout.php'">Sign Out of Your Account</button>
</p>
<div class="container">
    <p id="response"></p>
    
	
</div>



</body>
</html>
<?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "golfzilla";

    $conn = new mysqli($servername, $username, $password, $dbname);
    

    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    if(!isset($_GET["start"])){

        $sql = "INSERT INTO roundinfo(id, tdate) VALUES (1, NOW());";
          
      }

  $conn->close();    
    ?><file_sep><!doctype html>
<html>
<head>
    <style>
        .button3 {width: 80%;}
    </style>
<meta charset="utf-8">
<title>Golfzilla</title>
<link rel="stylesheet" href= "stylesheet.css">
</head>
<body> 



<img src="golfzillalogo.png" alt="Logo"><br>
<p>Welcome to Golfzilla!</p> 
<h2><label for="fname">Score:</label></h2>
<div class="container">

<form method = "GET" action = "golfzilla2.php" >
<p>
<input type = "submit"  name = "strokes" value = 1 id = 1></button>
<input type = "submit" name = "strokes" value = 2 id = 2></button>
<input type = "submit" name = "strokes" value = 3 id = 3></button>
<input type = "submit" name = "strokes" value = 4 id = 4></button>
<input type = "submit" name = "strokes" value = 5 id = 5></button>
<input type = "submit" name = "strokes" value = 6 id = 6></button>
<input type = "submit" name = "strokes" value = 7 id = 7></button>
<input type = "submit" name = "strokes" value = 8 id = 8></button>
<input type = "submit" name = "strokes" value = 9 id = 9></button>
<input type = "submit" name = "strokes" value = 10 id = 10></button>

</p>
</form>
</div>

<button class="button button3" onclick="document.location = 'endofround.php'">End Round</button>
<br>
<button class="button button3" onclick="document.location = 'golfzilla.php'">Go back to Home Page</button>
</body>
</html>

<?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "golfzilla";

    $conn = new mysqli($servername, $username, $password, $dbname);
    
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
$hole = 1;
if(!isset($_POST["strokes"])){
    $strokes = $_GET['strokes'];
    $sql = "INSERT INTO score(id, rid, strokes) VALUES (1,1, '$strokes');";
    
    if ($conn->query($sql)){
        echo "<p> Score Recorded </p>";
      } 
      
      
  }
  $conn->close();    
    ?>



<file_sep><?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
    header("location: login.php");
    exit;
}

?>


<!doctype html>
<html>
<head>
    <style>
        .button3 {width: 80%;}
    
    </style>
<meta charset="utf-8">
<title>Golfzilla</title>
<link rel="stylesheet" href= "stylesheet.css">
</head>



<br><img src="golfzillalogo.png" alt="Logo"><br>
<br>
<br>
<h1>Your Scorecard!</h1> <br>
<table>
  <tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    <th>4</th>
    <th>5</th>
    <th>6</th>
    <th>7</th>
    <th>8</th>
    <th>9</th>
    <th>10</th>
    <th>11</th>
    <th>12</th>
    <th>13</th>
    <th>14</th>
    <th>15</th>
    <th>16</th>
    <th>17</th>
    <th>18</th>
    
  </tr>
  <tr>
    <td>4</td>
    <td>4</td>
    <td>3</td>
    <td>5</td>
    <td>7</td>
    <td>3</td>
    <td>5</td>
    <td>4</td>
    <td>4</td>
    <td>5</td>
    <td>4</td>
    <td>3</td>
    <td>5</td>
    <td>6</td>
    <td>4</td>
    <td>5</td>
    <td>3</td>
    <td>4</td>
  </tr>
 
</table>
<br>

<button class="button button3" onclick="document.location = 'pastScores.php'">View Past Scores</button> <br>
<button class="button button3" onclick="document.location = 'golfzilla.php'">Go back to Home Page</button>
    
   
    


<p>
        <button onclick="document.location = 'logout.php'">Sign Out of Your Account</button>
</p>
<div class="container">
    <p id="response"></p>
    
	
</div>



</body>
</html>
<file_sep><!doctype html>
<html>
<head>
    <style>
        .button3 {width: 50%;}
    </style>
<meta charset="utf-8">
<title>Scores</title>
<link rel="stylesheet" href= "stylesheet.css">
</head>



<img src="golfzillalogo.png" alt="Logo"><br>
<p>Your Scores</p> <br>
<h3>2020-06-02</h3>
<table>
  <tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    <th>4</th>
    <th>5</th>
    <th>6</th>
    <th>7</th>
    <th>8</th>
    <th>9</th>
    <th>10</th>
    <th>11</th>
    <th>12</th>
    <th>13</th>
    <th>14</th>
    <th>15</th>
    <th>16</th>
    <th>17</th>
    <th>18</th>
    
  </tr>
  <tr>
    <td>5</td>
    <td>8</td>
    <td>3</td>
    <td>5</td>
    <td>7</td>
    <td>3</td>
    <td>4</td>
    <td>9</td>
    <td>4</td>
    <td>3</td>
    <td>4</td>
    <td>3</td>
    <td>5</td>
    <td>6</td>
    <td>4</td>
    <td>6</td>
    <td>4</td>
    <td>3</td>
  </tr>
 
</table>

</div>
<br>
<?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "golfzilla";

    $conn = new mysqli($servername, $username, $password, $dbname);

    // Check connection: No need for else.  It will quit if the connection thorws an error.
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
$sql = "SELECT * FROM scores";
$result = $conn->query($sql);
    if ($result->num_rows > 0){
        echo "<table><tr><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th> <th>10</th><th>11</th><th>12</th><th>13</th><th>14</th><th>15</th><th>16</th> <th>17</th><th>18</th></tr>";
        while($row = $result->fetch_assoc()) {
            echo "<tr><td>" .$row["strokes"];
        }
        echo "</table>";
    } else {
        echo "0 results";
    }
        
        $conn->close();
        ?>
    
   
    

    <button class="button button3" onclick="document.location = 'golfzilla.php'">Go back to Home Page</button>
<p>
        <button onclick="document.location = 'logout.php'">Sign Out of Your Account</button>
    </p>
<div class="container">
    <p id="response"></p>
    
	
</div>



</body>
</html>