#!/usr/bin/perl #Make sure the above line is the path #to perl on your server. ################################################################# require 'config.dat'; #Require the config file $vnum = "3.0"; #Version Number read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); #Parse HTML forms # split the input @pairs = split(/&/, $input); # split the name/value pairs foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<([^>]|\n)*>//g; $FORM{$name} = $value; } ####################################################################### ##########Translate the data from the HTML form into scalar variables## ####################################################################### $replace = "_____"; # Value for profanit filter $zach = $FORM{'zach'}; #used in unless statement below $addthis2story = $FORM{'addthis2story'}; #Initalizes for value for chapter $usrname = $FORM{'usrname'}; #Initalizes for value for users name $usrmail = $FORM{'usrmail'}; #Initalizes for value for user email $addr = $ENV{'REMOTE_ADDR'}; #Users IP address $usragent = $ENV{'HTTP_USER_AGENT'}; #User Agent $usrmailname = "\$usrname\<\/A\>"; #autolink email thing &get_date; #Get the date and time $back = $ENV{'HTTP_REFERER'}; #Back button data ####################################################################### ####Generate the configuration form page############################### ####################################################################### unless ($zach eq "addchapter") { #Main input page print <<"(END ERROR HTML)"; Content-type: text/html\n $title $pgformat

$title

$header

Klicke hier zum lesen der Geschichte, oder benutze das Formular um Dein Kapitel zur Geschichte beizutragen.

Name:

E-Mail:

Kapitel:
Auto Zeilenumbruch ist an.

Die unendliche Geschichte stammt von
Zach's Archive
und wurde übersetzt von
Inspire-net

(END ERROR HTML) exit; } if ($usrname eq ""){ #If the user does not enter a name, call them Anonamyous $usrname = "Anonymous"; } ############NO CHAPTER ERROR############# if ($addthis2story eq ""){ #If no chapter is entered, print error print <<"(END ERROR HTML)"; Content-type: text/html\n Error: Kein Text zur Geschichte notiert $pgformat

$title

Error: Kein Eintrag


Sorry $usrname, es wurde kein Text zu $title geschrieben, so kann aber die Geschichte nicht fortgesetzt werden. Bitte berichtige das.


Zurück

(END ERROR HTML) exit; } ##########Some Junk############### #Misc options if ($usrname eq "termsofuse"){ #View terms of use print "Location: http://zachsarchive.cjb.net/tou.html\n\n"; exit; } if ($usrname eq "upgrade"){ #Upgrade Option print "Location: http://zachsarchive.cjb.net/add2story.html\n\n"; exit; } if ($usrname eq "about:add2story"){ #About the script print "Location: http://zachsarchive.cjb.net/add2story.html\n\n"; exit; } ########################### The Profanity censor IMPROVED 04/22/00 if ($censor eq "on"){ #This line here checks for profanity and replaces it with $replace =DRASTICALLY IMPROVED= $addthis2story =~ s/\bFuck\b|\bFucking\b|\bFuckin'\b|\bBitch\b|\bAss\b|\bShit\b|\bpussy\b|\bTit\b|\bCunt\b|\bClit\b|\bCock\b|\bhor\b|\bboob\b|\b\@\$\$\b/$replace/gi; #Did your mommy teach not to say these words? } #security IMPROVED 04/22/00 $addthis2story =~ s/< *((SCRIPT)|(APPLET)|(EMBED))[^>]+>//ig; #Don't let users inbed jave $addthis2story =~ s/"; $replace = "

Kapitel von $usrmailname
$date
$addthis2story
"; #<-- Don't Remove these! #open your file for writing, write to it then close file open(STORY, "$storyfile") or die('could not open $storyfile for reading, stopped '); @story= ; close(STORY); open(STORY, ">$storyfile") or die('could not open $storyfile for writing, stopped '); foreach $line(@story) { chomp($line); $line =~ s/$instance/$replace/gi; print STORY "$line\n"; } close (STORY); ############################################## #If logging is on, log users name and IP, date, and time to log file if ($logging eq "on"){ open (LOG, ">>$logfile") || die "Can't open FILE: $logfile\n"; print LOG "Ein Kapitel, gepostet von $usrname \[$addr\] $date \) \n"; close(LOG); } #If mail option is on, then send mail to tell owner that a chapter was added if ($mail eq "on") { open (MAIL,"|$mailprog -t"); print MAIL "To: $recipient\n"; print MAIL "From: $usrname <$usrmail> \n"; print MAIL "Subject: Kapitel geschrieben: $title\n\n"; print MAIL "$date\n\n"; print MAIL "$usrname hat ein Kapitel zu Geschichte geschrieben\n $scriptURL\n\n"; print MAIL "Below is the chapter $usrname added to $title:\n\n$addthis2story\n"; print MAIL "\nZusaetzliche Infos zum User $usrname:\n IP: $addr\n User Agent: $usragent\n"; close (MAIL); } ####################################################################### #### Print Finish message ############################################# ####################################################################### print <<"(END ERROR HTML)"; Content-type: text/html\n $title: Kapitel geschrieben $pgformat

$title

Aktion erfolgreich: Kapitel eingetragen!
Danke für Deinen Beitrag $usrname. Unterhalb ist eine Kopie Deines Kapitels zu $title:

$addthis2story

Klicke hier zur Anzeige des $title.

(END ERROR HTML) exit; # a sub to get the date sub get_date { # Define arrays for the day of the week and month of the year. # @days = ('Sonntag','Montag','Dienstag','Mittwoch', 'Donnerstag','Freitag','Samstag'); @months = ('Januar','Februar','März','April','Mai','Juni','Juli', 'August','September','Oktober','November','Dezember'); # Get the current time and format the hour, minutes and seconds. Add # # 1900 to the year to get the full 4 digit year. # ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year += 1900; # Format the date. # $date = "$days[$wday], $months[$mon] $mday, $year um $time"; } #A sub that detects duplicate entries sub dupentry { print <<"(END ERROR HTML)"; Content-type: text/html\n Error: Doppelter Eintrag $pgformat

$title

Error: Doppelter Eintrag


Dieses Kapitel wurde schon eingetragen. Doppelte Einträge sind nicht erlaubt, bitte berichtige das.


Zurück

(END ERROR HTML) exit; }