#!/usr/bin/perl # RPW download script, written by Rich Whitehouse. # http://www.telefragged.com/thefatal/ $basedir = "/home/thefatal/htdocs/"; $cgidir = "$basedir/cgi-bin"; $datadir = "$cgidir/data"; print "Content-type:text/html\n\n"; $file = $ENV{QUERY_STRING}; # argument passed to this file. print ""; print ""; print "RPW - Download ("; print $file; print ")"; print ""; print "\"Rich's"; # START COUNTER STUFF $waserr = "0"; $countfile = "dlcount/$file.txt"; # $countfile = "testcount.txt"; # local testing open (FILE, "+<$countfile"); stat($countfile); $errable = "0"; if ( -e FILE ) { $errable = "1"; } if ($final == "1") { if ($errable == "1") { $waserr = "1"; } } flock (FILE, LOCK_EX); $final = ; close(FILE); open(FILE, "+>$countfile"); $final++; # flock(FILE, LOCK_UN); # close (FILE); # END COUNTER STUFF # START DESCRIPTION STUFF $descfile = "filedesc/_$file.txt"; # If file name has a /, make it a _. # $descerr = "0"; open (FILE_2, "$descfile") or $descerr = "1"; # flock (FILE_2,2); flock (FILE_2, LOCK_EX); $fdesc = ; flock (FILE_2, LOCK_UN); close (FILE_2); # END DESCRIPTION STUFF if ($waserr == "1") { $final = "error opening counter file"; } if ($descerr == "1") { $fdesc = "No description"; } print "


File Information

"; print "Name: "; print $file; print "
Description: "; print $fdesc; print "
Number of Download Requests: "; print $final; print "
"; print "
"; print "
Your download should start in approximately 5 seconds. If it does not, or you have problems downloading the file, you can do one of two things:

1. Try locating the file you're after on the file list.
2. Try clicking this direct link to the file.
"; print "
If you cannot get either of the above options to work, then it's probably because of trouble with the server. Try again later.
"; print "



[Back to Main]

"; print ""; if ($waserr != "1") { # open(STDOUT, "+>$countfile"); # flock (STDOUT, LOCK_EX); # print STDOUT $final; # unlock (STDOUT, LOCK_UN); # close(STDOUT); print FILE $final; unlock (FILE, LOCK_UN); close(FILE); } exit;