You are here: Home > Gallery > Top Friends Images
#!/usr/bin/perl ############################################################## # image.cgi # # # # Image stats program (C) Copyright 1999 Andy Coates # # # # Do not re-distribute this script without prior consent # # from the author # # # # Version 1.2 # # # ############################################################## # User Variables # Path for the base directory for the database and error files $basedir = "/home/content/b/a/r/barrysomers/html/sites/courteneyarquette/gallery/data"; # The path to the database $database = "$basedir/friends.db"; # Use default "Image not found" text (0) or # use the following filename (1); $useErrorPage=0; $errorPage = "$basedir/error.html"; # webmasters email for broken links $email = "webmaster\@courteneyarquette.com"; # --------------------------------------- # # DO NOT MODIFY ANYTHING BELOW THIS POINT # $found=-1; $image = $ENV{'QUERY_STRING'}; if ($image eq "") { $image = "top9"; } $top = substr($image,0,3); $num = substr($image,3); if (($image eq "stats") || ($top eq "top")) { open(DB,"$database"); @stats = ; chop(@stats); close(DB); print "Content-type: text/html\n\n"; if ($image eq "stats") { print "\nPicture Stats\n"; print "\n"; print "Statistics for pictures ($image)

\n"; } for ($i = 0; $i < (@stats-1); $i++) { for ($j = 0; $j < (@stats-1); $j++) { ($fn1,$c1) = split(/\|!!\|/,@stats[$j]); ($fn2,$c2) = split(/\|!!\|/,@stats[$j+1]); if ($c1 < $c2) { $temp = @stats[$j]; @stats[$j] = @stats[$j+1]; @stats[$j+1] = $temp; } } } if ($image eq "stats") { foreach $line (@stats) { ($filename,$count) = split(/\|!!\|/,$line); if ($count < 10) { $count = "0$count"; } print "$count --- $filename
\n"; } } else { if ($num > $#stats) { $num = @stats;} print "\n"; for ($index = 0; $index < $num; $index+=3) { print "\n\n\n"; for ($step = 0; $step < 3; $step++) { if ($index+$step ge $num) { last;} ($filename,$count) = split(/\|!!\|/,@stats[$index+$step]); if ($filename ne "") { if ($count < 10) { $count = "0$count"; } $thumb = $filename; $thumb =~ s/.jpg/_thumb.jpg/; $thumb =~ s/.gif/_thumb.gif/; print "\n"; } } print "\n"; for ($step = 0; $step < 3; $step++) { if ($index+$step ge $num) { last;} ($filename,$count) = split(/\|!!\|/,@stats[$index+$step]); if ($filename ne "") { if ($count < 10) { $count = "0$count"; } $thumb = $filename; $thumb =~ s/.jpg/_thumb.jpg/; $thumb =~ s/.gif/_thumb.gif/; print "\n"; } } print "\n"; } print "
"; print "
$filename ($count)
\n"; } exit; } if ((-e $image) && ($image ne "")) { } else { print "Content-type: text/html\n\n"; if (($useErrorPage == 1) && (-e $errorPage)) { open(ERROR,"$errorPage"); @errorHtml = ; close(ERROR); foreach $line (@errorHtml) { print "$line"; } } else { print "Ooops!\n"; print "\n"; print "I'm sorry, I can't seem to find the picture you wanted.
\n"; print "If you think this is a broken link, email the webmaster.\n"; print "\n"; } die(); } if (open(DB,"$database")) { @stats = ; chop(@stats); close(DB); # Check to see whether this image has been used before foreach $line (@stats) { ($filename,$count) = split(/\|!!\|/,$line); if ($image eq $filename) { # Yes, we found it! Add one to the counter $count++; $gFilename = $filename; $gCount = $count; # Put it back together $line = join("\|!!\|",$filename,$count); $found=1; } } if ($found == 1) { open(DB,">$database") || die("Can't write to file"); flock DB,2; foreach $line (@stats) { print DB "$line\n"; } } else { open(DB,">>$database") || die("Can't write to file"); flock DB,2; # Not found... add it to the end of the file print DB "$image\|!!\|1\n"; } flock DB,8; close(DB); } else { # there is no file to read open(DB,">$database") || die("Can't create file"); flock DB,2; print DB "$image\|!!\|1\n"; flock DB,8; close(DB); } print "Location: $image\n\n";


contact | legal © The Unofficial Courteney Cox Arquette Homepage 1997 - 2008 all rights reserved
This page is best viewed with Firefox 2.x in Video Resolution 1024x768.