Guest User

Untitled

a guest
Feb 7th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. <head>
  2. $( document ).ready(function() {
  3. (function showscreen() {
  4. $.ajax({
  5. url: 'screen.php',
  6. success: function(data) {
  7. $('#screen').html(data);
  8. },
  9. complete: function() {
  10.  
  11. setTimeout(showscreen, 5000);
  12. }
  13. });
  14. })();
  15. });
  16. </head>
  17. <body>
  18. <div id="screen"></div>
  19. <?php
  20.  
  21. require '../dbauth/videos.inc.php';
  22. //This handles my db connections.
  23.  
  24. $videosdbhandle = mysql_connect(
  25.  
  26. $videoshostname,
  27. $videosusername,
  28. $videospassword
  29.  
  30. ) or die("INVALID USERNAME OR PASSWORD");
  31.  
  32. $videosselected = mysql_select_db($videosdbname, $videosdbhandle);
  33.  
  34. $checkvideosql = "SELECT * FROM videos ORDER BY votes DESC";
  35. $checkvideoquery = mysql_query($checkvideosql, $videosdbhandle);
  36. $checkvideocount = mysql_num_rows($checkvideoquery);
  37.  
  38. if ($checkvideocount > 0) {
  39.  
  40. $count = 0;
  41.  
  42. while ($checkvideocount > $count) {
  43.  
  44. $thevideoname = mysql_result($checkvideoquery, $count, "name");
  45. $thevideovideo = mysql_result($checkvideoquery, $count, "video");
  46. $thevideoid = mysql_result($checkvideoquery, $count, "id");
  47. $thevideoimage = mysql_result($checkvideoquery, $count, "image");
  48.  
  49. echo '<div class="screen" id="video';
  50. echo $thevideoid;
  51. echo '" style="display: none; background-image: url(';
  52. echo "'http://backcurrents.com/videos/";
  53. echo $thevideoname;
  54. echo '/';
  55. echo $thevideoimage;
  56. echo "'";
  57. echo ');">';
  58.  
  59. echo '<video loop muted autoplay
  60. poster="http://backcurrents.com/videos/';
  61. echo $thevideoname;
  62. echo '/';
  63. echo $thevideovideo;
  64. echo '" class="videobg">
  65. <source src="http://backcurrents.com/videos/';
  66. echo $thevideoname;
  67. echo '/';
  68. echo $thevideovideo;
  69. echo '" type="video/mp4">
  70. </video>';
  71. echo '</div>';
  72.  
  73.  
  74. $count++;
  75. }
  76.  
  77.  
  78. }else{
  79.  
  80. echo 'NO VIDEOS!';
  81.  
  82. }
  83.  
  84. ?>
  85. </body>
  86.  
  87. $videosusername = "theusername";
  88. $videospassword = "thepassword";
  89. $videoshostname = "localhost";
  90. $videosdbname = "thedbname";
  91.  
  92. $videosdbhandle = mysql_connect(
  93.  
  94. $videoshostname,
  95. $videosusername,
  96. $videospassword
  97.  
  98. ) or die("INVALID SHOW NAME OR PASSWORD");
  99.  
  100. $videosselected = mysql_select_db($videosdbname, $videosdbhandle);
  101.  
  102. $checkhighestvideosql = "SELECT * FROM videos ORDER BY votes DESC";
  103. $checkhighestvideoquery = mysql_query($checkhighestvideosql,
  104. $videosdbhandle);
  105. $checkhighestvideocount = mysql_num_rows($checkhighestvideoquery);
  106.  
  107.  
  108.  
  109. if ($checkhighestvideocount > 0) {
  110. $x=0;
  111.  
  112. while ($checkhighestvideocount > $x) {
  113.  
  114. $checkhighestvideoid = mysql_result($checkhighestvideoquery, $x, "id");
  115.  
  116. if ($x=0) {
  117.  
  118. echo '<script type="text/javascript">';
  119. echo '$(".screen").hide();
  120. $("#video';
  121. echo $checkhighestvideoid;
  122. echo '").show(); ';
  123. echo '</script>';
  124.  
  125. }else{
  126. echo '<script type="text/javascript">';
  127. echo '$(".screen").hide();
  128. ';
  129. echo '</script>';
  130. }
  131.  
  132. $x++;
  133. }
  134.  
  135. }else{
  136. echo "NO VIDEOS!";
  137. }
Add Comment
Please, Sign In to add comment