Top-Themen

AppleEntwicklungHardwareInternetLinuxMicrosoftMultimediaNetzwerkeOff TopicSicherheitSonstige SystemeVirtualisierungWeiterbildungZusammenarbeit

Aktuelle Themen

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit
GELÖST

PHP Skript läuft mit Version 5 nicht mehr

Frage Entwicklung PHP

Mitglied: Trabbi

Trabbi (Level 1) - Jetzt verbinden

08.06.2009, aktualisiert 10.06.2009, 5333 Aufrufe, 2 Kommentare

Hallo zusammen,
seit der Umstellung meines Webhosts von PHP4 auf PHP5 läuft ein Skript auf meiner Homepage nicht mehr.
Da ich PHP Laie bin, frage ich mich, wie man folgendes Skript auch unter PHP5 zum Laufen bringt:
01.
<?PHP 
02.
//////////////////////////////////////////////////////////////////////////////// 
03.
// PhotoFrame           http://photoframe.sf.net 
04.
   $version = "6.9"
05.
// 
06.
// by Martin Dougiamas  http://dougiamas.com 
07.
// 
08.
// Photoframe displays a directory of images (JPEG, PNG, GIF) simply and easily. 
09.
// It will also create thumbnails and display JPEG captions if it finds them. 
10.
// Guests can leave comments, and it supports Imagemagick as well as PHP GD. 
11.
// I am placing this script in the Public Domain - use it as you wish. 
12.
// 
13.
// Requirements: A web server with this software (note minimum versions): 
14.
//               - PHP 4.0.2   http://www.php.net 
15.
//               AND EITHER THESE 
16.
//               - GD 1.8.3    http://www.boutell.com/gd 
17.
//               - libjpeg 6b  http://www.ijg.org/ 
18.
//               OR 
19.
//               - Imagemagick http://www.imagemagick.org/ 
20.
// 
21.
// How to use:   1. Store all your images in a directory on your server 
22.
//               2. Save this file in that directory as index.php 
23.
//               3. Make sure the web server has write permissions so 
24.
//                  that it can write in a sub directory (thumbnails etc). 
25.
//                  eg   mkdir thumb ; chown nobody thumb 
26.
//   (optional)  4. Change any of the settings below to suit. You can 
27.
//                  also put these in a separate file called config.php 
28.
//   (optional)  5. Add an intro.html file if you like. 
29.
//   (optional)  6. Add header.html and footer.html files if you want 
30.
//                  to change page colours, layout or styles. 
31.
//   (optional)  7. Add a sortfile if you want to control the order of 
32.
//                  the photos, rather than the default alphabetical order. 
33.
//                  Just make a simple text file with one filename per line. 
34.
//                  eg   ls -1 *.jpg *.png > sortfile 
35.
//                       (and then edit with vi) 
36.
// 
37.
//////////////////////////////////////////////////////////////////////////////// 
38.
 
39.
//////////////////////////////////////////////////////////////////////////////// 
40.
// config.php  - these settings are the default ones.  You can either 
41.
//               change them here or create a file called "config.php" 
42.
//               that contains override settings.  The advantage of a 
43.
//               separate file is that you can upgrade the script and 
44.
//               keep all your settings. 
45.
 
46.
$title        = "Galerie"; // Title for the overall web page 
47.
$marginsize   =  200;               // Size of the side frame, and thumbnails 
48.
$marginside   = "left";             // Margin frame location: "left" or "right" 
49.
 
50.
$thumb        = "thumbs";           // Sub-directory where thumbnails are stored 
51.
$imagequality =  80;                // Quality of reduced images, range 0 - 100 
52.
$fullwindow   =  false;             // Display images to fill browser window? 
53.
 
54.
$imageresize  =  0;                 // You can rescale all images to fit within 
55.
                                    // a boundary square of this size (eg 800). 
56.
                                    // These rescaled images are cached on disk. 
57.
                                    // To just use original images, specify 0 
58.
 
59.
$pagecolor    = "#616387";          // Background color of all pages 
60.
$margincolor  = "#616387";          // Used if set, else margincolor = pagecolor 
61.
$textcolor    = "#FFF1A8";          // Text color for all pages 
62.
$linkcolor    = "#FFF1A8";          // Link color for all pages 
63.
$vlinkcolor   = "#FFF1A8";          // Visited link color for all pages 
64.
$background   = "";                 // Background image for all pages 
65.
$stylesheet   = "..\..\styles.css"; // Full URL to a stylesheet for all pages. 
66.
                                    // HTML text tags used: <H1>,<P>,<TD>,<A> 
67.
 
68.
$lang         = "de";               // Language: af/ar/ba/bg/br/ca/de/dk/ 
69.
                                    //           ee/en/es/fi/fr/gb/gr/hu/is/it/ 
70.
                                    //           lv/nl/no/pl/pt/ro/ru/se/tr 
71.
 
72.
$introfile    = "intro.html";       // If it exists, will be displayed up front 
73.
$headerfile   = "header.html";      // If it exists, will be included at top 
74.
$footerfile   = "footer.html";      // If it exists, will be included at bottom 
75.
 
76.
$sortfile     = "sortfile";         // If it exists, contains filenames in order 
77.
$sortreverse  =  false;             // If true, then the sort order is reversed 
78.
$datenames    =  false;             // If true, then assumes the filenames have 
79.
                                    // been named starting with the date YYYYMMDD 
80.
 
81.
$password     = "";                 // This password enables admin mode, for 
82.
                                    // editing captions, deleting guest comments, 
83.
                                    // uploading new images, deleting images etc 
84.
                                    // If left blank "" then admin is disabled 
85.
$moderate     =  false;             // If true, then guest comments will not be 
86.
                                    // automatically added to the pages.  Only 
87.
                                    // the admin user will be able to see them 
88.
                                    // and they have a little "approve" link to 
89.
                                    // release them to the public.  This only 
90.
                                    // works if $password and $guestcomment are on 
91.
 
92.
$guestcomment =  false;             // If true, then guests can leave comments 
93.
$recentcount  =  10;                // How many 'recent' comments to show 
94.
$email        = "info@meineseite.de";  // If you put your email address here then 
95.
                                    // new guest comments will be mailed to you 
96.
                                    // ... PHP must already support mail. 
97.
$timeoffset   =  0;                 // By how many hours do you want to offset the 
98.
                                    // the server time when displaying messages. 
99.
                                    // 0 = server time, "8.5" = add 8:30, "-4" = subtract 4:00 
100.
 
101.
$imagemethod   = "none";            // gd1, gd2, imagemagick, manual, none 
102.
                                    // gd1 - gd 1.* compiled into PHP 
103.
                                    // gd2 - gd 2.* compiled into PHP 4.0.6 or later 
104.
                                    // imagemagick - use imagemagick "convert" and "identify" 
105.
                                    // manual - create your own thumbnails elsewhere 
106.
                                    // none - don't use thumbnail images 
107.
 
108.
$captionmethod = "none";            // rdjpgcom, imagemagick, capfile, filename, none 
109.
                                    // rdjpgcom - use rdjpgcom program, part of libjpeg 
110.
                                    // imagemagick - use imagemagick program "identify" 
111.
                                    // capfile - use thumb/filename.jpg.cap files 
112.
                                    // filename - just use the filename as the caption 
113.
                                    // none - don't use any captions on images 
114.
 
115.
// Depending on what you chose for $imagemethod and $captionmethod, set these: 
116.
$convert  = "/usr/local/bin/convert";     // Path to Imagemagick "convert" program 
117.
$identify = "/usr/local/bin/identify";    // Path to Imagemagick "identify" program 
118.
$rdjpgcom = "/usr/bin/rdjpgcom";    // Path to rdjpgcom program, if needed. 
119.
$wrjpgcom = "/usr/bin/wrjpgcom";    // If you are using rdjpgcom, set this too 
120.
                                    // so admin can update (write) image captions 
121.
 
122.
//////////////////////////////////////////////////////////////////////////////// 
123.
 
124.
 
125.
//////////////////////////////////////////////////////////////////////////////// 
126.
/// Normally, you won't need to change anything below here 
127.
//////////////////////////////////////////////////////////////////////////////// 
128.
 
