#!/usr/bin/perl # ### ULTIMATE.CGI SCRIPT FOR THE ULTIMATE BULLETIN BOARD ## # # Ultimate Bulletin Board is copyright Madrona Park, Inc. # # you assume all liability that # may result due to installation problems and/or # content posted on your bulletin board. You must also # keep all copyright notices on applicable pages. # # For more info on the Ultimate BB, # see http://www.ultimatebb.com # ####################################################### print ("Content-type: text/html\n\n"); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ #substitute all require files here for the file require "cgi-lib.pl"; require "UltBB.setup"; require "Date.pl"; require "mods.file"; require "ubb_htmlALT.pl"; require "Styles.file"; }; if ($@) { print "Error including required files: $@\n"; print "Make sure these files exist, permissions are set properly, and paths are set correctly."; exit; } &ReadParse; foreach $row(@in) { ($Name, $Value) = split ("=", $row); $Name = &decodeURL($Name); $Value = &decodeURL($Value); if ($Name eq "forum") { $Forum = $Value; $ForumCoded = $Forum; $ForumCoded =~ tr/ /+/; } if ($Name eq "TopicSubject") { $TopicSubject = $Value; $TopicSubject =~ s/<.+?>//g; $TopicSubject =~ s/"/"/g; $TopicSubject =~ s/'/&\#039;/g; } if ($Name eq "UserName") { $UserName = $Value; } if ($Name eq "ReplyMessage") { $ReplyMessage = $Value; } if ($Name eq "PasswordConfirm") { $PasswordConfirm = $Value; } if ($Name eq "Message") { $Message = $Value; } if ($Name eq "number") { $number = $Value; } if ($Name eq "DaysPrune") { $DaysPrune = $Value; } if ($Name eq "topic") { $topic = $Value; } if ($Name eq "Browser") { $Browser = $Value; } if ($Name eq "Email") { $Email = $Value; $Email =~tr/A-Z/a-z/; } if ($Name eq "URL") { $URL = $Value; } if ($Name eq "Permissions") { $Permissions = $Value; } if ($Name eq "Occupation") { $Occupation = $Value; } if ($Name eq "Location") { $Location = $Value; } if ($Name eq "TotalPosts") { $TotalPosts = $Value; } if ($Name eq "Status") { $Status = $Value; } if ($Name eq "Interests") { $Interests = $Value; } } # end FOREACH $row if ($VariablesPath eq "") { $VariablesPath = $CGIPath; } @censored = split(/ /, $censorwords); if ($Censor eq "ON") { for (@censored) { $wordlength = length($_); $replaceword = "*" x $wordlength; $TopicSubject =~ s/$_/$replaceword/isg; } } $SubjectCoded = $TopicSubject; $SubjectCoded =~ tr/ /+/; if (@in == 0) { &Intro; } if ($in{'action'} eq "intro") { &Intro; } if ($in{'action'} eq "topics") { &Topics; } if ($in{'action'} eq "threadlist") { &Threadlist; } if ($in{'action'} eq "reply") { &Reply; } if ($in{'action'} eq "postreply") { &PostReply; } if ($in{'action'} eq "newtopic") { &NewTopic; } if ($in{'action'} eq "posttopic") { &PostTopic; } if ($in{'action'} eq "getbio") { &GetBio; } if ($in{'action'} eq "editbio") { &EditBio; } if ($in{'action'} eq "setprefs") { &SetPrefs; } if ($in{'action'} eq "PrefsSubmit") { &PrefsSubmit; } if ($in{'action'} eq "checkbioid") { &CheckBioID; } if ($in{'action'} eq "modifybio") { &ModifyBio; } if ($in{'action'} eq "register") { &Register; } if ($in{'action'} eq "RegSubmit") { &RegSubmit; } if ($in{'action'} eq "faq") { &FAQ; } if ($in{'action'} eq "lostpw") { &LostPW; } sub Intro { &ForumsTopHTML; for ($x = 1; $x < 10; $x++) { opendir (FORUMDIR, "$ForumsPath/Forum$x/"); @files = readdir(FORUMDIR); closedir (FORUMDIR); @datesummary = ""; @sortedfiles = sort(@files); @sortedfiles = grep(/msg/, @sortedfiles); $numberOfPosts = grep(/msg/, @sortedfiles); if ($numberOfPosts > 0) { foreach $checkdate(@sortedfiles) { ($postStuff, $Trash) = split (/\./, $checkdate); ($Trash2, $Trash3, $LastDate, $Trash4) = split ("-", $postStuff); ## we need to move year up front for ordering purposes $LastYear = substr($LastDate, 4, 2); $LastRest = substr($LastDate, 0, 4); $LastDate = ("$LastYear" . "$LastRest"); push (@datesummary, $LastDate); } @sortdates = sort(@datesummary); @sortdates = reverse(@sortdates); $LatestDate = $sortdates[0]; $Year = substr($LatestDate, 0, 2); $Month = substr($LatestDate, 2, 2); $Day = substr($LatestDate, 4, 2); } else { $Month = ""; $Day = ""; $Year = ""; } $ForumName = ("Forum" . "$x"); $ForumName = $$ForumName; $Moderator = ("Forum" . "$x" . "Moderator"); $Moderator = $$Moderator; $ForumDesc = ("Forum" . "$x" . "Desc"); $ForumDesc = $$ForumDesc; $OnOff = ("ForumStatus" . "$x"); $OnOff = $$OnOff; $ForumCoded = $ForumName; $ForumCoded =~ tr/ /+/; if ($OnOff eq "On") { &ForumsGutsHTML; } ## End IF ONOFF Conditional } &ForumsBottomHTML; } #END INTRO SR ### sub Topics { if ($DaysPrune == 1) { $Days1 = "SELECTED"; } if ($DaysPrune == 2) { $Days2 = "SELECTED"; } if ($DaysPrune == 5) { $Days5 = "SELECTED"; } if ($DaysPrune == 10) { $Days10 = "SELECTED"; } if ($DaysPrune == 20) { $Days20 = "SELECTED"; } if ($DaysPrune == 30) { $Days30 = "SELECTED"; } if ($DaysPrune == 45) { $Days45 = "SELECTED"; } if ($DaysPrune == 60) { $Days60 = "SELECTED"; } if ($DaysPrune == 75) { $Days75 = "SELECTED"; } if ($DaysPrune == 100) { $Days100 = "SELECTED"; } $ForumDesc = ("Forum" . "$number" . "Desc"); $ForumDesc = $$ForumDesc; $Moderator = ("Forum" . "$number" . "Moderator"); $Moderator = $$Moderator; $Forum = ("Forum" . "$number"); $Forum = $$Forum; $ForumCoded = $Forum; $ForumCoded =~ tr/ /+/; $Moderator =~ s/ /_/g; open (GETHOST, "$MembersPath/$Moderator.cgi"); @ModData = ; close (GETHOST); @GetEmail = split(/\|/, $ModData[0]); $ModeratorEmail = "$GetEmail[2]"; &TopicTopHTML; &TopicMidNonIEhtml; #get Forum Messages opendir (FORUMDIR, "$ForumsPath/Forum$number/"); @forummsgs = readdir(FORUMDIR); closedir (FORUMDIR); foreach $message(@forummsgs) { $MessageNumber = substr($message, 0, 6); $MessageReply = substr($message, 7, 6); $DateOfMessage = substr($message, 14, 6); if ($MessageReply eq "000000") { push (@topicarray, $message); } } ## do date pruning ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time); #convert Closing and Current Dates to Julian Dates $CurrentJulian = &jday($mon, $mday, $year); $CloseJulian = $CurrentJulian - $DaysPrune; #configure memo date to Julian foreach $item(@topicarray) { $MonthOfMessage = substr($item, 14, 2); $DayOfMessage = substr($item, 16, 2); $YearOfMessage = substr($item, 18, 2); $MonthOfMessage = $MonthOfMessage - 1; $CheckJulian = &jday($MonthOfMessage, $DayOfMessage, $YearOfMessage); if ($CheckJulian >= $CloseJulian) { push (@finalarray, $item); } } #end FOREACH $item #sort topics by date, then by time foreach $one(@finalarray) { ($messagenumber, $trash5, $sortkey, $replytotals) = split("-", $one); ($replytotals, $trashthis) = split(/\./, $replytotals); ## sortkey is the date... ## but we need to move year up front for ordering purposes $topicdater = "$sortkey"; $sortyear = substr($sortkey, 4, 2); $sortrest = substr($sortkey, 0, 4); $sortkey = ("$sortyear" . "$sortrest"); open (THETOPIC, "$ForumsPath/Forum$number/$one"); @stuff = ; close (THETOPIC); $getauthor = "$stuff[0]"; $timetopic = "$stuff[2]"; $getsubject = "$stuff[3]"; chomp($getauthor); chomp($timetopic); chomp($getsubject); if ($replytotals eq "000000") { $thetime = "$timetopic"; } else { $TheLastReply = ("$messagenumber-$replytotals-$topicdater-000000.msg"); open (LASTREPLY, "$ForumsPath/Forum$number/$TheLastReply"); @replyguts = ; close (LASTREPLY); $thetime = "$replyguts[2]"; chomp($thetime); } #END IF/ELSE $replytotals eq 000000 ## CONVERT $thetime to sortable time equivalent ($Front, $TimePiece) = split(/ /, $thetime); # $TimePiece is either AM or PM ($GetHour, $GetMinutes) = split(/\:/, $Front); if ($TimePiece eq "PM") { if ($GetHour != 12) { $NewHour = $GetHour + 12; } else { $NewHour = $GetHour; } } else { if ($GetHour == 12) { $NewHour = 0; } else { $NewHour = $GetHour; } } #END IF/ELSE $TimePiece eq PM $FormattedHour = sprintf("%2d", $NewHour); $FormattedMinutes = sprintf("%2d", $GetMinutes); $FormattedHour =~ tr/ /0/; $FormattedMinutes =~ tr/ /0/; $settime = ("$FormattedHour" . "$FormattedMinutes"); $sortline = ("$sortkey" . "|$settime" . "|$getauthor" . "|$getsubject" . "|$thetime" . "|$one"); push(@sortthis, $sortline); } @sortedthat = sort(@sortthis); @sortedthat = reverse(@sortedthat); # now we have the array of topics in the forum # next... deconstruct each topic to show last post, original author, #topic subject foreach $topic2(@sortedthat) { ($trash, $trash2, $author, $subject, $settime, $topic) = split(/\|/, $topic2); $MessageNumber = substr($topic, 0, 6); $MessageReply = substr($topic, 7, 6); $DateOfMessage = substr($topic, 14, 6); $Replies = substr($topic, 21, 6); $RepliesFormat = $Replies + 0; $Month = substr($DateOfMessage, 0, 2); $Day = substr($DateOfMessage, 2, 2); $Year = substr($DateOfMessage, 4, 2); &TopicGutsNonIEhtml; } &TopicBottomNonIEhtml; &TopicBottom2NonIEhtml; } ## END TOPICS SR #### sub Threadlist { $TopicNumber = substr($topic, 0, 13); &GrabTopic; open (GETTOPIC, "$ForumsPath/Forum$number/$TopicFile"); @topicguts = ; close (GETTOPIC); $UNCoded = $topicguts[0]; $UNCoded =~ tr/ /+/; $TopicSubject = $topicguts[3]; $SubjectCoded = $TopicSubject; $SubjectCoded =~ tr/ /+/; &ThreadTopHTML; if ($Browser ne "IE4") { chomp ($topicguts[1]); chomp ($topicguts[2]); chomp ($topicguts[5]); &ThreadGutsNonIEhtml; #get Replies to this topic opendir (FORUMDIR, "$ForumsPath/Forum$number/"); @forummsgs = readdir(FORUMDIR); closedir (FORUMDIR); $ThisTopicNumber = substr($topic, 0,6); #sort to find all replies to this topic foreach $msg(@forummsgs) { $TopicNumber = substr($msg, 0, 6); if ($TopicNumber eq "$ThisTopicNumber") { $ReplyNumber = substr($msg, 7, 6); if ($ReplyNumber > 0) { push (@replyarray, $msg); } } } @replyarray = sort(@replyarray); #### @replyarray holds all replies to the topic in question foreach $matchreply(@replyarray) { open (REPLY, "$ForumsPath/Forum$number/$matchreply"); @replyguts = ; close (REPLY); $UserNameCoded = $replyguts[0]; $UserNameCoded =~ tr/ /+/; chomp ($replyguts[1]); chomp ($replyguts[2]); chomp ($replyguts[5]); &ThreadRepliesNonIEhtml; } &ThreadBottomNonIEhtml; &ThreadBottom2NonIEhtml; } else { &ThreadIEhtml; &GetForumSelectList; &ThreadIE2html; } ##END IF BROWSER NE IE4 Loop } #END THREADLIST SR #### sub Reply { @forumHTML = ("$Forum1HTML", "$Forum2HTML", "$Forum3HTML", "$Forum4HTML", "$Forum5HTML", "$Forum6HTML", "$Forum7HTML", "$Forum8HTML", "$Forum9HTML"); if ($forumHTML[$number-1] eq "is") { $ISHTML = "*HTML is enabled."; $HTMLAllowed = "yes"; } else { $ISHTML = "*HTML is NOT enabled."; $HTMLAllowed = "no"; } &ReplyFormHTML; &GenerateThread; &ReplyFormBottom; } ## END Reply SR ##### sub PostReply { if (($ReplyMessage eq "") || ($UserName eq "") || ($in{'Password'} eq "")) { &MissingFields; } else { ##get current date/time &GetDateTime; ##verify user name/password $match = "no"; $verified = "false"; opendir (MEMBERDIR, "$MembersPath/"); @members = readdir(MEMBERDIR); closedir (MEMBERDIR); $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces CHECKPROFILES: foreach $member(@members) { if ($member eq "$UserNameFile.cgi") { $match = "yes"; open (CHECKPROFILE, "$MembersPath/$UserNameFile.cgi"); @profile = ; close (CHECKPROFILE); @profilestats = split (/\|/, $profile[0]); if ($profilestats[1] eq "$in{'Password'}") { $verified = "true"; $Email = "$profilestats[2]"; $UserName = "$profilestats[0]"; $TotalPosts = "$profilestats[7]"; $Permission = "$profilestats[4]"; $Password = "$profilestats[1]"; $URL = "$profilestats[3]"; $Occupation = "$profilestats[5]"; $Location = "$profilestats[6]"; $Status = "$profilestats[8]"; $Interests = "$profilestats[9]"; last CHECKPROFILES; } #END IF profilestats } #END IF $MEMBER } #end FOREACH $member &CheckPermissions; if ($match eq "no") { &NoMatch } if ($match eq "yes" && $verified eq "false") { &WrongPassword; } if ($match eq "yes" && $verified eq "true") { if ($PermissionToWrite eq "true") { ##create filenumber for reply based on father message ## recheck topic number, in case someone ## posted reply while user was typing $TopicNumber = substr($topic, 0, 13); &GrabTopic; #### ($father, $replynum, $dater, $replytotal) = split(/\-/, $TopicFile); $oldreplytotal = $replytotal; $oldreplytotal++; $newreplynum = sprintf("%6d", $oldreplytotal); $newreplynum =~tr/ /0/; $father = sprintf("%6d", $father); $father =~tr/ /0/; $ReplyFile = ("$father" . "-" . "$newreplynum" . "-" . "$RunonDate" . "-" . "000000.msg"); #now we have to add the message to the forum directory ## IF HTML is not allowed, remove HTML tags from $Message if ($in{'HTMLAllowed'} eq "no") { $ReplyMessage =~ s/<.+?>//g; } if ($Censor eq "ON") { for (@censored) { $wordlength = length($_); $replaceword = "*" x $wordlength; $ReplyMessage =~ s/$_/$replaceword/isg; } } #convert newlines/carriage returns to HTML $ReplyMessage =~ s/\n\r\n/

