<?php
	$mysqli = new mysqli("portfolio.jancokock.me", "csadmin", "aardbei123", "colorstrike");
	
	function safeString($var){
		$TEMPSTRING = $var;
		$TEMPSTRING = strip_tags($TEMPSTRING);
		$TEMPSTRING = htmlspecialchars($TEMPSTRING);
		$TEMPSTRING = trim($TEMPSTRING);
		return $TEMPSTRING;
	}
	$id = safeString($_GET['id']);
	if (ctype_digit($id)) {			#Check if the id is a valid number
		if($stmt = $mysqli -> prepare("	SELECT highscore.username, highscore.score, song.title 
										FROM highscore, song, songinstance 
										WHERE highscore.id = ?
										AND songinstance.id = songinstance 
										AND songinstance.song = song.id")){								
			$stmt->bind_param('i', $id);
			$stmt -> execute();
			$stmt -> bind_result($username, $score, $title);
			$stmt -> fetch();		
			$stmt -> close();																					
		}
	}

	$img = "images/".$id.".jpeg";
?>

<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Color Strike Scores</title>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "e2135556-d99b-42f9-9a70-81a664ba2ee6", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

<!-- Bootstrap 3.3.4 -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
    <!-- Colorstrike Skins. -->
    <link href="dist/css/skins/skin-red.min.css" rel="stylesheet" type="text/css" />
</head>



<body class="skin-red bg-teal-gradient">
	<section class="content">
		<div class="row">
			<div class="col-lg-6 col-lg-offset-3 col-sm-8 col-sm-offset-2 col-xs-12">

				<div class="box box-info">
		          <div class="box-header">
		            <i class="ion ion-ribbon-b"></i>
		            <h3 class="box-title">Hooray, <?php echo $username; ?></h3>
		          </div>

		          <div class="box-body border-radius-none">
		            You have set a incredible score of <span style="font-size:20;"><?php echo $score; ?> points</span> at the song <b>"<?php echo $title; ?>"</b>. 
					</p>
					Here is a suprise for you! <br />
					
					<img class="img-responsive" src="<?php echo $img; ?>" /> <br />
		          </div><!-- /.box-body -->

		          <div class="box-footer">
		          	<div class="row">
		          		<div class="col-xs-2">
							<span class='st_facebook_large text-center' displayText='Facebook'></span>
						</div><div class="col-xs-2">
							<span class='st_twitter_large' displayText='Tweet'></span>
						</div><div class="col-xs-2">
							<span class='st_googleplus_large' displayText='Google +'></span>
						</div><div class="col-xs-2">
							<span class='st_tumblr_large' displayText='Tumblr'></span>
						</div><div class="col-xs-2">
							<span class='st_pinterest_large' displayText='Pinterest'></span>
						</div><div class="col-xs-2">
							<span class='st_email_large' displayText='Email'></span>	
						</div>
					</div>
		          </div>
		        </div><!-- /.box -->	
			</div>
		</div>	
	</section>
</body>
</html>




