<?php
/*
	ini_set('display_errors',1);
	ini_set('display_startup_errors',1);
	error_reporting(-1);
*/
	include("connect.php");
	include("dbfuncs.php");
	$v = leastNum();


	if (isset($_SESSION["uid"])) {
		if (isset($_SESSION["survey"])) {
			if ($_SESSION["survey"] == 1) {
				$_SESSION["survey"] = 2;
				$query = "UPDATE userinfo SET appNum = ? WHERE userid = ?";
				$stmt = $mysqli->prepare($query);
				$stmt->bind_param('is', $v, $_SESSION["uid"]);
				$stmt->execute();
			}
			if (isset($_SESSION["appnum"])) {
				$v = $_SESSION["appnum"];
			}
			else {
				$_SESSION["appnum"] = $v;
			}
		}
		else {
			header("Location: http://serv.cusp.nyu.edu/projects/soundtagging/index.php");
			die();
		}
	}
	else {
		header("Location: http://serv.cusp.nyu.edu/projects/soundtagging/index.php");
		die();
	}
?>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Urban Soundtagging</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
   <div class="container">
      <div class="starter-template section1">
        <div id="3" class="steps">
        <h2>Thank You!</h2>
        <p>Thank you for completing the preliminary procedures! You will now be redirected to CrowdCrafting, where the audio tagging will take place.</p>
       
        <button class="btn btn-default btn-lg" id="continue" onclick="location.href='http://crowdcrafting.org/app/sonycv<?php echo $v; ?>/tutorial'">Continue</button>
       </div>
      </div>
    </div>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>