129.
if (file_exists("config.php")) {    // Settings in here will override defaults 
130.
   include("config.php"); 
131.
132.
 
133.
if (isset($HTTP_SERVER_VARS["PATH_TRANSLATED"])) {  // Name of this file 
134.
   $scriptname = basename($HTTP_SERVER_VARS["PATH_TRANSLATED"]); 
135.
} else
136.
   $scriptname = "index.php"
137.
138.
 
139.
/// Language Strings /// 
140.
 
141.
// English - en 
142.
$ss["en"]["next"]    = "Next"
143.
$ss["en"]["prev"]    = "Previous"
144.
$ss["en"]["slide"]   = "Slideshow"
145.
$ss["en"]["comments"]= "Comments"
146.
$ss["en"]["name"]    = "Name"
147.
$ss["en"]["message"] = "Message"
148.
$ss["en"]["add"]     = "Add my message to this page"
149.
$ss["en"]["start"]   = "Back to the start"
150.
$ss["en"]["selectl"] = "Select images from the left"
151.
$ss["en"]["selectr"] = "Select images from the right"
152.
$ss["en"]["from"]    = "From"
153.
$ss["en"]["recent"]  = "most recent guest comments"
154.
$ss["en"]["seconds"] = "seconds"
155.
$ss["en"]["original"]= "Click here to see the full-sized version of this image"
156.
 
157.
// Deutsch - de 
158.
$ss["de"]["next"]    = "Nächstes Bild"
159.
$ss["de"]["prev"]    = "Vorheriges Bild"
160.
$ss["de"]["slide"]   = "Automatischer Wechsel alle..."
161.
$ss["de"]["comments"]= "Kommentare"
162.
$ss["de"]["name"]    = "Name"
163.
$ss["de"]["message"] = "Kommentar"
164.
$ss["de"]["add"]     = "Meinen Kommentar abschicken"
165.
$ss["de"]["start"]   = "zum Anfang"
166.
$ss["de"]["selectl"] = "<<< Bitte wähle links ein Bild aus"
167.
$ss["de"]["selectr"] = "Bitte wählen sie rechts ein Bild aus"
168.
$ss["de"]["from"]    = "Von"
169.
$ss["de"]["recent"]  = "neueste Gastanmerkungen"
170.
$ss["de"]["seconds"] = "Sekunden"
171.
$ss["de"]["original"]= "Zur tatsächlichen Größenansicht wechseln"
172.
 
173.
 
174.
// Please send me more translations! :-) 
175.
//////////////////////////////////////////////////////////////////////////////// 
176.
 
177.
 
178.
/// Convert any external variables into internal ones 
179.
/// (avoids warnings on secure installations) 
180.
 
181.
$admin = isset($HTTP_GET_VARS["admin"]) ? $HTTP_GET_VARS["admin"] : ""
182.
if (! $admin) { 
183.
    $admin = isset($HTTP_POST_VARS["admin"]) ? $HTTP_POST_VARS["admin"] : ""
184.
185.
$editcaption = isset($HTTP_GET_VARS["editcaption"]) ? $HTTP_GET_VARS["editcaption"] : ""
186.
if (! $editcaption) { 
187.
    $editcaption = isset($HTTP_POST_VARS["editcaption"]) ? $HTTP_POST_VARS["editcaption"] : ""
188.
189.
$newcaption = isset($HTTP_POST_VARS["newcaption"]) ? $HTTP_POST_VARS["newcaption"] : ""
190.
$upload = isset($HTTP_POST_VARS["upload"]) ? $HTTP_POST_VARS["upload"] : ""
191.
$uploadcount = isset($HTTP_POST_VARS["uploadcount"]) ? $HTTP_POST_VARS["uploadcount"] : 0; 
192.
$imagefile = isset($HTTP_POST_FILES["imagefile"]) ? $HTTP_POST_FILES["imagefile"] : ""
193.
$logout = isset($HTTP_GET_VARS["logout"]) ? $HTTP_GET_VARS["logout"] : ""
194.
$intro = isset($HTTP_GET_VARS["intro"]) ? $HTTP_GET_VARS["intro"] : ""
195.
$recent = isset($HTTP_GET_VARS["recent"]) ? $HTTP_GET_VARS["recent"] : ""
196.
$margin = isset($HTTP_GET_VARS["margin"]) ? $HTTP_GET_VARS["margin"] : ""
197.
$image = isset($HTTP_GET_VARS["image"]) ? $HTTP_GET_VARS["image"] : ""
198.
$deleteimage   = isset($HTTP_GET_VARS["deleteimage"]) ? $HTTP_GET_VARS["deleteimage"] : ""
199.
$dcomment = isset($HTTP_GET_VARS["dcomment"]) ? $HTTP_GET_VARS["dcomment"] : ""
200.
$ctype = isset($HTTP_GET_VARS["ctype"]) ? $HTTP_GET_VARS["ctype"] : ""
201.
$acomment = isset($HTTP_GET_VARS["acomment"]) ? $HTTP_GET_VARS["acomment"] : ""
202.
$originalimage = isset($HTTP_GET_VARS["originalimage"]) ? $HTTP_GET_VARS["originalimage"] : ""
203.
$slide = isset($HTTP_GET_VARS["slide"]) ? $HTTP_GET_VARS["slide"] : "0"
204.
 
205.
$comment = isset($HTTP_POST_VARS["comment"]) ? $HTTP_POST_VARS["comment"] : ""
206.
$name = isset($HTTP_POST_VARS["name"]) ? $HTTP_POST_VARS["name"] : ""
207.
$message = isset($HTTP_POST_VARS["message"]) ? $HTTP_POST_VARS["message"] : ""
208.
$PFCOOKIE = isset($HTTP_COOKIE_VARS["PFCOOKIE"]) ? $HTTP_COOKIE_VARS["PFCOOKIE"] : ""
209.
 
210.
 
211.
/// Check that Image processing is available /// 
212.
 
213.
switch ($imagemethod) { 
214.
   case "imagemagick"
215.
      if (!is_executable("$convert")) { 
216.
          PrintHeader(); 
217.
          PrintError("Sorry, but I couldn't find the Imagemagick program that 
218.
                      you specified to convert images ($convert).<BR> 
219.
                      Check the configuration of this script and your server."); 
220.
          die
221.
222.
      if (!is_executable("$identify")) { 
223.
          PrintHeader(); 
224.
          PrintError("Sorry, but I couldn't find the Imagemagick program that 
225.
                      you specified to identify images ($identify).<BR> 
226.
                      Check the configuration of this script and your server."); 
227.
          die
228.
229.
      break
230.
   case "gd2"
231.
      if (!function_exists("ImageCreateTrueColor")) { 
232.
          PrintHeader(); 
233.
          PrintError("Sorry, but I couldn't find the GD 2.* functions that 
234.
                      I need to convert images.  Check the configuration of 
235.
                      this script (imagemethod variable) or your system. 
236.
                      Make sure that your copy of PHP has been compiled with 
237.
                      GD support and native JPEG support eg<BR> 
238.
                      configure --with-gd --with-jpeg ..."); 
239.
          die
240.
241.
      break
242.
   case "gd1"
243.
      if (!function_exists("ImageCreate")) { 
244.
          PrintHeader(); 
245.
          PrintError("Sorry, but I couldn't find the GD 1.* functions that 
246.
                      I need to convert images.  Check the configuration of 
247.
                      this script (imagemethod variable) or your system. 
248.
                      Make sure that your copy of PHP has been compiled with 
249.
                      GD support and native JPEG support eg<BR> 
250.
                      configure --with-gd --with-jpeg ..."); 
251.
          die
252.
253.
      break
254.
255.
 
256.
/// Check that support for reading image captions is available 
257.
 
258.
switch ($captionmethod) { 
259.
   case "imagemagick"
260.
      if (!is_executable("$identify")) { 
261.
          PrintHeader(); 
262.
          PrintError("Sorry, but I couldn't find the Imagemagick program that 
263.
                      you specified to read image captions ($identify).<BR> 
264.
                      Check the configuration of this script and your server.<BR> 
265.
                      Maybe you just want to change the captionmethod variable to \"capfile\""); 
266.
          die
267.
268.
      break
269.
   case "rdjpgcom"
270.
      if (!is_executable("$rdjpgcom")) { 
271.
          PrintHeader(); 
272.
          PrintError("Sorry, but I couldn't find the program that 
273.
                      you specified to read image captions ($rdjpgcom).<BR> 
274.
                      Check the configuration of this script and your server.<BR> 
275.
                      Maybe you just want to change the captionmethod variable to \"capfile\""); 
276.
          die
277.
278.
      break
279.
280.
 
281.
 
282.
 
283.
/// Functions /// 
284.
 
285.
function RemoveNewLines (&$item, $key) { 
286.
   $item = chop($item); 
287.
288.
 
289.
function GetFileList( $dirname="." ) {   // Finds all the images 
290.
   // First check to see if there's a file called $sortfile 
291.
   // that contains a sorted list of filenames, one per line 
292.
   // otherwise, will default to all files in alphabetical order 
293.
   global $sortfile, $sortreverse
294.
 
295.
   $files = array(); 
296.
 
297.
   if (file_exists($sortfile)) { 
298.
      $files = file($sortfile); 
299.
      array_walk($files, 'RemoveNewLines'); 
300.
   } else
301.
      $dir = opendir( $dirname ); 
302.
      while( $file = readdir( $dir ) ) { 
303.
         if (eregi("\.jpe?g$", $file) || 
304.
             eregi("\.gif$", $file) || 
305.
             eregi("\.png$", $file)) { 
306.
             $files[] = $file
307.
308.
309.
      if ($sortreverse) { 
310.
          rsort($files); 
311.
      } else
312.
          sort($files); 
313.
314.
315.
   return $files
316.
317.
 
318.
function GetNeighbours($imagelist, $currimage, &$previmage, &$nextimage) { 
319.
   // For a given image, return the next and previous ones 
320.
   $lastimage = count($imagelist) - 1; 
321.
   for ( $i=0; $i<=$lastimage; $i++) { 
322.
       if ($imagelist[$i] == $currimage) { 
323.
           if ($i == 0) { 
324.
               $nextimage = $imagelist[$i+1]; 
325.
               $previmage = NULL; 
326.
               return
327.
           } else if ($i == $lastimage) { 
328.
               $previmage = $imagelist[$i-1]; 
329.
               $nextimage = NULL; 
330.
               return
331.
           } else
332.
               $previmage = $imagelist[$i-1]; 
333.
               $nextimage = $imagelist[$i+1]; 
334.
               return
335.
336.
337.
338.
   $previmage = NULL; 
339.
   $nextimage = NULL; 
340.
   return
341.
 
342.
343.
 
344.
function PrintError($message) { 
345.
   echo "<P ALIGN=CENTER><FONT COLOR=RED>Error: $message</FONT></P>"
346.
347.
 
348.
function PrintHeader($pagetitle="", $meta="") { 
349.
// Special case when meta = "margin" 
350.
   global $headerfile
351.
   global $stylesheet
352.
   global $lang
353.
   global $pagecolor, $margincolor, $textcolor, $linkcolor, $vlinkcolor, $background
354.
 
355.
   if ($lang == "ar") {   /// Hack for Arabic, Hebrew and other right-to-left languages 
356.
      echo "<HTML dir=RTL>"
357.
358.
   echo "<HEAD>"
359.
   echo "<TITLE>Galerie</TITLE>"
360.
   echo "<META HTTP-EQUIV=\"content-language\" CONTENT=\"$lang\">"
361.
   if ($meta and $meta != "margin") { 
362.
       echo "$meta\n"
363.
364.
   if ($stylesheet) { 
365.
       echo "<LINK REL=\"stylesheet\" HREF=\"$stylesheet\">"
366.
367.
   echo "</HEAD> 
368.
 
369.
<style type='text/css'> 
370.
body { 
371.
scrollbar-face-color: #616387; 
372.
scrollbar-highlight-color: #FF9428; 
373.
scrollbar-3dlight-color: #3A3C69; 
374.
scrollbar-darkshadow-color: #3A3C69; 
375.
scrollbar-shadow-color: #FFFFFF; 
376.
scrollbar-arrow-color: #FF9428; 
377.
scrollbar-track-color: #616387; 
378.
379.
</style>"; 
380.
 
381.
   if ($meta == "margin" and $margincolor) { 
382.
       echo "<BODY onLoad='window.resizeTo(800, 600)' BGCOLOR=\"$margincolor\" TEXT=\"$textcolor\" "
383.
 
384.
 
385.
   } else
386.
       echo "<BODY onLoad='window.resizeTo(800, 600)' BGCOLOR=\"$pagecolor\" TEXT=\"$textcolor\" "
387.
388.
   echo " LINK=\"$linkcolor\" VLINK=\"$vlinkcolor\" BACKGROUND=\"$background\" BGPROPERTIES=\"fixed\">"
389.
 
390.
   if ($meta != "margin" && file_exists($headerfile)) { 
391.
       include($headerfile); 
392.
393.
394.
 
395.
 
396.
function PrintFooter() { 
397.
   global $footerfile
398.
  global $title
399.
 
400.
   if (file_exists($footerfile)) { 
401.
    include($footerfile); 
402.
  } else
403.
      echo "<CENTER>&copy; Katholische Jugend Bietzerberg"
404.
 
405.
      // echo "<a href=\"javascript:window.close()\">Close Window</a>"
406.
 
407.
      //echo "<A TITLE=\"Back to the introduction page\" TARGET=_parent HREF=\".\" ><< Zurück zur Übersicht</A></P>\n"
408.
409.
   echo "</BODY>"
410.
411.
 
412.
 
413.
function PrintRecentComments($recent) { 
414.
   global $thumb, $marginsize, $marginside, $scriptname
415.
   global $ss, $lang, $timeoffset
416.
 
417.
   if (! $recent) { 
418.
      return
419.
420.
 
421.
   $imagelist = GetFileList(); 
422.
 
423.
   $comments = array(); 
424.
 
425.
   foreach ($imagelist as $filename) { 
426.
      $commentfile = "$thumb/$filename.txt"
427.
      if (file_exists($commentfile)) { 
428.
         $file = file($commentfile); 
429.
         foreach ($file as $line) { 
430.
            $line = chop($line)."###$filename"
431.
            $comments[] = $line
432.
433.
434.
435.
   rsort($comments); 
436.
   $count = 0; 
437.
 
438.
   echo "</CENTER></P>";   // Just in case
439.
   echo "<BR><H3 ALIGN=CENTER>$recent ".$ss[$lang]["recent"].":</H3>"
440.
   foreach ($comments as $comment) { 
441.
      $comm = explode ("###", $comment); 
442.
      $image = $comm[3]; 
443.
      $caption = GetImageCaption($image, $clean=true); 
444.
      $thumbimage = "$thumb/$image"
445.
      $image      = rawurlencode($image); 
446.
 
447.
      echo "<TABLE ALIGN=CENTER WIDTH=\"90%\"><TR><TD COLSPAN=2><HR></TD></TR>"
448.
      echo "<TR>"
449.
      if ($marginside != "right") { 
450.
         echo "<TD VALIGN=TOP WIDTH=\"100%\">"
451.
         echo "<FONT SIZE=2>"
452.
         echo $ss[$lang]["from"].": <B>".$comm[1]."</B>, <I>".date("l, j F Y, g:i A", $comm[0]+($timeoffset*3600))."</I><BR>"
453.
         echo "<UL>".$comm[2]."</UL></FONT>"
454.
         if (isadmin()) { 
455.
            echo "<P ALIGN=right><FONT SIZE=1><A HREF=\"$scriptname?image=$image&dcomment=".$comm[0]."\">delete</A></FONT></P>"
456.
457.
         echo "</TD>"
458.
459.
 
460.
      echo "<TD WIDTH=\"$marginsize\">"
461.
      echo "<A TITLE=\"$caption\" HREF=\"$scriptname?image=$image&d=d.html\" TARGET=imain>"
462.
      if (file_exists($thumbimage)) { 
463.
         echo "<IMG HSPACE=10 ALT=\"$caption\" SRC=\"$thumb/$image\" BORDER=0>"
464.
      } else
465.
         echo "<FONT SIZE=1>$caption</FONT>"
466.
467.
      echo "</A>"
468.
      echo "</TD>"
469.
 
470.
      if ($marginside == "right") { 
471.
         echo "<TD VALIGN=TOP WIDTH=\"100%\">"
472.
         echo "<FONT SIZE=2>"
473.
         echo $ss[$lang]["from"].": <B>".$comm[1]."</B>, <I>".date("l, j F Y, g:i A", $comm[0]+($timeoffset*3600))."</I><BR>"
474.
         echo "<UL>".$comm[2]."</UL></FONT>"
475.
         if (isadmin()) { 
476.
            echo "<P ALIGN=right><FONT SIZE=1><A HREF=\"$scriptname?image=$image&dcomment=".$comm[0]."\">delete</A></FONT></P>"
477.
478.
         echo "</TD>"
479.
480.
 
481.
      echo "</TR></TABLE>\n"
482.
 
483.
      $count++; 
484.
      if ($count >= $recent) { 
485.
         break
486.
487.
488.
   echo "<HR>\n"
489.
490.
 
491.
function PrintComments($imagefile) { 
492.
   // Given an image imagefile, finds, reads and formats the 
493.
   // associated file of guest comments 
494.
   global $thumb, $ss, $lang, $timeoffset, $scriptname, $moderate
495.
 
496.
   $commentfiles["main"] = "$thumb/$imagefile.txt"
497.
   if ($moderate) { 
498.
       $commentfiles["unmoderated"] = "$thumb/$imagefile.mod"
499.
500.
 
501.
   $filename = rawurlencode($imagefile); 
502.
 
503.
   echo "<BLOCKQUOTE><BLOCKQUOTE><HR>\n"
504.
 
505.
   foreach ($commentfiles as $commenttype => $commentfile) { 
506.
      if ($commenttype == "unmoderated" and !isadmin()) { 
507.
          continue
508.
509.
      if (file_exists($commentfile)) { 
510.
         $comments = file($commentfile); 
511.
         foreach ($comments as $comment) { 
512.
 
513.
            $comm = explode ("###", $comment); 
514.
 
515.
            echo "<FONT SIZE=2>"
516.
            echo $ss[$lang]["from"].": <B>".$comm[1]."</B>, <I>".date("l, j F Y, g:i A", $comm[0]+($timeoffset*3600))."</I><BR>"
517.
            echo "<UL>".$comm[2]."</UL></FONT>\n"
518.
            if (isadmin()) { 
519.
               echo "<P ALIGN=right><FONT SIZE=1>"
520.
               if ($commenttype == "unmoderated") { 
521.
                   echo "<A HREF=\"$scriptname?image=$filename&acomment=".$comm[0]."\">approve</A> "
522.
                   echo "<A HREF=\"$scriptname?image=$filename&dcomment=".$comm[0]."&ctype=mod\">delete</A>"
523.
               } else
524.
                   echo "<A HREF=\"$scriptname?image=$filename&dcomment=".$comm[0]."\">delete</A>"
525.
526.
               echo "</FONT></P>"
527.
528.
            echo "<HR SIZE=1>"
529.
530.
531.
532.
   echo "</BLOCKQUOTE></BLOCKQUOTE>"
533.
 
534.
535.
 
536.
function DeleteComment($filename, $dcomment, $ctype="") { 
537.
   // Given an image filename and a comment ID (time) to 
538.
   // delete, it reads the file and rewrites it, leaving 
539.
   // out the specified line.   Returns the deleted line. 
540.
 
541.
   global $thumb, $ss, $lang, $timeoffset, $scriptname
542.
 
543.
   if ($ctype == "mod") { 
544.
      $commentfile = "$thumb/$filename.mod"
545.
   } else
546.
      $commentfile = "$thumb/$filename.txt"
547.
548.
 
549.
   $len = strlen($dcomment); 
550.
 
551.
   if (file_exists($commentfile)) { 
552.
      $comments = file($commentfile); 
553.
      rename($commentfile, $commentfile.".bak"); 
554.
      if ($file = fopen ($commentfile, "a")) { 
555.
         foreach ($comments as $comment) { 
556.
            if (substr($comment, 0, $len) == $dcomment) { 
557.
               $deletedcomment = $comment
558.
            } else
559.
               fwrite($file, "$comment"); 
560.
561.
562.
         unlink($commentfile.".bak"); 
563.
      } else {   // some error occurred ... try to undo the mess 
564.
         PrintError("Could not delete comment from file!"); 
565.
         rename($commentfile.".bak", $commentfile); 
566.
567.
   } else
568.
      PrintError("No comments exist for this image! ($filename)"); 
569.
570.
 
571.
   return $deletedcomment
572.
 
573.
574.
 
575.
 
576.
function ApproveComment($filename, $commentid) { 
577.
   // Given an image filename and a comment ID (time) to 
578.
   // approve, it moves the comment from the .mod file 
579.
   // to the .txt file 
580.
 
581.
   if ($commentline = DeleteComment($filename, $commentid, "mod")) { 
582.
      AddComment($filename, "", "", $commentline); 
583.
      echo "<P ALIGN=CENTER>That message has been approved</P>"
584.
585.
586.
 
587.
 
588.
function PrintCommentForm($filename) { 
589.
    global $scriptname, $textcolor, $pagecolor
590.
    global $ss, $lang
591.
 
592.
 
593.
?> 
594.
 
595.
<FORM ACTION=<?PHP echo $scriptname ?> METHOD=POST> 
596.
<INPUT TYPE=hidden NAME=comment VALUE="<?PHP echo $filename?>"
597.
<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0 ALIGN=CENTER BGCOLOR=#BBBBBB> 
598.
<TR><TD><TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%" BGCOLOR="<?PHP echo $pagecolor?>"
599.
   <TR> 
600.
       <TD ALIGN=right><FONT SIZE=2 COLOR="<?PHP echo $textcolor?>"
601.
           <B><?PHP echo $ss[$lang]["name"] ?>:</B></FONT></TD> 
602.
       <TD><FONT SIZE=2 COLOR="<?PHP echo $textcolor?>"
603.
           <INPUT size=50 type=text name="name"></FONT></TD> 
604.
   </TR> 
605.
   <TR> 
606.
       <TD ALIGN=right valign=top><FONT SIZE=2 COLOR="<?PHP echo $textcolor?>"
607.
           <B><?PHP echo $ss[$lang]["message"] ?>:</B></FONT></TD> 
608.
       <TD><FONT SIZE=2 COLOR="<?PHP echo $textcolor?>"
609.
           <TEXTAREA name="message" rows=4 cols=40></TEXTAREA></FONT></TD> 
610.
   </TR> 
611.
   <TR> 
612.
       <TD ALIGN=CENTER COLSPAN=2> 
613.
           <FONT SIZE=2 COLOR="<?PHP echo $textcolor?>"
614.
           <INPUT type=submit value="<?PHP echo $ss[$lang]["add"] ?>"></FONT> 
615.
       </TD> 
616.
   </TR> 
617.
</TABLE></TD></TR></TABLE> 
618.
</FORM> 
619.
 
620.
<?PHP 
621.
622.
 
623.
 
624.
function AddComment($filename, $name, $message, $messageline="") { 
625.
   // Clean up a given comment and add to the appropriate database 
626.
   global $thumb, $email, $title, $moderate, $HTTP_SERVER_VARS
627.
 
628.
   if (!$REMOTE_HOST = $HTTP_SERVER_VARS["REMOTE_HOST"]) { 
629.
       $REMOTE_HOST = $HTTP_SERVER_VARS["REMOTE_ADDR"]; 
630.
631.
   $SERVER_NAME = $HTTP_SERVER_VARS["SERVER_NAME"]; 
632.
   $REQUEST_URI = $HTTP_SERVER_VARS["REQUEST_URI"]; 
633.
 
634.
   if (ereg( "\\.\\.", $filename)) {  // using ".." in the filename 
635.
       PrintError("That filename ($filename) was not secure."); 
636.
       return
637.
638.
 
639.
   if (!$name and !$messageline) { 
640.
       PrintError("You need to fill out your name."); 
641.
       return
642.
643.
   if (!$message and !$messageline) { 
644.
       PrintError("There was no message to post."); 
645.
       return
646.
647.
 
648.
   if ($moderate and !$messageline) { 
649.
       $commentfile = "$thumb/$filename.mod"
650.
   } else
651.
       $commentfile = "$thumb/$filename.txt"
652.
653.
 
654.
   if ($file = fopen ($commentfile, "a") ) { 
655.
       if ($messageline) { 
656.
          fwrite($file, "$messageline"); 
657.
 
658.
       } else
659.
          $timenow = time(); 
660.
          $name    = strip_tags($name); 
661.
          $message = stripslashes(strip_tags($message, "<a><b>")); 
662.
 
663.
          if ($email) {   // Try and send the comment via email 
664.
              $urlstart = "http://$SERVER_NAME$REQUEST_URI?image=".rawurlencode($filename); 
665.
              if ($moderate) { 
666.
                 $approveurl = "Approve: $urlstart&acomment=$timenow\n\n"
667.
                 $deleteurl = "Delete: $urlstart&dcomment=$timenow&ctype=mod\n\n"
668.
              } else
669.
                 $deleteurl = "Delete: $urlstart&dcomment=$timenow\n\n"
670.
671.
              mail($email, "Comment added: $title"
672.
                   "From: $name ($REMOTE_HOST)\n\n"
673.
                   "$message\n\n"
674.
                   "http://$SERVER_NAME$REQUEST_URI?image=".rawurlencode($filename)."\n\n"
675.
                   $approveurl . $deleteurl
676.
                   "From: $email"); 
677.
678.
 
679.
          $message = nl2br($message); 
680.
          $message = strtr($message, "\r", " "); 
681.
          $message = strtr($message, "\n", " "); 
682.
          fwrite($file, "$timenow###$name###$message\n"); 
683.
684.
       fclose($file); 
685.
 
686.
   } else
687.
       PrintError("Could not add comment for $filename"); 
688.
689.
690.
 
691.
 
692.
function CleanCaption ($caption) { 
693.
   $caption = strtr($caption, "\r", " "); 
694.
   $caption = strtr($caption, "\n", " "); 
695.
   $caption = htmlentities(strip_tags($caption)); 
696.
   return $caption
697.
698.
 
699.
 
700.
function GetImageCaption($image, $clean=false) { 
701.
   global $thumb, $captionmethod, $rdjpgcom, $identify
702.
 
703.
   $caption = ""
704.
 
705.
   switch ($captionmethod) { 
706.
      case "imagemagick"
707.
         if (file_exists($image)) { 
708.
            Exec("$identify -ping -format \"%c\" \"$image\"", $captionlines); 
709.
         } else
710.
	        return ""
711.
712.
      break
713.
      case "rdjpgcom"
714.
         if (file_exists($image)) { 
715.
            Exec("$rdjpgcom \"$image\"", $captionlines); 
716.
         } else
717.
	        return ""
718.
719.
      break
720.
      case "capfile"
721.
         $capfile = "$thumb/$image".".cap"
722.
         if (file_exists($capfile)) { 
723.
            $captionlines = file($capfile); 
724.
         } else
725.
	        return ""
726.
727.
      break
728.
      case "filename"
729.
          return $image
730.
      break
731.
      default
732.
         return ""
733.
      break
734.
735.
 
736.
   foreach ($captionlines as $captionline) { 
737.
      $caption .= "$captionline "
738.
739.
 
740.
   $caption = stripslashes($caption); 
741.
 
742.
   if ($clean) { 
743.
      $caption = CleanCaption($caption); 
744.
745.
 
746.
   return $caption
747.
748.
 
749.
function SetImageCaption($image, $caption) { 
750.
   global $thumb, $captionmethod, $wrjpgcom
751.
 
752.
   $TEMPFILE = "$thumb/ttttmpfile.jpg"
753.
 
754.
   if (file_exists($TEMPFILE)) { 
755.
      unlink($TEMPFILE); 
756.
757.
 
758.
   $caption = stripslashes($caption); 
759.
 
760.
   switch ($captionmethod) { 
761.
      case "rdjpgcom"
762.
         if (!eregi("\.jpe?g$", $image)) { 
763.
            PrintError("$image is probably not a JPEG file"); 
764.
            return false; 
765.
766.
         $command = "$wrjpgcom -replace -comment ".EscapeShellArg($caption)." ".EscapeShellArg($image); 
767.
         Exec("$command > $TEMPFILE"); 
768.
         if (file_exists($TEMPFILE) and filesize($TEMPFILE) > 0) { 
769.
            return rename($TEMPFILE, $image); 
770.
771.
      break
772.
      case "capfile"
773.
         $capfile = "$thumb/$image".".cap"
774.
         if (! $file = fopen ($capfile, "w")) { 
775.
            PrintError("Could not open the caption file $capfile"); 
776.
            return false; 
777.
778.
         if (! fwrite($file, $caption)) { 
779.
            PrintError("Could not write the caption to the caption file $capfile"); 
780.
            return false; 
781.
782.
	     return true; 
783.
      break
784.
785.
 
786.
   return false; 
787.
788.
 
789.
function ReadImageFromFile($filename, $type) { 
790.
   $imagetypes = ImageTypes(); 
791.
 
792.
   switch ($type) { 
793.
      case 1 : 
794.
         if ($imagetypes & IMG_GIF) 
795.
             return $im = ImageCreateFromGIF($filename); 
796.
         break
797.
      case 2 : 
798.
         if ($imagetypes & IMG_JPEG) 
799.
             return ImageCreateFromJPEG($filename); 
800.
         break
801.
      case 3 : 
802.
         if ($imagetypes & IMG_PNG) 
803.
             return ImageCreateFromPNG($filename); 
804.
         break
805.
      default
806.
         return 0; 
807.
808.
809.
 
810.
function WriteImageToFile($im, $filename, $type) { 
811.
   global $imagequality
812.
 
813.
   switch ($type) { 
814.
      case 1 : 
815.
         return ImageGIF($im, $filename); 
816.
      case 2 : 
817.
         return ImageJpeg($im, $filename, $imagequality); 
818.
      case 3 : 
819.
         return ImagePNG($im, $filename); 
820.
      default
821.
         return false; 
822.
823.
824.
 
825.
 
826.
function ResizeImage($image, $newimage, $newwidth, $newheight=0) { 
827.
// Returns true if new image was created, else false 
828.
// If newheight is not specified then image is scaled in proportion 
829.
// to newwidth.  If newheight is specified, then newheight and newwidth 
830.
// represent a bounding box to fit image into 
831.
   global $imagemethod
832.
 
833.
   switch ($imagemethod) { 
834.
      case "imagemagick"
835.
         return ResizeImageUsingIM($image, $newimage, $newwidth, $newheight); 
836.
      break
837.
      case "gd1"
838.
      case "gd2"
839.
         return ResizeImageUsingGD($image, $newimage, $newwidth, $newheight); 
840.
      break
841.
      case "manual"
842.
         return true; 
843.
      break
844.
      default
845.
         return false; 
846.
      break
847.
848.
849.
 
850.
function ResizeImageUsingGD($image, $newimage, $newwidth, $newheight) { 
851.
   global $imagemethod
852.
 
853.
   $size = GetImageSize($image); 
854.
   $width  = $size[0]; 
855.
   $height = $size[1]; 
856.
   $type   = $size[2]; 
857.
 
858.
   if ($im = ReadImageFromFile($image, $type)) { 
859.
      if ($newheight && ($width < $height)) { 
860.
         $newwidth = ($newheight / $height) * $width
861.
      } else
862.
         $newheight = ($newwidth / $width) * $height
863.
864.
      if ($imagemethod == "gd2") { 
865.
         $im2 = ImageCreateTrueColor($newwidth,$newheight); 
866.
      } else
867.
         $im2 = ImageCreate($newwidth,$newheight); 
868.
869.
      if ($imagemethod == "gd2") { 
870.
          ImageCopyResampled($im2,$im,0,0,0,0,$newwidth,$newheight,$width,$height); 
871.
      } else
872.
          ImageCopyResized($im2,$im,0,0,0,0,$newwidth,$newheight,$width,$height); 
873.
874.
 
875.
      if (WriteImageToFile($im2, $newimage, $type)) { 
876.
          return true; 
877.
878.
879.
   return false; 
880.
881.
 
882.
function ResizeImageUsingIM($image, $newimage, $newwidth, $newheight) { 
883.
   global $identify, $convert, $imagequality
884.
 
885.
   Exec("$identify -ping -format \"%w %h\" \"$image\"", $sizeinfo); 
886.
 
887.
   if (! $sizeinfo ) { 
888.
      return false; 
889.
890.
   $size = explode(" ", $sizeinfo[0]); 
891.
   $width  = $size[0]; 
892.
   $height = $size[1]; 
893.
 
894.
   if (!$width) { 
895.
      return false; 
896.
897.
 
898.
   if ($newheight && ($width < $height)) { 
899.
      $newwidth = ($newheight / $height) * $width
900.
   } else
901.
      $newheight = ($newwidth / $width) * $height
902.
903.
 
904.
   Exec("$convert -geometry \"$newwidth"."x"."$newheight\" -quality \"$imagequality\" \"$image\" \"$newimage\""); 
905.
 
906.
   return file_exists($newimage); 
907.
908.
 
909.
 
910.
function PrintSlideshowForm ($nextimage, $slide=0) { 
911.
   global $scriptname
912.
   global $ss, $lang
913.
 
914.
   $common = "$scriptname?image=$nextimage&slide="
915.
   $options = array (2 => "2 ".$ss[$lang]["seconds"], 
916.
                     5 => "5 ".$ss[$lang]["seconds"], 
917.
                     7 => "7 ".$ss[$lang]["seconds"], 
918.
                     10 => "10 ".$ss[$lang]["seconds"], 
919.
                     20 => "20 ".$ss[$lang]["seconds"], 
920.
                     30 => "30 ".$ss[$lang]["seconds"], 
921.
                     40 => "40 ".$ss[$lang]["seconds"], 
922.
                     50 => "50 ".$ss[$lang]["seconds"], 
923.
                     60 => "60 ".$ss[$lang]["seconds"]); 
924.
 
925.
   echo "<FORM NAME=auto>"
926.
   echo "<SELECT NAME=popup onChange=\"window.location=document.auto.popup.options[document.auto.popup.selectedIndex].value\">\n"
927.
 
928.
   echo "   <OPTION VALUE=\"javascript:void(0)\">".$ss[$lang]["slide"]."...</OPTION>\n"
929.
   foreach ($options as $value => $label) { 
930.
      echo "   <OPTION VALUE=\"$common$value\""
931.
      if ($value == $slide) { 
932.
         echo " SELECTED"
933.
934.
      if ($label) { 
935.
         echo ">$label</OPTION>\n"
936.
      } else
937.
         echo ">$value</OPTION>\n"
938.
939.
940.
   echo "</SELECT></FORM>"
941.
942.
 
943.
 
944.
function isadmin() { 
945.
    global $password, $PFCOOKIE
946.
 
947.
    if ($password and isset($PFCOOKIE)) { 
948.
        if ($PFCOOKIE == md5($password) ) { 
949.
            return true; 
950.
951.
952.
    return false; 
953.
954.
 
955.
function clean_filename($string) { 
956.
    $string = eregi_replace("\.\.", "", $string); 
957.
    $string = eregi_replace("[^([:alnum:]|\.)]", "_", $string); 
958.
    return    eregi_replace("_+", "_", $string); 
959.
960.
 
961.
 
962.
 
963.
/// Individual pages are created here /// 
964.
 
965.
if ($admin) { 
966.
   if (isadmin()) { 
967.
       $intro = "true"
968.
 
969.
   } else if ($admin == $password) { 
970.
       $seconds = 60*60*24*354; 
971.
       setCookie ('PFCOOKIE', "", time() - 3600, "/"); 
972.
       setCookie ('PFCOOKIE', md5($admin), time()+$seconds, "/"); 
973.
       $PFCOOKIE = md5($admin); 
974.
       $intro = "true"
975.
 
976.
   } else
977.
       PrintHeader("Administrator Login"); 
978.
       echo "<CENTER>"
979.
       echo "<P>&nbsp;</P>"
980.
       echo "<FORM METHOD=POST ACTION=\"$scriptname\">"
981.
       echo "Admin Password: <INPUT NAME=admin TYPE=password SIZE=20>"
982.
       echo "<INPUT TYPE=submit VALUE=\"Enter\">"
983.
       echo "</FORM>"
984.
       exit
985.
986.
987.
 
988.
if ($logout) { 
989.
   if (isadmin()) { 
990.
       $seconds = 60*60*24*354; 
991.
       setCookie ('PFCOOKIE', "", time() - 3600, "/"); 
992.
       $PFCOOKIE = NULL; 
993.
994.
   $intro = "true"
995.
996.
 
997.
if ($editcaption) { 
998.
   PrintHeader("Editing a caption"); 
999.
 
1000.
   $image = urldecode($editcaption); 
1001.
 
1002.
   if (!isadmin()) { 
1003.
       PrintError("This is an admin-only function"); 
1004.
       die
1005.
1006.
   if (ereg( "\\.\\.", $image)) {  // using ".." in the filename 
1007.
       PrintError("That filename ($image) was not secure."); 
1008.
       die
1009.
1010.
   if ($captionmethod == "rdjpgcom" or $captionmethod == "capfile") { 
1011.
       if ($newcaption) { 
1012.
           if (! SetImageCaption($image, $newcaption)) { 
1013.
               PrintError("Could not save the new caption, sorry"); 
1014.
1015.
           echo "<CENTER>"
1016.
           echo "<P>&nbsp;</P>"
1017.
           echo "<P>Caption saved.</P>"
1018.
           echo "<P><A HREF=\"$scriptname?image=$editcaption\">Continue</A></P>"
1019.
       } else
1020.
           $caption = stripslashes(GetImageCaption($image)); 
1021.
           echo "<CENTER>"
1022.
           echo "<P>&nbsp;</P>"
1023.
           echo "<P>Caption for \"$image\"</P>"
1024.
           echo "<FORM ACTION=$scriptname METHOD=post>"
1025.
           echo "<TEXTAREA NAME=newcaption ROWS=3 COLS=50>$caption</TEXTAREA><BR>"
1026.
           echo "<INPUT TYPE=hidden NAME=editcaption value=\"$editcaption\">"
1027.
           echo "<INPUT TYPE=submit VALUE=\"Save caption\">"
1028.
           echo "</FORM>"
1029.
1030.
 
1031.
   } else
1032.
       PrintError("You can't edit captions unless $captionmethod is rdjpgcom or capfile"); 
1033.
1034.
   die
1035.
1036.
 
1037.
 
1038.
if ($deleteimage) { 
1039.
   PrintHeader("Deleting an image"); 
1040.
 
1041.
   if (!isadmin()) { 
1042.
       PrintError("This is an admin-only function"); 
1043.
       die
1044.
1045.
   if (ereg( "\\.\\.", $deleteimage)) {  // using ".." in the filename 
1046.
       PrintError("That filename ($deleteimage) was not secure."); 
1047.
       die
1048.
1049.
 
1050.
   if (! unlink($deleteimage) ) { 
1051.
       PrintError("An error occurred while deleting the image - try doing it manually."); 
1052.
   } else
1053.
       echo "<P ALIGN=CENTER>Image deleted</P>"
1054.
1055.
 
1056.
   if (file_exists("$thumb/$deleteimage")) { 
1057.
       if (! unlink("$thumb/$deleteimage")) { 
1058.
           PrintError("An error occurred while deleting the thumbnail ($thumb/$deleteimage)"); 
1059.
       } else
1060.
           echo "<P ALIGN=CENTER>Thumbnail image deleted</P>"
1061.
1062.
1063.
   if (file_exists("$thumb/$imageresize$deleteimage")) { 
1064.
       if (! unlink("$thumb/$imageresize$deleteimage")) { 
1065.
           PrintError("An error occurred while deleting the reduced image ($thumb/$imageresize$deleteimage)"); 
1066.
       } else
1067.
           echo "<P ALIGN=CENTER>Reduced size image deleted</P>"
1068.
1069.
1070.
   if (file_exists("$thumb/$deleteimage.txt")) { 
1071.
       if (! unlink("$thumb/$deleteimage.txt")) { 
1072.
           PrintError("An error occurred while deleting the comments ($thumb/$deleteimage.txt)"); 
1073.
       } else
1074.
           echo "<P ALIGN=CENTER>Guest comments deleted</P>"
1075.
1076.
1077.
   if (file_exists("$thumb/$deleteimage.cap")) { 
1078.
       if (! unlink("$thumb/$deleteimage.cap")) { 
1079.
           PrintError("An error occurred while deleting the caption ($thumb/$deleteimage.cap)"); 
1080.
       } else
1081.
           echo "<P ALIGN=CENTER>Caption file deleted</P>"
1082.
1083.
1084.
 
1085.
   echo "<P ALIGN=CENTER><A TARGET=_parent HREF=\"$scriptname\">Continue</A></P>"
1086.
   die
1087.
1088.
 
1089.
if ($uploadcount) { 
1090.
   $uploadcount = (int)$uploadcount
1091.
   PrintHeader("Choosing $uploadcount files"); 
1092.
   if (!isadmin()) { 
1093.
       PrintError("This is an admin-only function"); 
1094.
       die
1095.
1096.
   echo "<TABLE ALIGN=CENTER><TR><TD>"
1097.
   echo "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"$scriptname\">"
1098.
   echo "<INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=5000000>"
1099.
   echo "<INPUT TYPE=hidden NAME=upload value=true>"
1100.
   echo "<DIV ALIGN=RIGHT>"
1101.
   for ($i=1; $i<=$uploadcount; $i++) { 
1102.
       echo " $i. <INPUT NAME=imagefile[] TYPE=file size=30><BR>"
1103.
1104.
   echo "</DIV><DIV ALIGN=CENTER>"
1105.
   echo "<BR><BR><INPUT TYPE=submit NAME=save VALUE=\"Upload these files\">"
1106.
   echo "</DIV>"
1107.
   echo "</FORM>"
1108.
   echo "</TD></TR></TABLE>"
1109.
   echo "<P ALIGN=CENTER><A TARGET=_parent HREF=\"$scriptname\">Cancel</A></P>"
1110.
   die
1111.
1112.
 
1113.
if ($upload) { 
1114.
   PrintHeader("Uploading and storing files"); 
1115.
   if (!isadmin()) { 
1116.
       PrintError("This is an admin-only function"); 
1117.
       die
1118.
1119.
   if (count($imagefile['name'])) { 
1120.
      foreach ($imagefile['name'] as $key => $name) { 
1121.
         if (is_uploaded_file($imagefile['tmp_name'][$key]) and $imagefile['size'][$key] > 0) { 
1122.
            $imagefile_name = clean_filename($name); 
1123.
            if ($imagefile_name) { 
1124.
               if (move_uploaded_file($imagefile['tmp_name'][$key], $imagefile_name)) { 
1125.
                   echo "<P ALIGN=CENTER>Uploaded $imagefile_name [".$imagefile['type'][$key]."]</P>"
1126.
               } else
1127.
                   PrintError("Could not store $imagefile_name in this directory"); 
1128.
1129.
            } else
1130.
               PrintError("This file had a wierd filename"); 
1131.
1132.
1133.
1134.
      echo "<P ALIGN=CENTER><A TARGET=_parent HREF=\"$scriptname\">Continue</A></P>"
1135.
      die
1136.
1137.
 
1138.
   $intro = "true"
1139.
1140.
 
1141.
 
1142.
if ($intro) {                       // Print initial info in main frame 
1143.
   PrintHeader($title); 
1144.
   if (file_exists($introfile)) { 
1145.
       include($introfile); 
1146.
   } else
1147.
       echo "<CENTER><b><font size=+3>Willkommen in der KJB-Galerie</font></b>"
1148.
       if ($marginside == "right") { 
1149.
           echo "<P>". $ss[$lang]["selectr"] ."</P>"
1150.
       } else
1151.
           echo "<P><FONT SIZE=+1>". $ss[$lang]["selectl"] ."</P></font>"
1152.
1153.
1154.
   if ($guestcomment && $recentcount) { 
1155.
       echo "<BR>"
1156.
       echo "<P align=center><A HREF=\$scriptname?recent=$recentcount\">"
1157.
       echo "$recentcount ". $ss[$lang]["recent"]; 
1158.
       echo "</A></P>"
1159.
1160.
   if (isadmin()) { 
1161.
       echo "<HR>"
1162.
       echo "<CENTER><P align=center>You are logged in as administrator</P>"
1163.
       echo "<FORM METHOD=\"post\" ACTION=\"$scriptname\">"
1164.
       echo "Upload <SELECT NAME=uploadcount>\n"
1165.
 
1166.
       echo "<OPTION VALUE=\"1\">1 file</OPTION>\n"
1167.
       for ($i=2; $i<100; $i++) { 
1168.
          echo "<OPTION VALUE=\"$i\">$i files</OPTION>\n"
1169.
1170.
       echo "</SELECT><INPUT TYPE=submit VALUE=\"now\">"
1171.
 
1172.
       echo "</FORM>"
1173.
       echo "<HR><P><A HREF=\"$scriptname?logout=true\">Log out</A></P>"
1174.
       echo "<HR>"
1175.
       echo "</CENTER>"
1176.
1177.
 
1178.
   PrintFooter(); 
1179.
   die
1180.
1181.
 
1182.
if ($recent) { 
1183.
   if ($guestcomment) { 
1184.
      PrintHeader("$title: Recent Comments"); 
1185.
      PrintRecentComments($recent); 
1186.
1187.
   echo "<P ALIGN=CENTER><A HREF=\"index.php\">".$ss[$lang]["start"]."</A></P>"
1188.
   die
1189.
1190.
 
1191.
if ($margin) {                      // Create a list of thumbnails 
1192.
   if (!file_exists($thumb)) { 
1193.
       if ( ! mkdir($thumb, 0755)) { 
1194.
           PrintError("Could not create thumb dir - check write permissions"); 
1195.
           die
1196.
1197.
1198.
 
1199.
   PrintHeader("$title: Thumbnails", "margin"); 
1200.
 
1201.
   $imagelist = GetFileList(); 
1202.
 
1203.
   echo "<P ALIGN=CENTER>"
1204.
   foreach ($imagelist as $image) { 
1205.
 
1206.
       $thumbimage = $thumb."/".$image
1207.
       $thumb_exists = file_exists($thumbimage); 
1208.
 
1209.
       if (!$thumb_exists) {   // Try to create the thumbnail 
1210.
          set_time_limit(30); 
1211.
          $thumbwidth = $margin - 20; 
1212.
 
1213.
          $thumb_exists = ResizeImage($image, $thumbimage, $thumbwidth); 
1214.
1215.
 
1216.
       if (! $caption = GetImageCaption($image, $clean=true)) { 
1217.
           $caption = $image
1218.
1219.
       $image      = rawurlencode($image); 
1220.
       $thumbimage = $thumb."/".$image
1221.
 
1222.
       if ($datenames) {  // Add date to comments 
1223.
           $imageyear = substr($image, 0, 4); 
1224.
           $imagemonth = substr($image, 4, 2); 
1225.
           $imageday = substr($image, 6, 2); 
1226.
           $caption = date("j-M-y ", mktime (0, 0, 0, $imagemonth, $imageday, $imageyear)) . $caption
1227.
1228.
 
1229.
       // The  d=d.html  was added to help dumb caches 
1230.
       echo "<A TITLE=\"$caption\" HREF=\"$scriptname?image=$image&d=d.html\" TARGET=imain>"
1231.
       if ($thumb_exists) { 
1232.
           echo "<IMG SRC=\"$thumbimage\" BORDER=0 ALT=\"$caption\">"
1233.
       } else
1234.
           echo "<FONT SIZE=2>$caption</FONT>"
1235.
1236.
       echo "</A><BR>\n"
1237.
1238.
   echo "</P>"
1239.
 
1240.
 
1241.
   if ($password) { 
1242.
       echo "<P ALIGN=CENTER><BR><FONT SIZE=1>"
1243.
       if (!isadmin()) { 
1244.
          echo "<A TITLE=\"Log in to modify this site\" TARGET=imain HREF=\"$scriptname?admin=true\">Admin</A>"
1245.
       } else
1246.
          echo "<A TITLE=\"Log out as administrator\" TARGET=imain HREF=\"$scriptname?logout=true\">Logout</A>"
1247.
1248.
       echo "</FONT></P>\n"
1249.
1250.
   echo "<P ALIGN=CENTER><BR><FONT SIZE=1><br><br>Made with<BR>"
1251.
   echo "<A TARGET=_top TITLE=\"Free software!\" HREF=\"http://photoframe.sourceforge.net/\">PhotoFrame $version</A></FONT></P>\n"
1252.
 
1253.
   die
1254.
1255.
 
1256.
if ($comment) { 
1257.
    AddComment($comment, $name, $message); 
1258.
    if ($moderate) { 
1259.
       echo "<P ALIGN=CENTER>Your comment was stored and is awaiting moderation</P>"
1260.
1261.
    $image = $comment
1262.
1263.
 
1264.
if ($image) { 
1265.
   if (ereg( "\\.\\.", $image)) {  // using ".." in the filename 
1266.
       PrintError("That filename ($image) was not secure."); 
1267.
       die
1268.
1269.
 
1270.
   $cleanimage = $image
1271.
   $image = urldecode($image); 
1272.
 
1273.
   if (!file_exists($image)) { 
1274.
      PrintError("Strangely, that picture ($image) doesn't exist!"); 
1275.
      die
1276.
1277.
 
1278.
   $imagelist = GetFileList(); 
1279.
   GetNeighbours($imagelist, $image, $previmage, $nextimage); 
1280.
 
1281.
   $caption = GetImageCaption($image); 
1282.
 
1283.
   if ($slide && $nextimage) { 
1284.
      $meta="<META HTTP-EQUIV=REFRESH CONTENT=\"$slide;URL=$scriptname?image=".urlencode($nextimage)."&slide=$slide\">"
1285.
   } else
1286.
      $meta = ""
1287.
      $slide = "0"
1288.
1289.
 
1290.
   PrintHeader(CleanCaption($caption), $meta); 
1291.
 
1292.
   echo "<TABLE ALIGN=RIGHT CELLPADDING=0 CELLSPACING=0><TR>"
1293.
   if ($previmage) { 
1294.
      echo "<TD><FORM ACTION=\"$scriptname\"
1295.
            <INPUT TYPE=hidden name=image value=\"$previmage\"
1296.
            <INPUT TYPE=submit VALUE=".$ss[$lang]["prev"]."></FORM></TD>"
1297.
1298.
   if ($nextimage) { 
1299.
      echo "<TD><FORM ACTION=\"$scriptname\"
1300.
            <INPUT TYPE=hidden name=image value=\"$nextimage\"
1301.
            <INPUT TYPE=submit VALUE=".$ss[$lang]["next"]."></FORM></TD>"
1302.
 
1303.
      echo "<TD>"
1304.
      PrintSlideshowForm($nextimage, $slide); 
1305.
      echo "</TD>"
1306.
1307.
   echo "</TR></TABLE>\n"
1308.
 
1309.
   echo "<H3 align=left>".stripslashes($caption); 
1310.
   if (isadmin() and ($captionmethod == "rdjpgcom" or $captionmethod == "capfile") ) { 
1311.
      echo "<FONT SIZE=1>(<A HREF=\"$scriptname?editcaption=$cleanimage\">edit caption</A>)</FONT>"
1312.
1313.
   echo "</H3>"
1314.
 
1315.
   if ($fullwindow) { 
1316.
      $imagewidth = "WIDTH=100%"
1317.
   } else
1318.
	  $imagewidth = ""
1319.
1320.
 
1321.
   echo "<BR CLEAR=ALL><CENTER><P>\n"
1322.
 
1323.
   if ($imageresize && ! $originalimage) { 
1324.
       $rimage = "$thumb/$imageresize$image"
1325.
       $cleanrimage = "$thumb/$imageresize".rawurlencode("$image"); 
1326.
       if (! file_exists("$rimage")) { 
1327.
           $imageresize = ResizeImage($image, $rimage, $imageresize, $imageresize); 
1328.
1329.
       if ($imageresize) { 
1330.
          $filesize = (integer) (filesize($image) / 1024); 
1331.
          echo "<A HREF=\"$scriptname?image=$cleanimage&originalimage=true&d=d.html\" "
1332.
          echo " TITLE=\"".$ss[$lang]["original"]." ($filesize kb)\">"
1333.
          echo "<IMG BORDER=0 $imagewidth SRC=\"$cleanrimage\">"
1334.
          echo "</A>\n"
1335.
       } else
1336.
          echo "<IMG $imagewidth SRC=\"$cleanimage\">\n"
1337.
1338.
 
1339.
   } else
1340.
       echo "<IMG $imagewidth SRC=\"$cleanimage\">\n"
1341.
1342.
 
1343.
   if ($datenames) { 
1344.
       $imageyear = substr($image, 0, 4); 
1345.
       $imagemonth = substr($image, 4, 2); 
1346.
       $imageday = substr($image, 6, 2); 
1347.
       echo "<BR><FONT SIZE=1>"
1348.
       echo date("j F, Y", mktime (0, 0, 0, $imagemonth, $imageday, $imageyear)); 
1349.
       echo "</FONT><BR>\n"
1350.
1351.
 
1352.
   if (isadmin()) { 
1353.
       echo "<BR><FONT SIZE=1><A TITLE=\"Are you sure? No second chances!\" HREF=\"$scriptname?deleteimage=$cleanimage\">Delete this image and all comments</A></FONT>"
1354.
1355.
 
1356.
   echo "</P></CENTER>"
1357.
 
1358.
   if ($dcomment) { 
1359.
       DeleteComment($image, $dcomment, $ctype); 
1360.
1361.
 
1362.
   if ($acomment) { 
1363.
       ApproveComment($image, $acomment); 
1364.
1365.
 
1366.
   if ($guestcomment) { 
1367.
       echo "<P ALIGN=CENTER><BR><B>".$ss[$lang]["comments"]."</B></P>"
1368.
       PrintComments($image); 
1369.
       PrintCommentForm($image); 
1370.
1371.
 
1372.
   PrintFooter(); 
1373.
   die
1374.
1375.
 
1376.
 
1377.
?> 
1378.
<HTML> 
1379.
<HEAD> 
1380.
  <TITLE><?PHP echo $title ?></TITLE> 
1381.
  <META NAME="Description" CONTENT="Made with PhotoFrame <?PHP echo $version?>, http://photoframe.sourceforge.net"
1382.
</HEAD> 
1383.
 
1384.
<?PHP 
1385.
if ($marginside == "right") { 
1386.
?> 
1387.
<FRAMESET COLS="*,<?PHP echo $marginsize?>" BORDER=1 bordercolor="#FFFF00"
1388.
  <FRAME NAME=imain SRC="<?PHP echo $scriptname?>?intro=1" FRAMEBORDER=0 SCROLLING=AUTO> 
1389.
  <FRAME NAME=imargin SRC="<?PHP echo $scriptname?>?margin=<?PHP echo $marginsize?>" FRAMEBORDER=0 
1390.
         marginwidth="0" marginheight="0" noresize SCROLLING=AUTO> 
1391.
<?PHP 
1392.
} else
1393.
?> 
1394.
<FRAMESET COLS="<?PHP echo $marginsize?>,*" BORDER=1 bordercolor="#FFFF00"
1395.
  <FRAME NAME=imargin SRC="<?PHP echo $scriptname?>?margin=<?PHP echo $marginsize?>" FRAMEBORDER=0 
1396.
         marginwidth="0" marginheight="0" noresize SCROLLING=AUTO> 
1397.
  <FRAME NAME=imain SRC="<?PHP echo $scriptname?>?intro=1" FRAMEBORDER=0 SCROLLING=AUTO> 
1398.
<?PHP 
1399.
1400.
?> 
1401.
  <NOFRAMES> 
1402.
     This site works best with frames, which your browser doesn't support. 
1403.
     You can still browse this photo album, though, by starting 
1404.
     <A HREF="<?PHP echo $scriptname?>?margin=<?PHP echo $marginsize?>">here</A> 
1405.
  </NOFRAMES> 
1406.
</FRAMESET> 
1407.
</HTML>
Mitglied: dog
09.06.2009 um 00:22 Uhr
Ist ja auch ganz klar warum:
Das Teil benutzt die uralten $HTTP_-Superglobalen.
Ein Quick-and-Dirty-Fix ist:

01.
<?php 
02.
 
03.
	$HTTP_POST_VARS   = &$_POST
04.
	$HTTP_GET_VARS    = &$_GET
05.
	$HTTP_SERVER_VARS = &$_SERVER
06.
 
07.
?>
Am Anfang des Scripts hinzuzufügen.

Grüße

Max
Bitte warten ..
Mitglied: Trabbi
09.06.2009 um 19:16 Uhr
Hey Max,
vielen Dank fü die schnelle Hilfe!
Funktioniert super!

Beste Grüße!
Bitte warten ..
Neuester Wissensbeitrag
Humor (lol)

Linkliste für Adventskalender

(3)

Information von nikoatit zum Thema Humor (lol) ...

Ähnliche Inhalte
Python
gelöst PHP Skript via Python starten mit JSON Objekt als Parameter (3)

Frage von nullacht15 zum Thema Python ...

PHP
gelöst PHP - Variable in anderes PHP-Skript mitgeben (3)

Frage von Jens4ever zum Thema PHP ...

Batch & Shell
Batch Skript läuft merkwürdig. (15)

Frage von pixel0815 zum Thema Batch & Shell ...

Apache Server
gelöst Nach PHP7-Installation - PHP läuft nicht im Browsser (2)

Frage von bolshi zum Thema Apache Server ...

Heiß diskutierte Inhalte
Windows Server
DHCP Server switchen (22)

Frage von M.Marz zum Thema Windows Server ...

Hardware
gelöst Negative Erfahrungen LAN-Karten (19)

Frage von MegaGiga zum Thema Hardware ...

SAN, NAS, DAS
gelöst HP-Proliant Microserver Betriebssystem (14)

Frage von Yannosch zum Thema SAN, NAS, DAS ...

Grafikkarten & Monitore
Win 10 Grafikkarte Crash von Software? (13)

Frage von Marabunta zum Thema Grafikkarten & Monitore ...