song.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. $page = 4;
  3. require("inc_header.php");
  4. if(!isset($_GET['id']))
  5. {
  6. header("Location: songs.php");
  7. }
  8. $song_id = $_GET['id'];
  9. // ======================================================
  10. // GET SONG DETAILS
  11. // ======================================================
  12. $query = "SELECT * FROM `song` WHERE `id`=$song_id";
  13. $result_temp = mysqli_query($connection, $query);
  14. $result = mysqli_fetch_assoc($result_temp);
  15. $song_title = $result['title'];
  16. $song_author = $result['author'];
  17. // ======================================================
  18. // SONGINSTANCES
  19. // ======================================================
  20. $table = "";
  21. $query = "SELECT `id`, `difficulty`, `enemies`, (SELECT COUNT(1) FROM `playdata` WHERE `songinstance`=songinstance.`id`) as sis
  22. FROM `songinstance`
  23. WHERE `song`=$song_id";
  24. $result_temp = mysqli_query($connection, $query);
  25. while($result = mysqli_fetch_assoc($result_temp))
  26. {
  27. $table .= "<tr>";
  28. $table .= "<td><a href='" . returnurl('songinstance.php?id=' . $result['id']) . "'>" . $result['difficulty'] . "</a></td>";
  29. $table .= "<td>" . $result['enemies'] . "</td>";
  30. $table .= "<td>" . $result['sis'] . "</td>";
  31. $table .= "</tr>";
  32. }
  33. ?>
  34. <!-- Content Wrapper. Contains page content -->
  35. <div class="content-wrapper">
  36. <!-- Content Header (Page header) -->
  37. <section class="content-header">
  38. <h1>
  39. Song
  40. <small><?php echo $song_title; ?></small>
  41. </h1>
  42. <ol class="breadcrumb">
  43. <li><a href="songs.php"><i class="ion ion-music-note"></i> Songs</a></li>
  44. <li class="active"><a href="#"></i> <?php echo $song_title; ?></a></li>
  45. </ol>
  46. </section>
  47. <section class="content">
  48. <div class="row">
  49. <div class="col-sm-6 col-xs-12">
  50. <!-- small box -->
  51. <div class="small-box bg-aqua">
  52. <div class="inner">
  53. <h3><?php echo $song_title; ?></h3>
  54. <p>Title</p>
  55. </div>
  56. </div>
  57. </div><!-- ./col -->
  58. <div class="col-sm-6 col-xs-12">
  59. <!-- small box -->
  60. <div class="small-box bg-green">
  61. <div class="inner">
  62. <h3><?php echo $song_author; ?></h3>
  63. <p>Author</p>
  64. </div>
  65. </div>
  66. </div><!-- ./col -->
  67. </div><!-- /.row -->
  68. <div class="row">
  69. <div class="col-lg-12">
  70. <!-- TABLE: LATEST SONGS -->
  71. <div class="box">
  72. <div class="box-header with-border">
  73. <i class="ion ion-music-note"></i>
  74. <h3 class="box-title">Song</h3>
  75. </div><!-- /.box-header -->
  76. <div class="box-body">
  77. <table class="table table-bordered">
  78. <thead>
  79. <tr>
  80. <th>Difficulty</th>
  81. <th>Total Enemies</th>
  82. <th># Played</th>
  83. </tr>
  84. </thead>
  85. <tbody>
  86. <?php
  87. echo $table;
  88. ?>
  89. </tbody>
  90. </table>
  91. </div><!-- /.box-body -->
  92. </div><!-- /.box -->
  93. </div><!-- /.col -->
  94. </div><!-- /.row -->
  95. </section><!-- /.content -->
  96. </div><!-- /.content-wrapper -->
  97. <?php
  98. require("inc_footer.php");
  99. ?>