index.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>YouPlay</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link href="bootstrap.css" rel="stylesheet">
  8. <style>
  9. body {
  10. padding-top: 60px;
  11. }
  12. </style>
  13. <link href="bootstrap-responsive.css" rel="stylesheet">
  14. </head>
  15. <body>
  16. <div class="navbar navbar-inverse navbar-fixed-top">
  17. <div class="navbar-inner">
  18. <div class="container">
  19. <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  20. <span class="icon-bar"></span>
  21. <span class="icon-bar"></span>
  22. <span class="icon-bar"></span>
  23. </button>
  24. <a class="brand" href="#">YouPlay</a>
  25. <div class="nav-collapse collapse">
  26. <ul class="nav">
  27. <li><a href="index.php">Home</a></li>
  28. </ul>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="container">
  34. <?php
  35. $config = new stdClass();
  36. $config->host = "localhost";
  37. $config->username = "";
  38. $config->password = "";
  39. $config->database = "";
  40. $db = mysqli_connect($config->host,$config->username,$config->password,$config->database);
  41. if(!isset($_GET["id"])) {
  42. ?>
  43. <table class="table">
  44. <thead>
  45. <tr>
  46. <th>Play</th>
  47. <th>Artist</th>
  48. <th>Title</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. <?php
  53. $list = mysqli_query($db,"SELECT * FROM youplay");
  54. while($entry = mysqli_fetch_assoc($list)) {
  55. echo "<tr>";
  56. echo "<td><a href='index.php?id=".$entry["id"]."'>Play</a></td>";
  57. echo "<td>".htmlspecialchars($entry["artist"])."</td>";
  58. echo "<td>".htmlspecialchars($entry["title"])."</td>";
  59. echo "</tr>";
  60. }
  61. ?>
  62. </tbody>
  63. </table>
  64. <?php
  65. }
  66. else {
  67. include("ytclass.php");
  68. $ytclass = new YTDownloader();
  69. $video = mysqli_fetch_assoc(mysqli_query($db,"SELECT * FROM youplay WHERE id='".mysqli_real_escape_string($db,$_GET["id"])."'"));
  70. $vlink = $ytclass->getDownloadLinks($video["watchid"])["dl"];
  71. ?>
  72. <div class='page-header'>
  73. <h1><?php echo htmlspecialchars($video["title"]) ?>
  74. <small> <?php echo htmlspecialchars($video["artist"]) ?></small></h1>
  75. </div>
  76. <video controls style="width:90%;margin-left:5%">
  77. <?php
  78. for($i=0;$i<count($vlink);$i++) {
  79. echo "<source src='".$vlink[$i]["url"]."'>";
  80. }
  81. ?>
  82. Your browser does not support the video tag.
  83. </video>
  84. <? } ?>
  85. </div>
  86. </body>
  87. </html>