#!/usr/bin/perl #import our common core... require "commonsetup_phantasm"; #set our special flag to turn off authentication... #$SPECIALDONTAUTH = 1; $SPECIALDONTAUTH = 2; &SetupConfigure(); #$username = "leetaru"; #log this access &LogEvent($ENV{'SCRIPT_NAME'}, $ENV{'QUERY_STRING'}); $IID = $FORM{'ID'} + 0; #verify that this user has access to download this image... #$cur=$dbh->prepare("select count(1) from licensed where IID=? and licuser=?"); #$cur->execute($IID, $username); #$cnt = $cur->fetchrow(); #if ($cnt < 1) {&WritePage("You do not have permission to download this image.", "UIPhotos/Phantasm: Download Image");} #otherwise, we are good to go, so hand the image over to the user... #get the filename... $cur = $dbh->prepare("select full from images where IID=?"); $cur->execute($IID); $fullimage = $cur->fetchrow(); if (length($fullimage) < 1) { print "Content-type: text/html\n\nError.\n"; exit; } # let's try to at least do some sanitizing of inputs... $IID_sanitized = $IID ; $IID_sanitized =~ s/"//g; $fullimage_sanitized = $fullimage ; $fullimage_sanitized =~ s/\|//g ; #and send it... (assume JPEG default) print "Content-type: image/jpeg\n"; print "Content-Disposition: filename=\"${IID_sanitized}.jpg\"\n\n"; open(FILE,"$config[8]/${fullimage_sanitized}"); binmode(FILE); while (!eof(FILE)) { read(FILE,$buffer,100000); print $buffer; } #done...