<?php
// Author: Sergi Diaz Planas

session_start();
if(!isset($_SESSION['username'])) {	
	// To main if not logged
	header("Location: ./../index.php");
	exit;
}
?>

<html lang="en">
<head>
  <title>WebFace - Register with your webcam!</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Import Bootstrap and jQuery -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <!-- Link client styles -->
  <link rel="stylesheet" href="./../styles/client.css">
  <!-- Utilities scripts -->
  <script src="./../scripts/camera.js"></script>
  <script src="./../scripts/network.js"></script>
</head>
<body>
	<div class="jumbotron text-center">
	<h1>WebFace</h1>
	<p>An easy way to make a register</p> 
	</div>
	
	<div class="container">
		<div class="row">
            <button id="logout">Log out</button> 
        </div>
		<div class="row">
			<h2>Welcome!</h2>
			<canvas width="600" height="416"></canvas>
		</div>
	</div>

	<div class="jumbotron text-center footer">
	<p>WebFace 2017 - Sergi Diaz Planas</p> 
	</div>
</body>

<script>
// Call after DOM has been loaded
$('document').ready( function() 
{
    var logout = document.getElementById("logout");
    logout.onclick = function()
    {
        // Go to register page on click
        window.location.href = "./../php/logout.php";
    }

});  
</script>
</html>