#!/usr/local/bin/perl ###################################################################### # BEFORE TRYING TO EDIT THIS SCRIPT, READ THE README FILE ###################################################################### # # The Dream Catcher's Web Free CGI Scripts # Message Board # Created by Seth Leonard # # http://dreamcatchersweb.com/scripts/ # # (c)2000 Seth Leonard # All Rights Reserved # ###################################################################### $userdir = "users"; $datafile = "data.txt"; $messagedir = "messages"; $responsedir = "responses"; $archivedir = "archives"; $dateprogram = "/bin/date"; $bgcolor = "FFFFFF"; $textcolor = "000000"; $linkcolor = "0000FF"; $boardname = "Message Board"; $loginpage = "http://server.com/board/login.html"; $script = "http://server.com/cgi-bin/board.cgi"; ############################################################################ &getdate; if ($ENV{'QUERY_STRING'}) { $namevalues = $ENV{'QUERY_STRING'}; } else { read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'}); } @pairs = split(/&/, $namevalues); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s/<([^>]|\n)*>//g; $INPUT{$name} = $value; } $action = $INPUT{'action'}; if ($action eq 'login') { &login; } if ($action eq 'main') { &main; } if ($action eq 'view') { &view; } if ($action eq 'post') { &post; } if ($action eq 'userarchive') { &userarchive; } if ($action eq 'viewarchive') { &viewarchive; } if ($action eq 'editarchive') { &editarchive; } if ($action eq 'deletearchive') { &deletearchive; } if ($action eq 'archivemessage') { &archivemessage; } if ($action eq 'register') { ®ister; } ############################################################################ # REGISTER ############################################################################ sub register { unless ($INPUT{'user'}) { &requireuser; } &user; $filetoexist = "$userdir/$user.user"; @atribs = stat("$filetoexist"); if ($atribs[7] > 0 || $INPUT{'user'} eq 'guest') { &usernametaken; } $INPUT{'password'} =~ tr/ /-/; $cryptpassword = crypt($INPUT{'password'}, sb); open (NEWUSER, ">$userdir/$user.user"); print NEWUSER ("$cryptpassword\n"); if ($INPUT{'alias1'}) { print NEWUSER ("$INPUT{'alias1'}"); } if ($INPUT{'alias2'}) { print NEWUSER ("\t"); print NEWUSER ("$INPUT{'alias2'}"); } if ($INPUT{'alias3'}) { print NEWUSER ("\t"); print NEWUSER ("$INPUT{'alias3'}"); } if ($INPUT{'alias4'}) { print NEWUSER ("\t"); print NEWUSER ("$INPUT{'alias4'}"); } if ($INPUT{'alias5'}) { print NEWUSER ("\t"); print NEWUSER ("$INPUT{'alias5'}"); } print NEWUSER ("\n"); if ($INPUT{'email'} && $INPUT{'email'} =~ /(.*)@(.*)/) { print NEWUSER ("$INPUT{'email'}\n"); } else { print NEWUSER ("none\n"); } print NEWUSER ("$INPUT{'archive'}\n"); close (NEWUSER); if ($INPUT{'archive'} eq 'yes') { open (NEWARCHIVE, ">$archivedir/$user.archive"); close (NEWARCHIVE); } print ("Content-type: text/html\n\n"); print <<"html";
html unless ($user eq 'guest') { print <<"html"; | html } print <<"html"; |