Hovedside     Reisebrev     Bilder     Linker    
EndHTML ; } ## End sub ################################################## ######################## Display message ################################################## sub showmessage { $linenum = 0; open(INF,"messages.txt"); ## Open read file @userdata = ; ## Put into an array close(INF); ## Close file chomp(@userdata); $linenum=@userdata; ($subjectb, $nameb, $emailb, $threadnumb, $dateb, $messageb) = split(/¦/, @userdata[$WHATWANT{'messagenum'}]); $messageb =~ s/~\*/
\n/g; open (INCLUDE, "topp.txt"); while (){chomp;print;} print <

Reisebrev
#!/usr/bin/perl ##-----------------------------------------------------------------## ## ## ## ## ## © Copyright Mr Lyle R Hopkins 1999. All rights reserved. No part## ## of this or any of the attached documents shall be ## ## reproduced/stored in any way whatsoever without written ## ## permission from the Copyright holder. ## ## The Copyright holder holds no responsibility for errors or ## ## omissions. No liability is assumed in any way for damages ## ## resulting from the use of this document/program. ## ## ## ## Have a nice day. ## ## ## ## ## ##-----------------------------------------------------------------## ## By Lyle Hopkins ## print "Content-type: text/html\n\n"; ################################################## ######################## Define variables ################################################## $programurl = "http://www.jordarundt.com/cgi-bin"; $threadsymbol = "-"; ## Symbol to put infront of a reply message $maxlength = 30; ## Max number of posts to have, if above is on ## Optional's $rplymessagebg = "#FFCC99"; $messagefont = "Verdana"; $messagecolour = "#3333FF"; $messagesize = "+0"; $messagebg = "#FFCC33"; $threadfont = "Verdana"; $threadcolour = "#3333FF"; $threadsize = "+0"; ################################################## ######################## Other variables ################################################## ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); ## Get date if ($mon < 10) { $mon = "0$mon"; } if ($mday < 10) { $mday = "0$mday"; } $month = ($mon + 1); $year = $year + 1900; $date = "$mday/$month/$year"; ## Get date chop($date) if ($date =~ /\n$/); ## clean up date @months = ("january","february","march","april","may","june","july","august","september","october","november","december"); ## use $months[$mon] to get month name @values = split(/\&/,$ENV{'QUERY_STRING'}); foreach $i (@values) { ($varname, $mydata) = split(/=/,$i); ## 50 $WHATWANT{$varname} = $mydata; } $subjectb = ""; $nameb = ""; $emailb = ""; $threadnumb = ""; $dateb = ""; $messageb = ""; $replymessagenumb = 2000000; $runthreading = 0; ################################################## ######################## See what to do ################################################## if ($WHATWANT{'want'} eq "add") { &addmessage(); } if ($WHATWANT{'want'} eq "showlist") { &showlist(); } if ($WHATWANT{'want'} eq "showmessage") { &showmessage(); } if ($WHATWANT{'want'} eq "admin") { &admin(); } if ($WHATWANT{'want'} eq "remove") { &remove(); } if ($WHATWANT{'want'} eq "enteradmin") { ## Get user input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } ## Get file Username and password open(INF,"adminpass.txt"); ## Open read file $userpass = ; ## Put into an array close(INF); ## Close file chomp($userpass); ($username, $password) = split(/:/, $userpass); $enterpasscrypt = crypt($FORM{'password'}, substr($password, 0, 2)); ## If they match if ($FORM{'username'} eq $username && $enterpasscrypt eq $password){ &enteradmin(); } ## End if } exit; ################################################## ######################## Actions to take ################################################## ################################################## ######################## Enter Admin ################################################## sub admin { print <Enter password to enter Admin area

 

Username

Password

EndHTML ; exit; } ## End sub ################################################## ######################## The page ################################################## sub enteradmin { ## Open message list $linenum = 1; open(INF,"messages.txt"); ## Open read file @userdata = ; ## Put into an array close(INF); ## Close file foreach $line (@userdata) { chomp($line); ## ($pictureb, $alttextb, $textb, $linkerb, $positionb) = split(/¦/, $line); $LINKSLIST{$linenum} = $line; $linenum++; } print <Posts on board
 
