index.php
<center>
<TABLE>
<TR>
<?
$connection = mysql_connect(\"localhost\", \"boegh\", \"kode_hvad_for_en_kode\");
$db = \"billeder\";
$mappe = $DOCUMENT_PATH;
if ($start==\"\"){$start=1;}
$slut=$start+10;
$tael=1;
$naeste=$slut+1;
$forrige=$start-11;
$dir=$mappe;
if ($dir == \"\")
{
$dir=\"./\";
$a=opendir($dir) or die (\'<h1>FEJL! Mappenavnet findes ikke. Kan ikke indlæse billeder her.</h1>\');
while($b=readdir($a))
{
if(ereg(\"^\\.\",$b)) continue;
elseif(ereg(\"php\",$b)) continue;
elseif(ereg(\"css\",$b)) continue;
elseif(ereg(\"test\",$b)) continue;
elseif(ereg(\"test2\",$b)) continue;
if($tael <= $slut AND $tael >= $start){
if(ereg(\"jpg\" && \"JPG\",$b))
$size = getimagesize($b);
$height = $size[1] - 20;
$src_img = imagecreatefromjpeg($b);
$new_w = 150;
$new_h = 150;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
ImageString ($dst_img, 8, 2, 133, \"
http://foto.webmasterdk.dk\", $tc);
ImageJPEG($dst_img, \"test/$b\", 500);
echo \"<tr><td><center><a href=kom.php?filnavn=$b&mappe=$mappe&&start=$start><img border=0 src=test/$b></a></td><td>\\n\";
$beskrivelse = mysql_db_query($db, \"select * from billeder where mappe = \'$mappe\' AND filnavn = \'$b\'\", $connection);
while ($row = mysql_fetch_array ($beskrivelse)) {
//Print \"<br><B>Kommentarer til billedet:</B><br>\";
print \"<i>\".$row[\'besked\'].\"</i>\";
}
print \"</td></tr>\";
}
}
$tael++;
}
closedir($a);
print \"</table><hr>\";
if ($start >= 10){
Print \"<a href=$PHP_SELF?mappe=\".$mappe.\"&start=\".$forrige.\"><--Forrige side</a> | \";}
if($tael <= $slut) {
Print \" \";}
else {
Print \" <a href=$PHP_SELF?mappe=\".$mappe.\"&start=\".$naeste.\">Næste side --></a>\";
}
?>
</TR>
</TABLE>
-----------------------------------------------------------
kom.php
<html>
<body onLoad=\"window.status=\'WebmasterDK FotoSystem....\'\" text=#FFFFff bgcolor=#000000 link=RED vlink=RED alink=yellow><font face=verdana>
<title>Vis billede - skriv kommentarer</title>
<center>
<?php
$connection = mysql_connect(\"localhost\", \"boegh\", \"120015142548\");
$db = \"billeder\";
$size = getimagesize($filnavn);
$height = $size[1] - 0;
$height2 = $size[1] - 18;
$height3 = $size[1] - 18;
$im = ImageCreateFromJPEG($filnavn);
$tc = ImageColorAllocate ($im, 0, 0, 0);
$bgc = ImageColorAllocate ($im, 255, 255, 255);
ImageFilledRectangle ($im, 0, $height2, 235, $height, $bgc);
ImageString ($im, 8, 2, $height3, \"
http://foto.webmasterdk.dk\", $tc);
//ImageString ($im, 8, 2, 0, \"foto.webmasterdk.dk\", $tc);
ImageJPEG($im, \"test2/$filnavn\");
ImageDestroy($im);
if ($mappe == \"upload\"){print \"<img src=\".$mappe.\"/\".$filnavn.\"><p>\";}
elseif ($mappe == \"nye\"){print \"<img src=\".$mappe.\"/\".$filnavn.\"><p>\";}
//else{print \"<img src=/htxnet/\".$mappe.\"/stor/\".$filnavn.\"><p>\";}
else{print \"<img src=test2/$filnavn><p>\";}
if($ACTION == \"POST\"){
mysql_db_query($db, \"DELETE FROM BILLEDER WHERE filnavn=\'$filnavn\' AND mappe=\'$mappe\'\");
mysql_db_query($db, \"INSERT INTO BILLEDER (besked, mappe, filnavn, motiv) VALUES (\'$besked\', \'$mappe\', \'$filnavn\', \'$motiv\')\", $connection);
Print \"<center><hr><h1>Ændringerne er foretaget.</h1><p>Kommentaren var: $besked<br>Mappen var: $mappe <br>Nøgleord var: $motiv<br>Filnavnet var: $filnavn<hr><A href=index.php?mappe=$mappe&start=$start>Gå tilbage</a><p>\";
exit;
}
$result = mysql_db_query($db, \"select * from BILLEDER where mappe=\'$mappe\' and filnavn=\'$filnavn\'\", $connection);
while ($row = mysql_fetch_array ($result)) {$besked=$row[\'besked\'];
$motiv=$row[\'motiv\'];}
printf( \"<FORM ACTION=\\\"$PHP_SELF\\\" METHOD=\\\"post\\\">\\n\");
printf( \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"start\\\" VALUE=\\\"$start\\\">\");
printf( \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"ACTION\\\" VALUE=\\\"POST\\\">\");
printf( \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"mappe\\\" VALUE=\\\"$mappe\\\">\");
printf( \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"filnavn\\\" VALUE=\\\"$filnavn\\\">\");
print \"</center>Indtast kommentarer herunder:<br><TEXTAREA NAME=\\\"besked\\\" COLS=\\\"50\\\" ROWS=\\\"4\\\">\".$besked.\"</TEXTAREA><p>\\n\";
printf( \"Indtast gerne søgeord - f.eks. hvad og hvem der er på billedet: <br><INPUT TYPE=\\\"text\\\" size=50 NAME=\\\"motiv\\\" maxlength=200 VALUE=\\\"$motiv\\\">\");
printf( \"<p><INPUT TYPE=\\\"submit\\\" VALUE=\\\"Gem kommentar\\\"></CENTER>\\n\");
printf( \"</FORM>\\n\");
echo \"<A href=index.php?mappe=$mappe&start=$start>Gå tilbage</a>\";
?>
</body>