#!/usr/bin/perl ############################################################################## # Cliff's Thumbnail Gallery Post Script Version 1.04 # # Copyright 1998 Shaven Ferret Productions # # Created: 5/25/99 Last Modified: 09/28/99 # # Available at http://www.shavenferret.com/scripts # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998 Shaven Ferret Productions All Rights Reserved. # # # # This script can be used\modified free of charge as long as you don't # # change this header, or the parts of this script that generate the return # # link\form. If you really need to remove these, go to # # http://www.shavenferret.com/scripts/register.shtml . By using this script # # you agree to indemnify me from any liability that might arise from its use.# # # # Redistributing\selling the code for this program without prior written # # consent is expressly forbidden. # ############################################################################## require "tgpsetup.cgi"; &getconfig; if ($ENV{'QUERY_STRING'}) { $buffer = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $FORM{$name} = $value; } if ($FORM{'action'} eq "go") { open(FILE,"$datadir/posts.txt"); @lines = ; close(FILE); for ($i = 0; $i <= $#lines; $i++) { ($post_type,$post_url,$post_desc,$email,$link_url,$odate,$otime,$numimages,$posters_ip,$index_num) = split(/\|/,$lines[$i]); chomp($index_num); if ($index_num == $FORM{'num'}) { open(FILE,"$datadir/c$index_num.txt"); flock(FILE,2); $ctr = ; close(FILE); $ctr++; open(FILE,">$datadir/c$index_num.txt"); flock(FILE,2); print FILE "$ctr"; close(FILE); open (DATA, "$datadir/setup.txt"); @lines = ; close(DATA); chomp($lines[0]); chomp($lines[1]); ($ex,$approval,$tgptitle,$link,$youremail,$maxposts,$notify1,$notify2,$notify3,$bgcolor,$textcolor,$linkcolor,$alink,$vlink,$background,$keywords,$description,$return,$perpage,$head,$foot,$rules,$moreposts,$samedomain,$searchlink,$fontname,$default_listing,$posthead,$postfoot,$keepsearch,$persite,$givestats,$showhints,$eachrate,$checkapprove,$norate,$samepage) = split(/\|/, $lines[0]); print "Location: $posturl/$index_num$ex\n\n"; exit; } } } else { open(FILE,"$datadir/l-main.txt"); flock(FILE,2); @returns = ; close(FILE); for ($i = 0; $i <= $#returns; $i++) { ($referer,$filename) = split(/\|/,$returns[$i]); if ($referer eq $ENV{'HTTP_REFERER'}) { chomp($filename); open(FILE,"$datadir/l-$filename.txt"); flock(FILE,2); my $temp = ; close(FILE); ($count,$last) = split(/\|/,$temp); if ($last eq $ENV{'REMOTE_ADDR'}) { print "Location: $buffer\n\n"; exit; } $count++; open(FILE,">$datadir/l-$filename.txt"); flock(FILE,2); print FILE "$count|$ENV{'REMOTE_ADDR'}"; close(FILE); print "Location: $buffer\n\n"; exit; } } $filename++; open(FILE,">>$datadir/l-main.txt"); print FILE "$ENV{'HTTP_REFERER'}|$filename\n"; close(FILE); open(FILE,">$datadir/l-$filename.txt"); flock(FILE,2); print FILE "1|$ENV{'REMOTE_ADDR'}"; close(FILE); print "Location: $buffer\n\n"; exit; } } else { @temp1 = split(/\//, $ENV{'DOCUMENT_URI'}); @temp2 = split(/\./, $temp1[$#temp1]); open (DATA, "$datadir/setup.txt"); @lines = ; close(DATA); chomp($lines[0]); chomp($lines[1]); ($ex,$approval,$tgptitle,$link,$youremail,$maxposts,$notify1,$notify2,$notify3,$bgcolor,$textcolor,$linkcolor,$alink,$vlink,$background,$keywords,$description,$return,$perpage,$head,$foot,$rules,$moreposts,$samedomain,$searchlink,$fontname,$default_listing,$posthead,$postfoot,$keepsearch,$persite,$givestats,$showhints,$eachrate,$checkapprove,$norate,$samepage) = split(/\|/, $lines[0]); $temp = quotemeta($ENV{'DOCUMENT_URI'}); if ("$posturl/index$ex" =~ /$temp$/) { $filename = "c-m"; } elsif (substr($temp2[0],0,1) eq "c") { $filename = "c-c"; } elsif (substr($temp2[0],0,1) eq "r") { $filename = "c-r"; } elsif (substr($temp2[0],0,1) eq "l") { $filename = "c-l"; } elsif ($temp2[0] =~ /^i(\d+)/) { $filename = "c-i$1"; } open(FILE,"$datadir/$filename.txt"); flock(FILE,2); $count = ; close(FILE); $count++; open(FILE,">$datadir/$filename.txt"); flock(FILE,2); print FILE "$count"; close(FILE); print "Content-type: text/html\n\n"; print " "; exit; }