EndHTML ; for ( $key = 1 ; $key < $linenum ; $key++ ) { ## Userfile loop ($name, $slogan, $url, $email) = split(/¦/, $LINKSLIST{$key}); print <$key $name $slogan $url $email EndHTML ; } ## End loop print < 
 
Remove link number:-
EndHTML ; } ## End sub ################################################## ######################## Add message to list ################################################## sub addmessage { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } ## Run filter ## if ($FORM{'message'} =~ /($filters)/gis) { ## &smegup(); ## } $linenum = 1; open(INF,"messages.txt"); ## Open read file @userdata = ; ## Put into an array close(INF); ## Close file foreach $line (@userdata) { chomp($line); ## ($subjectb, $nameb, $emailb, $threadnumb, $dateb, $messageb) = split(/¦/, $line); $BBSMESSAGES{$linenum} = $line; $linenum++; } ## Add reply message in place if ($FORM{'reply'} eq "yes") { $replymessagenumb = $FORM{'messagenum'}; $threader = $FORM{'threader'} + 1; $FORM{'message'} =~ s/\n/~\*/g; $replymessage = "$FORM{'subject'}¦$FORM{'name'}¦$FORM{'email'}¦$threader¦$date¦$FORM{'message'}"; } ## End if else { $messagenumb = $linenum; $threader = 0; $FORM{'message'} =~ s/\n/~\*/g; $BBSMESSAGES{$messagenumb} = "$FORM{'subject'}¦$FORM{'name'}¦$FORM{'email'}¦$threader¦$date¦$FORM{'message'}"; } ## End else $linenumin = $linenum - 1; open(OUTF,">messages.txt"); ## File for appending if ($linenum == 1) { print OUTF "$BBSMESSAGES{$linenum}\n"; ## Write user fields } for ( $key = 1 ; $key < $linenum ; $key++ ) { ## Userfile loop ## Del spillover messages if ($linenum > $maxlength && $key == 1) { ## Skip message } ## End if else { print OUTF "$BBSMESSAGES{$key}\n"; ## Write user fields } ## End else if ($key == $linenumin && $BBSMESSAGES{$linenum} ne "") { print OUTF "$BBSMESSAGES{$linenum}\n"; ## Write user fields } if ($key == $replymessagenumb) { print OUTF "$replymessage\n"; ## Write user fields } } ## End loop close(OUTF); ## Close file print "Message Added"; } ## End sub ################################################## ######################## Display BBS ################################################## sub showlist { $linenum = 0; open(INF,"messages.txt"); ## Open read file @userdata = ; ## Put into an array close(INF); ## Close file chomp(@userdata); $linenum=@userdata; print "
"; for ( $key = 0 ; $key < $linenum ; $key++ ) { ## Userfile loop ($subjectb, $nameb, $emailb, $threadnumb, $dateb, $messageb) = split(/¦/, $userdata[$key]); &tablemaker(); } ## End loop print "
"; print "UkeNavnDato
"; print "


"; print <
This script & more available from
-Lyles Script archive-
Click here
EndHTML ; } ## End sub ################################################## ######################## Reply message form ################################################## sub replyform { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } $MessageNumber=$WHATWANT{'messagenum'}+1; ## Include hidden fields: reply , etc print <Add reply message

 

Subject

Name

E-mail

Message

EndHTML ; } ## End sub ################################################## ######################## Smegup ################################################## sub smegup { print "Mistake"; } ## End sub ################################################## ######################## Tablemaker ################################################## sub tablemaker { $runthreading = 0; if ($threadnumb ne 0) { print <
EndHTML ; $runthreading = 1; } else { print ""; } while ($threadnumb > 0) { print "$threadsymbol"; $threadnumb--; } ## End while if ($runthreading) { print < EndHTML ; } print <$subjectb $nameb $dateb
Land: $subjectb Navn: $nameb Dato: $dateb
$messageb
EndHTML ; open (INCLUDE, "bunn.txt"); while (){chomp;print;} #&replyform(); } ## End sub ################################################## ######################## Add message page ################################################## sub addmessagepage { print <Add message

 

Subject

Name

E-mail

Message

EndHTML ; } ## End sub ################################################## ######################## Remove link ################################################## sub remove { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } ## Load all links $linenum = 1; open(INF,"messages.txt"); ## Open read file @userdata = ; ## Put into an array close(INF); ## Close file foreach $line (@userdata) { chomp($line); ## ($pictureb, $alttextb, $textb, $linkerb, $positionb) = split(/¦/, $line); $LINKSLIST{$linenum} = $line; $linenum++; } open(OUTF,">messages.txt"); ## File for appending for ( $key = 1 ; $key < $linenum ; $key++ ) { ## Userfile loop if ($key ne $FORM{'looselink'}) { print OUTF "$LINKSLIST{$key}\n"; ## Write user fields } ## End if } ## End loop close(OUTF); ## Close file } ## End sub

Hovedside     Reisebrev     Bilder     Linker