#!/usr/bin/perl @re=("copenhagenpictures.dk","www.copenhagenpictures.dk"); $file = $ENV{'QUERY_STRING'}; ($name,$ext)=split('_',$file); $graphicsdir = "./cphpics"; $r=$ENV{'HTTP_REFERER'}; foreach $ref (@re) { if ($r =~ /$ref/ || $r eq "") { $allowed=1; } } if ($allowed ne 1) { print "Location: http://www.copenhagenpictures.dk/stolen_picture.jpg\n\n"; } else { $ext2=$ext; if ($ext2 eq "jpg") { $ext2 = "jpeg"; } print "Content-type: image/$ext2\n\n"; open (file,"$graphicsdir/"."$name".".$ext"); flock (file,1); while () { print; } flock (file,8); close file; }