Public paste
Undefined
By: Gotexx | Date: Jan 10 2007 17:22 | Format: PHP | Expires: never | Size: 3.95 KB | Hits: 1432

  1. <?
  2. ////////////////////////////////////////
  3. // http://www.Xmoo.org                //
  4. // Scripting: Mohammad Moghtader     //
  5. ////////////////////////////////////////
  6.  
  7. //Map waar foto's inzitten...
  8. $files = "Images";
  9. //Hoeveel foto's per pagina weergeven...
  10. $perpagina = 1;
  11. //Breedte van (kleine)foto die weergegeven wordt...
  12. $w = 600;
  13. //Hoogte van (kleine)foto die weergegeven wordt...
  14. $h = 800;
  15.  
  16. //Hieronder niets wijzigen!
  17. ?>
  18. <?PHP
  19.  
  20. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21.   Path to the CuteNews directory (to make the includng easyer)
  22.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  23. $path = ".";
  24.  
  25. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  26.   This is a fix if register_globals is turned off
  27.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  28. if(!$PHP_SELF){
  29.         if($HTTP_POST_VARS)     {extract($HTTP_POST_VARS, EXTR_PREFIX_SAME, "post_");}
  30.         if($HTTP_GET_VARS)      {extract($HTTP_GET_VARS, EXTR_PREFIX_SAME, "get_");}
  31.         if($HTTP_COOKIE_VARS)   {extract($HTTP_COOKIE_VARS, EXTR_PREFIX_SAME, "cookie_");}
  32.         if($HTTP_ENV_VARS)              {extract($HTTP_ENV_VARS, EXTR_PREFIX_SAME, "env_");}
  33. }
  34. if($PHP_SELF == ""){ $PHP_SELF = $HTTP_SERVER_VARS[PHP_SELF]; }
  35.  
  36. ?>
  37. <SCRIPT language=JavaScript1.1>
  38.  
  39. function right(e) {
  40. if (navigator.appName == 'Netscape' &&
  41. (e.which == 3 || e.which == 2))
  42. return false;
  43. else if (navigator.appName == 'Microsoft Internet Explorer' &&
  44. (event.button == 2 || event.button == 3)) {
  45. alert("Copyright (c) 2003-2004, Xmoo Software. All Rights
  46.   Reserved.");
  47. return false;
  48. }
  49. return true;
  50. }
  51.  
  52. document.onmousedown=right;
  53. document.onmouseup=right;
  54. if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  55. if (document.layers) window.captureEvents(Event.MOUSEUP);
  56. window.onmousedown=right;
  57. window.onmouseup=right;
  58. //  End -->
  59. </SCRIPT>
  60. <style>
  61. img.foto
  62. {
  63.         border: 1px solid black;
  64. }
  65. </style>
  66. <?
  67. echo "<center>";
  68.  
  69. $dir = opendir($files);
  70. while ($open = readdir($dir))
  71. {
  72.         if (($open != "..") AND ($open != "."))
  73.     {
  74.         $point1 = explode('.', $open);
  75.         $point2 = count($point1);
  76.         $point = strtoupper($point1[$point2-1]);
  77.  
  78.         if (($point == "JPG") OR ($point == "JPEG") OR ($point == "GIF"))
  79.         {
  80.                 $photos[] = "$open";
  81.         }
  82.     }
  83. }
  84.  
  85. $aantal = count($photos);
  86.  
  87. if($aantal == 0)
  88. {
  89.         echo "Er zijn geen foto's gevonden!";
  90. }
  91. else
  92. {
  93.         if (!isset($photo))
  94.     {
  95.         if (!isset($p))
  96.         {
  97.             $p = 1;
  98.         }
  99.  
  100.         $paginas = ceil(($aantal / $perpagina));
  101.  
  102.         $show[max] = ($p * $perpagina);
  103.         $show[min] = $show[max] - $perpagina;
  104.  
  105.         if ($show[max] > $aantal)
  106.         {
  107.             $show[max] = $aantal;
  108.         }
  109.  
  110.         for ($c = $show[min]; $c < $show[max]; $c++)
  111.         {
  112.             echo "<a href="?photo=$c" name="$c"><img class="foto" src="".$files."/".$photos[$c]."" height="$h" width="$w"></a> ";
  113.         }
  114.  
  115.         echo "<br><br>| ";
  116.  
  117.         for ($b = 1; $b < ($paginas+1); $b++)
  118.         {
  119.             if ($p == $b)
  120.             {
  121.                 echo "<b>$b</b> | ";
  122.             }
  123.             else
  124.             {
  125.                 echo "<a href="?p=$b">$b</a> | ";
  126.             }
  127.         }
  128.  
  129.         echo "<br>Totaal $aantal foto's!";
  130.         }
  131.     else
  132.     {
  133.         if (!empty($photos[$photo]))
  134.         {
  135.                 $p = ceil((($photo+1) / $perpagina));
  136.  
  137.                 $nav = "| <a href="?p=$p#$photo">Terug</a>";
  138.  
  139.                 if ($photo != 0)
  140.             {
  141.                 $nav .= " | <a href="?photo=".($photo-1)."">Vorige</a>";
  142.             }
  143.             if (($photo+1) != $aantal)
  144.             {
  145.                 $nav .= " |  <a href="?photo=".($photo+1)."">Volgende</a>";
  146.             }
  147.  
  148.             $nav .= " |";
  149.  
  150.             echo "<img class="foto" src="".$files."/".$photos[$photo].""><br><br>$nav";
  151.         }
  152.         else
  153.         {
  154.                 echo "Deze foto is niet gevonden!";
  155.         }
  156.     }
  157. }
  158. echo "</center>";
  159. ?>
  160. <?php //  ?>