daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
Top