/g; $ReplyMessage =~ s/\n/
/g; #Auto-Code URLs, Emails, and Images $ReplyMessage =~ s/(\[URL\])(http:\/\/\S+)(\[\/URL\])/ $2<\/A> /isg; $ReplyMessage =~ s/(\[URL\])(\S+)(\[\/URL\])/ $2<\/A> /isg; $ReplyMessage =~ s/(\[EMAIL\])(\S+\@\S+)(\[\/EMAIL\])/ $2<\/A> /isg; $ReplyMessage =~ s/(\[IMG\])(\S+)(\[\/IMG\])/ /isg; $ReplyMessage =~ s/(\[QUOTE\])(.+)(\[\/QUOTE\])/

quote:<\/font>
$2
<\/BLOCKQUOTE>/isg; &Lock ("lock.file"); open (THISFILE, ">$ForumsPath/Forum$number/$ReplyFile"); print THISFILE ("$UserName\n"); print THISFILE ("$HyphenDate\n"); print THISFILE ("$Time\n"); print THISFILE ("$TopicSubject\n"); print THISFILE ("$Email\n"); print THISFILE ("$ReplyMessage\n"); close (THISFILE); ## Amend father message to reflect new reply ($oldreplytotal, $trash) = split(/\./, $replytotal); $oldreplytotal++; $newreplytotal = sprintf("%6d", $oldreplytotal); $newreplytotal =~tr/ /0/; $newFileName = "$father-000000-$RunonDate-$newreplytotal.msg"; ### can't use rename for certain NT systems, thus, here's the fix: open (THISFILE, "$ForumsPath/Forum$number/$TopicFile"); @topicstuff = ; close(THISFILE); open (RENAME, ">$ForumsPath/Forum$number/$newFileName"); for $line(@topicstuff) { chomp($line); print RENAME "$line\n"; } close(RENAME); unlink ("$ForumsPath/Forum$number/$TopicFile"); ### END NEW RENAME ALTERNATIVE SECTION #OLD RENAME PROCESS (Much easier, but NT doesn't fully support...) #rename ("$ForumsPath/Forum$number/$TopicFile", #"$ForumsPath/Forum$number/$newFileName"); &Unlock ("lock.file"); $UserInfo = ("$UserName" . "|$in{'Password'}"); &ReplyConfirmHTML; ##Add reply to user's profile (total posts) $TotalPosts++; #Bump user up to Member if Total Posts reaches $MemberMinimum if (($TotalPosts == $MemberMinimum) && ($Status eq "Junior Member")) { $Status = "Member"; } open (MEMBERSHIP, ">$MembersPath/$UserNameFile.cgi") or die("Unable to open Members directory."); print MEMBERSHIP ("$UserName|"); print MEMBERSHIP ("$Password|"); print MEMBERSHIP ("$Email|"); print MEMBERSHIP ("$URL|"); print MEMBERSHIP ("$Permission|"); print MEMBERSHIP ("$Occupation|"); print MEMBERSHIP ("$Location|"); print MEMBERSHIP ("$TotalPosts|"); print MEMBERSHIP ("$Status|"); print MEMBERSHIP ("$Interests\n"); close (MEMBERSHIP); } else { &PermissionDeniedHTML; } #END Check Permission block } ## END match yes and verified true block } } ## END Post Reply SR sub NewTopic { @forumHTML = ("$Forum1HTML", "$Forum2HTML", "$Forum3HTML", "$Forum4HTML", "$Forum5HTML", "$Forum6HTML", "$Forum7HTML", "$Forum8HTML", "$Forum9HTML"); if ($forumHTML[$number-1] eq "is") { $ISHTML = "*HTML is enabled."; $HTMLAllowed = "yes"; } else { $ISHTML = "*HTML is NOT enabled."; $HTMLAllowed = "no"; } &TopicFormHTML; } ## END NEWTOPIC SR ## sub PostTopic { #make sure all fields completed if (($TopicSubject eq "") || ($Message eq "") || ($UserName eq "") || ($in{'Password'} eq "")) { &MissingFields; } else { ##get current date/time &GetDateTime; ##verify user name/password $match = "no"; $verified = "false"; opendir (MEMBERDIR2, "$MembersPath/"); @members2 = readdir(MEMBERDIR2); closedir (MEMBERDIR2); $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces GETUSER: foreach $member2(@members2) { if ($member2 eq "$UserNameFile.cgi") { $match = "yes"; open (CHECKPROFILE2, "$MembersPath/$UserNameFile.cgi"); @profile2 = ; close (CHECKPROFILE2); @profilestats2 = split (/\|/, $profile2[0]); if ($profilestats2[1] eq "$in{'Password'}") { $verified = "true"; $Location = "$profilestats2[6]"; $Occupation = "$profilestats2[5]"; $Email = "$profilestats2[2]"; $Status = "$profilestats2[8]"; $TotalPosts = "$profilestats2[7]"; $Interests = "$profilestats2[9]"; $URL = "$profilestats2[3]"; $Permission = "$profilestats2[4]"; last GETUSER; } #END IF profilestats } #END IF $MEMBER } #end FOREACH $member &CheckPermissions; if ($match eq "no") { &NoMatch } if ($match eq "yes" && $verified eq "false") { &WrongPassword; } if ($match eq "yes" && $verified eq "true") { if ($PermissionToWrite eq "true") { ##determine last topic number and increment by 1 opendir (FORUMCOUNT, "$ForumsPath/Forum$number/"); @forumcounter = readdir(FORUMCOUNT); closedir (FORUMCOUNT); #make sure we are only sorting msg files @forumcounter = grep(/msg/, @forumcounter); $count = @forumcounter; if ($count > 0) { @sortedforum = sort(@forumcounter); @sortedforum = reverse(@sortedforum); $lasttopic = $sortedforum[0]; ($lastnumber, $trash, $trash2, $trash3) = split("-", $lasttopic); $lasttopic++; $newtopic = sprintf("%6d", $lasttopic); $newtopic =~tr/ /0/; ##create filenumber for new topic $newtopicfile = ("$newtopic-000000-$RunonDate-000000.msg"); } else { $newtopicfile = ("000000-000000-$RunonDate-000000.msg"); } #now we have to add the message to the forum directory ## IF HTML is not allowed, remove HTML tags from $Message if ($in{'HTMLAllowed'} eq "no") { $Message =~ s/<.+?>//g; } if ($Censor eq "ON") { for (@censored) { $wordlength = length($_); $replaceword = "*" x $wordlength; $Message =~ s/$_/$replaceword/isg; } } #convert newlines/carriage returns to
and

