#!/usr/bin/perl ############################################################# # Ikonboard v2.1 # Copyright 2001 Ikonboard.com - All Rights Reserved # Ikonboard is a trademark of Ikonboard.com # # Software Distributed by: Ikonboard.com # Visit us online at http://www.ikonboard.com # Email us on [email protected] # # All files written by Matthew Mecham ############################################################# use CGI::Carp "fatalsToBrowser"; # Output errors to browser use CGI qw(:standard); # Saves loads of work $CGI::POST_MAX=1024 * 150; # limit post data $CGI::DISABLE_UPLOADS = 1; # Disable uploads $CGI::HEADERS_ONCE = 1; # Make sure we only have 1 header eval { ($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1"); require "ikon.lib"; # Require ikonboard () require "data/progs.cgi"; # Require prog names require "data/boardinfo.cgi";# Require board info require "data/styles.cgi"; # Require styles info require "ikonmail.lib"; # Require styles info }; if ($@) { print header(); print start_html(-title=>"Ikonboard Error!"); print "Could not find these files: $@\nIf you are running NT you may need to enter the full path in each require statement in each script"; print end_html; exit; } $|++; # Unbuffer the output #################--- Begin the program ---################### $thisprog = "register.cgi"; $query = new CGI; &checkVALIDITY; $cookiepath = $query->url(-absolute=>1); $cookiepath =~ s/$thisprog//sg; for ('inmembername','password','emailaddress','showemail','homepage','aolname','icqnumber', 'location','interests','signature','timedifference','useravatar','action') { next unless defined $_; next if $_ eq 'SEND_MAIL'; $tp = $query->param($_); $tp = &unHTML("$tp"); ${$_} = $tp; } $helpurl = &helpfiles("Registering"); $helpurl = qq~$helpurl~; &title; $output .= qq~

    $boardname
    Register
  $helpurl

