Guest User

Untitled

a guest
Jan 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. $current_dir = "$DOCUMENT_ROOT"."eventi/";
  3. $dir = opendir($current_dir);
  4.  
  5. while ($file = readdir($dir)){
  6. $parts = explode(".", $file);
  7. if (is_array($parts) && count($parts) > 1) {
  8. $extension = end($parts);
  9. if ($extension == "php" OR $extension == "PHP"){
  10. $pat = array();
  11. $rep = array();
  12. $pat[0] = '/-/';
  13. $pat[1] = '/.php/';
  14. $rep[0] = ' ';
  15. $rep[1] = '';
  16. $cleanfile = preg_replace($pat,$rep,$file);
  17.  
  18. echo "<a href=\"eventi/$file\" target=\"_self\" class=\"box_evento_title\"> $cleanfile </a><br />";
  19. }
  20. }
  21. }
  22. closedir($dir);
  23. ?>
Add Comment
Please, Sign In to add comment