html tags $Message =~ s/\n\r\n/

/g; $Message =~ s/\n/
/g; #Auto-Code URLs, Emails, Images $Message =~ s/(\[URL\])(http:\/\/\S+)(\[\/URL\])/
$2<\/A> /isg; $Message =~ s/(\[URL\])(\S+)(\[\/URL\])/ $2<\/A> /isg; $Message =~ s/(\[EMAIL\])(\S+\@\S+)(\[\/EMAIL\])/ $2<\/A> /isg; $Message =~ s/(\[IMG\])(\S+)(\[\/IMG\])/ /isg; $Message =~ s/(\[QUOTE\])(.+)(\[\/QUOTE\])/

quote:<\/font>
$2
<\/BLOCKQUOTE>/isg; &Lock ("lock.file"); open (FORUM, ">$ForumsPath/Forum$number/$newtopicfile"); print FORUM ("$UserName\n"); print FORUM ("$HyphenDate\n"); print FORUM ("$Time\n"); print FORUM ("$TopicSubject\n"); print FORUM ("$Email\n"); print FORUM ("$Message\n"); close (FORUM); &Unlock ("lock.file"); &TopicConfirmHTML; ##Add reply to user's profile (total posts) $TotalPosts++; #Bump user up to Member if Total Posts reaches $MemberMinimum if (($TotalPosts == $MemberMinimum) && ($Status eq "Junior Member")) { $Status = "Member"; } open (MEMBERS, ">$MembersPath/$UserNameFile.cgi") or die("Unable to open Members directory."); print MEMBERS ("$UserName|"); print MEMBERS ("$in{'Password'}|"); print MEMBERS ("$Email|"); print MEMBERS ("$URL|"); print MEMBERS ("$Permission|"); print MEMBERS ("$Occupation|"); print MEMBERS ("$Location|"); print MEMBERS ("$TotalPosts|"); print MEMBERS ("$Status|"); print MEMBERS ("$Interests\n"); close (MEMBERS); } else { &PermissionDeniedHTML; } #END Check Permission block } # END IF block } } ## END POST TOPIC SR ### sub GetBio { $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces open (GETPROFILE, "$MembersPath/$UserNameFile.cgi"); @thatprofile = ; close (GETPROFILE); @thisprofile = split(/\|/, $thatprofile[0]); &ViewBioHTML; } ## END GET BIO sr sub CheckBioID { opendir (MEMS, "$MembersPath/"); @memberlist = readdir(MEMS); closedir (MEMS); $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces GETBIO: foreach $member(@memberlist) { if ($member eq "$UserNameFile.cgi") { $found = "yes"; #Check Password Now open (MEM, "$MembersPath/$member") or die("Unable to open Members directory."); @checkpw = ; close (MEM); @thisprofile = split (/\|/, $checkpw[0]); if ($in{'Password'} eq "$thisprofile[1]") { $pwmatch = "true"; $Password = $thisprofile[1]; $Email = $thisprofile[2]; $URL = $thisprofile[3]; $Occupation = $thisprofile[5]; $Location = $thisprofile[6]; $Interests = $thisprofile[9]; $Status = $thisprofile[8]; $TotalPosts = $thisprofile[7]; $Permissions = $thisprofile[4]; &ProcessEdit; last GETBIO; } } ## END IF MEMBER = Username.cgi condition } ## END FOREACH MEMBER loop if ($found ne "yes") { &NoMatch; } if (($found eq "yes") && ($pwmatch ne "true")) { &WrongPassword; } } ## END CheckBioID SR ### sub ModifyBio { if (($Email eq "") || ($in{'NewPassword'} eq "") || ($Email !~ /\@/)) { &MissingFields; } else { $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces ##print profile fields to file open (MEMBERSHIP, ">$MembersPath/$UserNameFile.cgi") || die("Unable to open Members directory."); print MEMBERSHIP ("$UserName|"); print MEMBERSHIP ("$in{'NewPassword'}|"); print MEMBERSHIP ("$Email|"); print MEMBERSHIP ("$URL|"); print MEMBERSHIP ("$Permissions|"); print MEMBERSHIP ("$Occupation|"); print MEMBERSHIP ("$Location|"); print MEMBERSHIP ("$TotalPosts|"); print MEMBERSHIP ("$Status|"); print MEMBERSHIP ("$Interests\n"); close (MEMBERSHIP); #confirm processing to user, provide links to other places &BioModifyConfirmHTML; } } ## END Modify Bio SR sub RegSubmit { if (($PasswordConfirm eq "") || ($in{'Email'} eq "") || ($UserName eq "") || ($in{'Password'} eq "")) { &MissingFields; } else { if ($in{'Password'} eq "$PasswordConfirm") { &GoAhead; } else { &GoBack; } } } ## END RegSubmit SR ## sub GoAhead { $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces #check for illegal (non alphanumeric characters) $_ = "$UserNameFile"; if (m/\W+/) { &IllegalNameHTML; } else { #check to make sure Username is unique opendir (MEMBERDIR, "$MembersPath/"); @members = readdir(MEMBERDIR); closedir (MEMBERDIR); @members = grep(/cgi/, @members); $duplicate = "no"; CHECKDUPES: for (@members) { if ($_ eq "$UserNameFile.cgi") { $duplicate = "yes"; &Duplicate; last CHECKDUPES; } #CHECK to make sure email isn't a duplicate too if (($duplicate ne "yes") && ($EmailCheck eq "true")) { open (MEM, "$MembersPath/$_") or die("Unable to open Members directory."); @checkemail = ; close (MEM); @profile = split (/\|/, $checkemail[0]); if ($Email eq "$profile[2]") { $duplicate = "yes"; &Duplicate; } } #END if duplicate ne yes } if ($duplicate ne "yes") { #Check to make sure email is not duplicate too open (MEMBERSHIP, ">$MembersPath/$UserNameFile.cgi") or die("Unable to open Members directory."); print MEMBERSHIP ("$UserName|"); print MEMBERSHIP ("$in{'Password'}|"); print MEMBERSHIP ("$Email|"); print MEMBERSHIP ("$URL|"); print MEMBERSHIP ("Write|"); print MEMBERSHIP ("$Occupation|"); print MEMBERSHIP ("$Location|"); print MEMBERSHIP ("0|"); print MEMBERSHIP ("Junior Member|"); print MEMBERSHIP ("$Interests\n"); close (MEMBERSHIP); &PrintRegistrationHTML; } } ### /m end if -- remove later } # end GoAhead subroutine sub decodeURL { $_ = shift; tr/+/ /; s/%(..)/pack('c', hex($1))/eg; return($_); } sub GetDateTime { ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time); $mon++; if ($hour < 12) { $AMPM = "AM"; } if ($hour > 12) { $hour = $hour - 12; $AMPM = "PM"; } if ($hour == 12) { $AMPM = "PM"; } if ($hour == 0) { $hour = "12"; } $min = sprintf ("%2d", $min); $min =~tr/ /0/; $mon = sprintf ("%2d", $mon); $mon =~tr/ /0/; $mday = sprintf ("%2d", $mday); $mday =~tr/ /0/; $HyphenDate = ("$mon" . "-" . "$mday" . "-" . "$year"); $RunonDate = ("$mon$mday$year"); $Time = ("$hour" . ":" . "$min" . " " . "$AMPM"); } #end GetDateTime sr sub GetForumSelectList { if ($ForumStatus1 eq "On" && $number eq "1") { print<$Forum1 SelectHTML } if ($ForumStatus1 eq "On" && $number ne "1") { print<$Forum1 SelectHTML } if ($ForumStatus2 eq "On" && $number eq "2") { print<$Forum2 SelectHTML } if ($ForumStatus2 eq "On" && $number ne "2") { print<$Forum2 SelectHTML } if ($ForumStatus3 eq "On" && $number eq "3") { print<$Forum3 SelectHTML } if ($ForumStatus3 eq "On" && $number ne "3") { print<$Forum3 SelectHTML } if ($ForumStatus4 eq "On" && $number eq "4") { print<$Forum4 SelectHTML } if ($ForumStatus4 eq "On" && $number ne "4") { print<$Forum4 SelectHTML } if ($ForumStatus5 eq "On" && $number eq "5") { print<$Forum5 SelectHTML } if ($ForumStatus5 eq "On" && $number ne "5") { print<$Forum5 SelectHTML } if ($ForumStatus6 eq "On" && $number eq "6") { print<$Forum6 SelectHTML } if ($ForumStatus6 eq "On" && $number ne "6") { print<$Forum6 SelectHTML } if ($ForumStatus7 eq "On" && $number eq "7") { print<$Forum7 SelectHTML } if ($ForumStatus7 eq "On" && $number ne "7") { print<$Forum7 SelectHTML } if ($ForumStatus8 eq "On" && $number eq "8") { print<$Forum8 SelectHTML } if ($ForumStatus8 eq "On" && $number ne "8") { print<$Forum8 SelectHTML } if ($ForumStatus9 eq "On" && $number eq "9") { print<$Forum9 SelectHTML } if ($ForumStatus9 eq "On" && $number ne "9") { print<$Forum9 SelectHTML } } ## End GetForumSelectList sub GenerateThread { open (GETTOPIC, "$ForumsPath/Forum$number/$topic"); @topicguts = ; close (GETTOPIC); $UNCoded = $topicguts[0]; $UNCoded =~ tr/ /+/; $TopicSubject = $topicguts[3]; chomp ($TopicSubject); chomp ($topicguts[1]); chomp ($topicguts[2]); chomp ($topicguts[5]); &ThreadGutsNonIEhtml; #get Replies to this topic opendir (FORUMDIR, "$ForumsPath/Forum$number/"); @forummsgs = readdir(FORUMDIR); closedir (FORUMDIR); $ThisTopicNumber = substr($topic, 0,6); #sort to find all replies to this topic foreach $msg(@forummsgs) { $TopicNumber = substr($msg, 0, 6); if ($TopicNumber eq "$ThisTopicNumber") { $ReplyNumber = substr($msg, 7, 6); if ($ReplyNumber > 0) { push (@replyarray, $msg); } } } @replyarray = sort(@replyarray); #### @replyarray holds all replies to the topic in question foreach $matchreply(@replyarray) { open (REPLY, "$ForumsPath/Forum$number/$matchreply"); @replyguts = ; close (REPLY); $UserNameCoded = $replyguts[0]; $UserNameCoded =~ tr/ /+/; chomp ($replyguts[1]); chomp ($replyguts[2]); chomp ($replyguts[5]); &ThreadRepliesNonIEhtml; } } ## end Generate Thread sr sub CheckPermissions { $matchWrite = $Permission =~ m/Write/; if ($matchWrite eq "1") { $PermissionToWrite = "true"; } else { $PermissionToWrite = "false"; } } #end CheckPermissions sub GrabTopic { opendir (TOPICGRAB, "$ForumsPath/Forum$number/"); @topiclist = readdir(TOPICGRAB); closedir (TOPICGRAB); GRABBER: for (@topiclist) { if (m/^$TopicNumber/) { $TopicFile = $_; last GRABBER; } } } ## End GrabTopic SR sub Lock { local ($lockname) = @_; local ($endtime); $endtime = 15; $endtime = time + $endtime; while (-e $lockname && time < $endtime) { open (LOCKFILE, ">$lockname"); } #end lock sr sub Unlock { local ($lockname) = @_; close (LOCKFILE); unlink ($lockname); } # end Unlock sr } sub PWRequest { print<

Sorry, this feature is not yet enabled... coming soon! DUMMY } ## END PWREQUEST SR

Make your own free website on Tripod.com