Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2. $exclude    = array('.','..');
  3. $dir        = __DIR__ . '/images';
  4. $files      = scandir($dir);
  5. $files_ex   = array_values(array_diff($files, $exclude));
  6. $rand       = rand(0,count($files_ex)-1);
  7. ?>
  8.  
  9. <html>
  10. <head>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <style>
  13.  
  14. .center
  15. {
  16.     display: block;
  17.     margin-left: auto;
  18.     margin-right: auto;
  19.     width: 40%;
  20. }
  21. </style>
  22. </head>
  23.  
  24. <body bgcolor="#d7dcd4">
  25. we be debugging mofo
  26. <br>
  27. <img class="center" src="images/<?php echo $files_ex[$rand]; ?>">
  28. <br>
  29. <?php
  30. foreach ($files_ex as $f)
  31. {
  32.     echo "<br>$f\n";
  33. }
  34. ?>
  35. </body>
  36.  
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement