message2.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. $mysqli = new mysqli("portfolio.jancokock.me", "csadmin", "aardbei123", "colorstrike");
  3. function safeString($var){
  4. $TEMPSTRING = $var;
  5. $TEMPSTRING = strip_tags($TEMPSTRING);
  6. $TEMPSTRING = htmlspecialchars($TEMPSTRING);
  7. $TEMPSTRING = trim($TEMPSTRING);
  8. return $TEMPSTRING;
  9. }
  10. $id = safeString($_GET['id']);
  11. if (ctype_digit($id)) { #Check if the id is a valid number
  12. if($stmt = $mysqli -> prepare(" SELECT highscore.username, highscore.score, song.title
  13. FROM highscore, song, songinstance
  14. WHERE highscore.id = ?
  15. AND songinstance.id = songinstance
  16. AND songinstance.song = song.id")){
  17. $stmt->bind_param('i', $id);
  18. $stmt -> execute();
  19. $stmt -> bind_result($username, $score, $title);
  20. $stmt -> fetch();
  21. $stmt -> close();
  22. }
  23. }
  24. $img = "images/".$id.".jpeg";
  25. ?>
  26. <html lang="en">
  27. <head>
  28. <meta charset="UTF-8" />
  29. <title>Color Strike Scores</title>
  30. <script type="text/javascript">var switchTo5x=true;</script>
  31. <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
  32. <script type="text/javascript">stLight.options({publisher: "e2135556-d99b-42f9-9a70-81a664ba2ee6", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
  33. <!-- Bootstrap 3.3.4 -->
  34. <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  35. <!-- Theme style -->
  36. <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
  37. <!-- Colorstrike Skins. -->
  38. <link href="dist/css/skins/skin-red.min.css" rel="stylesheet" type="text/css" />
  39. </head>
  40. <body class="skin-red bg-teal-gradient">
  41. <section class="content">
  42. <div class="row">
  43. <div class="col-lg-6 col-lg-offset-3 col-sm-8 col-sm-offset-2 col-xs-12">
  44. <div class="box box-info">
  45. <div class="box-header">
  46. <i class="ion ion-ribbon-b"></i>
  47. <h3 class="box-title">Hooray, <?php echo $username; ?></h3>
  48. </div>
  49. <div class="box-body border-radius-none">
  50. 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>.
  51. </p>
  52. Here is a suprise for you! <br />
  53. <img class="img-responsive" src="<?php echo $img; ?>" /> <br />
  54. </div><!-- /.box-body -->
  55. <div class="box-footer">
  56. <div class="row">
  57. <div class="col-xs-2">
  58. <span class='st_facebook_large text-center' displayText='Facebook'></span>
  59. </div><div class="col-xs-2">
  60. <span class='st_twitter_large' displayText='Tweet'></span>
  61. </div><div class="col-xs-2">
  62. <span class='st_googleplus_large' displayText='Google +'></span>
  63. </div><div class="col-xs-2">
  64. <span class='st_tumblr_large' displayText='Tumblr'></span>
  65. </div><div class="col-xs-2">
  66. <span class='st_pinterest_large' displayText='Pinterest'></span>
  67. </div><div class="col-xs-2">
  68. <span class='st_email_large' displayText='Email'></span>
  69. </div>
  70. </div>
  71. </div>
  72. </div><!-- /.box -->
  73. </div>
  74. </div>
  75. </section>
  76. </body>
  77. </html>