Advertisement
NovaYoshi

Yiff lister

Apr 19th, 2011
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <form action="Index.php" method="get">
  2. Search: <input type="text" name="SearchFor" />
  3. <input type="submit" value="Go!" />
  4. </form>
  5. <script language="JavaScript">
  6.     function SectionButton(s)
  7.     {
  8.         var Ptr = document.getElementById("obj"+s);
  9.         if(Ptr.style.display=="none")
  10.         {
  11.             Ptr.style.display="inline";
  12.             return;
  13.         }
  14.         if(Ptr.style.display=="inline")
  15.         {
  16.             Ptr.style.display="none";
  17.             return;
  18.         }
  19.     }
  20. </script>
  21. <?php
  22.  
  23. //gets a filenames extension
  24. function filename_extension($filename) {//{{{
  25. $pos = strrpos($filename, '.');
  26. if($pos===false) {
  27. return false;
  28. } else {
  29. return substr($filename, $pos+1);
  30. }
  31. }//}}}
  32.  
  33. // Config
  34.  
  35. // Global variables
  36. $Section = 1;
  37. $FileList="";
  38.  
  39. function listdirectory($me,$base)
  40. {
  41. $path = $me;
  42. $from = "";
  43. if($path!=".")
  44. {
  45.     $from="$me\\";
  46. }
  47. $dir_handle = @opendir($path) or die("Unable to open $path");
  48. echo "<ul style='border: 8px blue solid;'>";
  49. while ($file = readdir($dir_handle))
  50. {
  51.    $Section++;
  52.    $DisplayMe=false;
  53.    $Extension=strtolower(filename_extension($file));
  54.    if($file=="." || $file=="..")
  55.     $DisplayMe=false;
  56.    if($Extension=="")
  57.    {
  58.     if($file != "." && $file != "..")
  59.     {
  60.         echo "<li style='border: 8px lime solid;'>";
  61.         echo '<input type="Button" value="   " onClick="SectionButton(';
  62.         $ThisSection=$Section+rand(100,16384);
  63.         echo $ThisSection;
  64.         echo ');">';
  65.  
  66.         echo "$file</li>";
  67.         if($base == 1)
  68.         {
  69.             echo '<span style="display: none;" ';
  70.             echo 'id=obj';
  71.             echo $ThisSection;
  72.             echo '>';
  73.         }
  74.         echo "<li>";
  75.         listdirectory("$from$file",0);
  76.         echo "</li>";
  77.         if($base == 1)
  78.         {
  79.             echo '</span>';
  80.         }
  81.     }
  82.    }
  83.    if($Extension=="jpg" || $Extension=="gif" || $Extension=="png" || $Extension=="svg")
  84.    {
  85.     $DisplayMe=true;
  86.    }
  87.    if($Extension=="swf")
  88.    {
  89.     $flashes=$flashes."<a href='$from$file'>$file (Flash)</a><br>";
  90.    }
  91.    if($DisplayMe==true)
  92.    {
  93.     $FileList=$FileList.'<a href="Presenter.php?File='.$from.$file.'">';
  94.     $FileList=$FileList."$file</a><br>";
  95.    }
  96. }
  97. echo "$FileList";
  98. echo "</ul>";
  99. closedir($dir_handle);
  100. }
  101. listdirectory(".",1);
  102. echo "<br>";
  103. echo $flashes;
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement