<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>

	<style>
		h1{ font-size: 1.9em; margin: 10px 0}
		p{ margin: 8px 0}
		*{
			margin: 0;
			padding: 0;
			box-sizing: border-box;
			-webkit-box-sizing: border-box;
			-moz-box-sizing: border-box;
			-webkit-font-smoothing: antialiased;
			-moz-font-smoothing: antialiased;
			-o-font-smoothing: antialiased;
			font-smoothing: antialiased;
			text-rendering: optimizeLegibility;
		}
		body{
			font: 14px Arial,Tahoma,Helvetica,FreeSans,sans-serif;
			text-transform: inherit;
			color: #333;
			background:#226BB3 url('bg.png');
			background-repeat:repeat;
			background-position:10px 10px;
			width: 100%;
			line-height: 18px;
		}
		.wrap{
			width: 700px;
			margin: 20px auto auto auto ;
			background: white;
			border: 2px solid #DBDBDB;
			-webkit-border-radius: 10px;
			-moz-border-radius: 10px;
			border-radius: 10px;
			box-shadow: 7px 7px 5px #2B2B2B;
			overflow: hidden;
			text-align: center;
		}
		#footer {
			text-align: center;
			clear: both;
			width: 400px;
			margin-left:auto;
			margin-right:auto;
			margin-top: 10px;
		}
	</style>
</head>

<?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";
?>

<body>
	<div class="wrap">
		<h1>Hoeray, <?php echo $username; ?></h1> <br />
			
			<p>
			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 src="<?php echo $img; ?>" /> <br />
			<br>
			Share your score with al your friends:
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_tumblr_large' displayText='Tumblr'></span>
<span class='st_pinterest_large' displayText='Pinterest'></span>
<span class='st_email_large' displayText='Email'></span>			
			
		<div id = "footer">
			&copy;The Essteling 
		</div>		
	</div>
</body>
</html>




