index.php 2.4 KB

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