~; if ($action eq "addmember") { #start add member $membercode = "me"; $membertitle = "Member"; $numberofposts = "0"; $joineddate = time; $lastpostdate = "Not Posted"; $ipaddress = $ENV{'REMOTE_ADDR'}; # check against the ban lists $filetoopen = "$ikondir" . "data/banlist.cgi"; open(FILE,"$filetoopen"); @bannedmembers = ; close(FILE); foreach (@bannedmembers) { ($bannedname, $bannedemail, $bannedip) = split(/\|/,$_); chomp $bannedname; chomp $bannedemail; chomp $bannedip; if ($emailaddress =~ /^$bannedemail/) { $bannedmember = "yes"; } if ($inmembername eq "$bannedname") { $bannedmember = "yes"; } if ($ipaddress =~ /^$bannedip/) { $bannedmember = "yes"; } } if ($bannedmember eq "yes") { print header(); &error("Registering&Sorry, you are not allowed to register. Please email the administrator of the board"); } if (($passwordverification eq "yes") && ($emailfunctions ne "off")) { $seed = int(rand 100000); $password = crypt($seed, aun); $password =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $password =~ s/\.//g; $password =~ s/\|//g; $password = substr($password, 0, 7); } if ($interests) { $interests =~ s/\t//g; $interests =~ s/\r//g; $interests =~ s/ / /g; $interests =~ s/\n\n/\/g; $interests =~ s/\n/\/g; } if ($signature) { $signature =~ s/\t//g; $signature =~ s/\r//g; $signature =~ s/ / /g; $signature =~ s/\n\n//g; $signature =~ s/\n/\[br\]/g; } ######check for bad words if ($membernamefilter eq "yes"){ $filetoopen = "$ikondir" . "data/badwords.cgi"; open (FILE, "$filetoopen"); $badwords = ; close (FILE); if ($badwords) { @pairs = split(/\&/,$badwords); foreach (@pairs) { ($bad, $good) = split(/=/,$_); if ($inmembername =~ /$bad/ig){ print header(); &error("Registering&Please do not use profanity in your membername"); } if ($signature =~ /$bad/ig){ print header(); &error("Registering&Please do not use profanity in your signature"); } } } } ### Throw an error if they have more than three sig lines. @testsig = split(/\[br\]/,$signature); $siglines = @testsig; if (($siglines > "2") && (@testsig[3] ne "")) { print header(); &error("Registering&Sorry, you can only have three lines to your signature"); } ### make sure its a valid form if($inmembername eq "") { $blankfields = "yes"; } if($password eq "") { $blankfields = "yes"; } if($emailaddress eq "") { $blankfields = "yes"; } if ($blankfields) { print header(); &error("Registering&Please ensure that the username, emailaddress and password fields are filled in"); } if($inmembername =~ /_/) { print header(); &error("Registering&Please do not use underscores in your name. You can enter a space if required"); } $inmembername =~ y/ /_/; $_ = $inmembername; if ((m/\b[_]/) || (m/\W+/) || (m/_{2,}/) || (m/[_]\b/)) { print header(); &error("Registering&Username contained invalid characters"); } if($emailaddress !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) { print header(); &error("Registering&Invalid Email Address"); } ### check for an already in use member name &getmember("$inmembername"); if ($userregistered ne "no") { $allowregister = "fail"; } my ($tempinusername) = $inmembername; chomp $tempinusername; opendir (DIR, $ikondir."members/"); @foundreggedmember = grep { /^$tempinusername\.cgi/i } readdir(DIR); closedir (DIR); if (@foundreggedmember) { $allowregister = "fail"; } if ($allowregister eq "fail") { print header(); &error("Registering&Error, user already exists. Please go back and correct"); } $memberfiletitle = $inmembername; $memberfiletitle =~ y/ /_/; $filetomake = "$ikondir" . "members/$memberfiletitle.cgi"; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE "$inmembername|$password|$membertitle|$membercode|$numberofposts|$emailaddress|$showemail|$ipaddress|$homepage|$aolname|$icqnumber|$location|$interests|$joineddate|$lastpostdate|$signature|$timedifference|$privateforums|$useravatar|$misc1|$misc2|$misc3"; close(FILE); $inmembername =~ y/_/ /; $output .= qq~
Thanks for registering $inmembername
Status:
~; if (($passwordverification eq "yes") && ($emailfunctions ne "off")) { $output =~ s/Status\:/Your password has been emailed to you/; } ### Set the cookies $namecookie = cookie(-name => "amembernamecookie", -value => "$inmembername", -path => "$cookiepath", -expires => "+30d"); $passcookie = cookie(-name => "apasswordcookie", -value => "$inpassword", -path => "$cookiepath", -expires => "+30d"); ### Create a dummy file to foil snoopers, and to stop them gaining a list of the directory open (FILE, ">members/index.html"); print FILE qq( 401 Authorization Required

Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.


Apache/1.3.9 Server at $homeurl Port 80
Hosted by www.Geocities.ws

); close (FILE); ### append boardstats.cgi require "$ikondir" . "data/boardstats.cgi"; $filetomake = "$ikondir" . "data/boardstats.cgi"; $totalmembers++; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE "\$lastregisteredmember = \"$inmembername\"\;\n"; print FILE "\$totalmembers = \"$totalmembers\"\;\n"; print FILE "\$totalthreads = \"$totalthreads\"\;\n"; print FILE "\$totalposts = \"$totalposts\"\;\n"; print FILE "\n1\;"; close (FILE); ### Send the emails if (($passwordverification eq "yes") && ($emailfunctions ne "off")) { $passcookie = cookie(-name => "apasswordcookie", -value => "", -expires => "now"); $to = "$emailaddress"; $from = "$homename <$adminemail_out>"; $subject = "Thank You For Registering at $boardname"; $message .= "\n"; $message .= "$homename\n"; $message .= "$boardurl/$forumsummaryprog\n\n\n"; $message .= "Thank you for registering!\n\n\n"; $message .= "Your username and password are below:\n\n"; $message .= " Username : $inmembername\n"; $message .= " Password : $password\n\n\n"; $message .= "Usernames and passwords are case sensitive.\n\n"; $message .= "Please note that you can change your password at any time\n"; $message .= "by editing your profile. If you change your email address,\n"; $message .= "a new password will be sent to you.\n\n"; &sendmail($from, $from, $to, $SMTP_SERVER, $subject, $message); } # end send password to member if ($newusernotify eq "yes" && $emailfunctions ne "off") { $to = "$adminemail_in"; $from = "$homename <$adminemail_out>"; $subject = "New User Has Registered"; $message = ""; $message .= "\n"; $message .= "$boardname\n"; $message .= "$boardurl/$forumsummaryprog\n"; $message .= "---------------------------------------------------------------------\n\n"; $message .= "New user registration information:\n\n"; $message .= " Username : $inmembername\n"; $message .= " Password : $password\n"; $message .= " Email : $emailaddress\n"; $message .= " Homepage : http://$inhomepage\n"; $message .= " IP Address: $ipaddress\n\n"; $message .= "---------------------------------------------------------------------\n"; &sendmail($from, $from, $to, $SMTP_SERVER, $subject, $message); } # end routine } # end routine elsif ($action eq "agreed") { if (($passwordverification eq "yes") && ($emailfunctions ne "off")) { $requirepass = qq~ Your password will be emailed to the address you specify ~; } else { $requirepass = qq~ Password:
Please choose a password, all passwords are case sensitive.
Please do not use any 'wild' characters such as '*' '|' or any other HTML characters ~; } ### Avatar stuff if ($avatars eq "on") { $dirtoopen = "$imagesdir" . "avatars"; opendir (DIR, "$dirtoopen") or die "This is not the correct directory ($dirtoopen) please check the \$imagesdir path in the Admin center \>\; Set-Variables"; @dirdata = readdir(DIR); closedir (DIR); @images = grep(/gif/,@dirdata); @images = sort @images; foreach (@images) { $cleanavatar = $_; $cleanavatar =~ s/.gif//i; # Skip, if it's an admin/moderator only avatar if ($cleanavatar =~ /admin_/) { next; } if ($cleanavatar eq "noavatar") { $selecthtml .= qq~\n~; $currentface = "$cleanavatar"; } else { $selecthtml .= qq~\n~; } } $avatarhtml = qq~ Avatar:
You may choose an avatar to be displayed under your chosen username when you make a post ~; } # end avatar if ### Print the form $output .= qq~
Name:
Membernames cannot be more than 20 characters in length $requirepass Email Address:
Please enter a valid email address, this can be kept private if you wish. Show Email Address
Do you want your email address to be shown with each post?: Yes  \; No Homepage:
If you have a homepage, please enter the URL. This is optional. AOL Name:
Please enter your AOLAIM screen name if you have one. This is optional. ICQ Number:
Please enter your ICQ number if you have one. This is optional Location:
Please enter your location. This is optional. Time offset:
All times on the server are $basetimes.
Enter the number of hours that you are offset from this timezone,
and all the times on the board will be altered to fit your timezone. Interests:
You may enter your interests here Signature:
Please enter a signature to be included with each post. 3 lines only.
You may use the following IkonCode tags:
[b]Bold[/b], [i]Italic[/i] and [url]http://www.yourdomain.com[/url]

You cannot use HTML $avatarhtml

~; } # end agree else { # show register agree form $filetoopen = "$ikondir" . "data/register.dat"; open(FILE,$filetoopen) or die "Cannot locate the register.dat file, this should be in the data directory"; @filedata = ; close(FILE); foreach (@filedata) { $tempoutput .= $_; } $output .= qq~
Terms and conditions of service $tempoutput
~; } # end elseform print header(-cookie=>[$namecookie, $passcookie]); &output( -Title => $boardname, -ToPrint => $output, -Version => $versionnumber );
Hosted by www.Geocities.ws

1