Advertisement
Guest User

webm random indexer

a guest
Apr 27th, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <html>
  2. <head>
  3. <?php
  4.  
  5. // RANDOM VIDEO
  6.  
  7. $dir = "webm";
  8. $dh = opendir($dir);
  9. while (false !== ($filename = readdir($dh))) {
  10.     $files[] = $filename;
  11. }
  12.  
  13. sort($files);
  14.  
  15. $randomvideo = rand(2, sizeof($files)-1);
  16.  
  17. ?>
  18. </head>
  19. <body>
  20. <div align="center">
  21. <h1>Random Video</h1>
  22. <h2>Current video: <a href=/webm/<?php echo($files[$randomvideo]); ?> > <?php echo($files[$randomvideo]); ?> </a></h2>
  23. <h3>Total videos: <a href=/webm/> <?php echo(sizeof($files)-2); ?> </a></h3>
  24.  
  25. <video style="background-color: black;"width="80%" height="70%" controls autoplay>
  26.   <source src="webm/<?php echo($files[$randomvideo]); ?>" type="video/webm">
  27. Your browser does not support the video tag.
  28. </video>
  29.  
  30. <p></p>
  31.  
  32. <form action="" method="post">
  33. <input type="submit" value="Random video!">
  34.  
  35. <p></p>
  36. </br>
  37. </form>
  38. </div>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement