#!/usr/bin/perl
print "Location: http://edit.bbboy.net/support-register\n\n";
__END__
exit;
use CGI::Carp "fatalsToBrowser";

open(TOP,"top.html") || die("Nope $!");
@TOP = <TOP>;
close(TOP);

foreach (@TOP) { $top .= $_; }

open(BOTT,"bottom.html") || die("Nope: $!");
@BOTT = <BOTT>;
close(BOTT);

foreach (@BOTT) { $bott .= $_; }

($bbuser,$ENV{QUERY_STRING}) = split(/;/,$ENV{QUERY_STRING});

if ($ENV{REMOTE_ADDR}=~/62\.30\.112/) {
	print "$top\nPlease go away.$bott";
	exit;
}

if (!$ENV{QUERY_STRING}) {
	print "Content-type:text/html\n\n";
	print $top;

	print qq~
Register A User Account
<p>
<ul><li>If you wish to register a user account, please read the following terms and conditions through, then fill out the form below.
</ul>
<p>
These terms govern your access to Best Boards' message boards. For the creation, administration access, and usage of a Best Board, you agree as below. 
<ol>
<li><h4>Acceptance Of These Terms</h4>
By clicking on "submit" below, you agree to be bound by these terms and conditions at all times, and also to any changes made to these terms as outlined in #12.
<p><li><h4>The Service (Best Boards)</h4>
Best Boards is a web-based service which allows almost anyone to create and use message board(s) using a variety of popular <i>brands</i> of board. You agree that Best Boards is provided as-is, with no guarantees for, among other things, down-time, whether the fault of Best Boards, our web host, their ISP, or any other person(s) who may have influence (We will always strive to never cause down-time ourselves), down-time of any particular message board or feature, access to Best Boards due to end-user software or hardware, the deletion or editing of any data, or the failure to keep data saved to Best Boards.
<p><li><h4>Registration</h4>
To own and administer a Best Board, it is essential that you become a registered user before requesting the creation of a board. For the usage of a Best Board, it is not essential that you register, but it is highly recommended - some administrators may choose to only allow registered users to upload data. You can register for a user account <a href="http://bb.bbboy.net/register.cgi" target=_blank>here</a>. You must agree to the terms and conditions of registering for a user account, as outlined as you begin the user registration process.
<p><li><h4>Content Limitations</h4>
You agree that any data uploaded by you is solely the responsibility of you, and that you, and only you, will be responsible for anything that you transmit using Best Boards (This included uploading data ("Posting"), and using and bulk or singular e-mail functions provided. Best Boards will not be responsible for, endorse or verify the correctness of any data uploaded to Best Boards, and no guarantee is given towards the accuracy, legitimacy, quality, acceptance etc with such data, and no guarantee is given in the case that any data is misplaced, lost, corrupted, edited or deleted.
Best Boards doesn't pre-screen data uploaded, but you agree that Best Boards has the right to gain access any message board on Best Boards (even if the board is private), and delete, edit or restrict access to any data without notice or any form of compensation. You agree that Best Boards may disclose any data uploaded if we believe that doing so is required by us by law or it is needed to comply with legal processes, prove a violation of these terms, protect the rights (including copyright), property, or personal safety of anyone, including, but not limited to, Best Boards staff, our customers, our users, or the general public.
<p><li><h4>Administrator Conduct</h4>
If you are an administrator of a board, you agree to not to design a message board to violate or solicit the violation of any law (be it local, state, county, national or international law), infringe upon the rights (including, but not limited to, property, copyright and privacy rights) of anyone (including our customers, users, staff, and the general public), transmit any data that is illegal, abusive, threatening, defamatory, obscene, or invasive of anyone's privacy, contain <b>pornography, or sexual material of any kind if on the fixed plan</b> (<b>No adult content is permitted on the fixed plan</b>), contain software viruses (Any code, files or programs designed to change, kill, or limit the functionality of any computer software or hardware), falsely claim or misrepresent your (or members of your message board's) affiliation with anyone, interfere with message boards accessible through Best Boards, spam, <b>uploading data which is not in the English language if on the fixed plan</b> (<b>None-English boards are not permitted with the fixed plan</b>) or removing, or attempting to remove, the popup adverts that occur on the fixed plan. You, as the administrator of your message board, must be responsible for attempting to your utmost limits to ensure that none of the above content exists on your message board, and that no part of your message board violates this, or the user terms and conditions. You can report violations to <a href="mailto:bbboy\@bbboy.net">bbboy\@bbboy.net</a>. We reserve the right to delete, edit, remove, control, or ban you and/or your message board(s) with no compensation or notice.
<p><li><h4>Termination</h4>
You agree that Best Boards may terminate your account, or your membership to any particular board, or ban you e-mail address(es), IP number(s), username(s), etc, and remove any data from any board or from your account (Including your post count), without notice or compensation. 
<p><li><h4>Other Resources</h4>
Our users and members of message boards may post links to other web sites or resources. As Best Boards cannot possibly have any control over external sites, we are not responsible for those sites or resources in any way, including, but not limited to, the availability of such web sites or resources, and the content that may be encountered on those sites.
<b><p><li><h4>Disclaimer Of warranties</h4>
You agree and understand that:
<ul><li>Your use of Best Boards is at your own risk. Best Boards is provided as-is, and as-available. Best Boards disclaims all warranties of any kind, whether express or implied, including, but not limited to, fitness for a particular purpose, merchantability and non-infringement.
<li>Best Boards makes no warranty that:
<ol><li>Best Boards will meet your requirements
<li>Best Boards will be secure, error-free or uninterrupted
<li>The information acquired by using Best Boards will be accurate
</ol>
<li>Any data obtained through the use of Best Boards is solely used at your own risk and you, and only you, will be responsible for any damage to your computer hardware, software or data that results from obtaining any such data.
<li>No future contact from Best Boards of any form will constitute any kind of warranty or fitness for a particular purpose, as outlined above.
</ul>
<p><li><h4>Limitation Of Liability</h4>
You understand and agree that Best Boards will not be liable for any damages, direct or indirect, resulting from use or inability to use Best Boards, including, but not limited to, loss of profits, use, data, costs and phone charges.
<p><li><h4>Exclusions And Limitations</h4>
Some Jurisdictions don't allow the exclusion of certain warranties or liability for damages, so some of the above may not apply to you. However, you use Best Boards at your own risk.</b>
<p><li><h4>Legal Disputes</h4>
These terms and your account with Best Boards will be over-seen by the laws of the United Kingdom, excepting stored data or server issues, which will be over-seen by the laws of the United States of America.
<p><li><h4>Modification Of These Terms</h4>
Best Boards reserves the right to change these terms at any time by updating the terms on this page. All changes will be effective immedietly after they are posted. Your use of Best Boards after a modification of these terms will constitute your acceptance of any modifications made. These terms were last modified on September 10th 2001.
<p><li><h4>Enforcing Terms</h4>
Best Boards' failure to enforce any part of these terms will not be seen as a waiver of any term or condition for everyone, or for any one individual or a group of people (users, customers, staff or the general public).<p>
</ol><p>
If you agree with the above terms, please continue below.<p>
<hr><p>
If you would like to register a user account to be able to post on any of <i>Best Boards'</i> message boards, please fill in this short form. Optional fields are marked with an asterisk (*). A confirmation e-mail will be sent to verify your address. <b>You must be 13 years or older to register.</b><br><Br>~;


print qq~
<form action="/register.cgi?$bbuser;step2" method=post name="creator">
<table border=0 align=center>
<tr><td align=right><b>Choose A Username</b></td><td><input type=text name=username></td></tr>
<tr><td align=right><b>Email Address</b></td><td><input type=text name="emailaddress"></td></tr>
<tr><td align=right><b>Show Email Address?</b></td><td><input type=radio name=showemail value="yes" checked> Yes &nbsp; <input type=radio name=showemail value=no> No</td></tr>
<tr><td align=right><b>Web Site URL *</b></td><td><input type=text name=homepage value="http://"></td></tr>
<tr><td align=right><b>AOL ID *</b></td><td><input type=text name=aolname></td></tr>
<tr><td align=right><b>ICQ # *</b></td><Td><input type=text name=icqnumber></td></tr>
<tr><td align=right><b>Location *</b></td><td><input type=text name=location></td></tr>
<tr><td align=right><b>Time Zone *</b></td><td>GMT + <input type=text name=timezone size=2> hours</td></tr>
<tr><td align=right><b>Personal Picture URL *</b><br><font size=-2>(Avatar)</font></td><td><input type=text name=personalpic></td></tr>
<tr><td align=right><b>Personal Pic Width *</b></td><td><input type=text name=ppicwidth size=3> px</td></tr>
<tr><td align=right><b>Personal Pic Height *</b></td><td><input type=text name=ppicheight size=3> px</td></tr>
<tr><td align=right><b>Personal Icon URL *</b></td><td><input type=text name=personalicon ></td></tr>
<tr><td align=right><b>Personal Icon Width *</b></td><td><input type=text name=piconwidth size=3> px</td></tr>
<tr><td align=right><b>Personal Icon Height *</b></td><td><input type=text name=piconheight size=3> px</td></tr>
<tr><td align=right><b>Date Format *</b></td><td>
<select name=dateformat>
<option value="hh:ii:ss <br>ddd mmm dd yyyy">11:45:03 Mon Jan 22 2002
<option value="hh:ii:ss <br>dd/mm/yy">11:45:03 22/01/02
<option value="hh:ii:ss <br>mm/dd/yy">11:45:03 01/22/02
<option value="ddd mmm dd yyyy <br>hh:ii:ss">Mon Jan 22 2002 11:45:03
</select></td></tr>
<tr><td align=right><b>Personal Bio *</b></td><td><textarea size=20 name="bio" cols="30" rows="4"></textarea></td></tr>
<tr><td align=right><b>Signature *<br>(Use BbCode, not HTML)</td><td><textarea size=20 name="signature" cols="30" rows="4"></textarea></td></tr>
</table>
<center><input type=submit value="Register"></center>
</form>
~;
}
elsif ($ENV{QUERY_STRING} eq "step2") {

use CGI qw(:standard);
$query = new CGI;
$cookiepath = ".bbboy.net";

print "Content-type:text/html\n\n";
print $top;
    
$user = $query->param('username');
$clean = $user;
$clean=~s/ /_/g;
$clean=~s/\W//g;

if (-e "/home/bbboy/public_html/bb/bb/all/members/$clean.cgi") {
	print "Sorry, that username already exists. Please press the back button on your browser and try again.";
	print $bott;
	exit;
}

if ($clean=~/^Bb/) {
	print "Sorry, usernames cannot start with 'Bb'.";
	print $bott;
	exit;
}

$email = $query->param('emailaddress');
$timediff = $query->param('timezone');
$ppic = $query->param('personalpic');

$password = crypt(int(rand (1000000)), aun);
$password =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$password=~s/\W//g;
$password = substr($password, 0, 7);
        
$hideemail = 1 unless ($query->param('showemail') eq "no");
$ppicwidth = $query->param('ppicwidth');
$ppicheight = $query->param('ppicheight');
$picon = $query->param('personalicon');
$piconwidth = $query->param('piconwidth');
$piconheight = $query->param('piconheight');
$dateformat = $query->param('dateformat');

open(MB,">/home/bbboy/public_html/bb/bb/all/members/$clean.cgi");
print MB qq~$user
$password
member
$email
$timediff
0

$ppic
$ppicwidth
$ppicheight
$picon
$piconwidth
$piconheight
$hideemail

$dateformat
~;
close(MB);
`cp /boards/all/members/$clean.cgi /boards/all/cuser`;
	($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime (time);
	@mons = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	$mon = $mons[$mon];
	$year+=1900;
	$today = qq~$mon $mday $year~;

	open(PROF,">/home/bbboy/public_html/profiles/$clean");
	print PROF qq~<!--#include virtual="top.html"-->\n~;
	$myemail = "Private";
	$myemail = qq~<a href="mailto:$email">$email</a>~ if ($hideemail);
	$location = $query->param('location');
	$homepage = $query->param('homepage');
	$aol = $query->param('aolname');
	$icq = $query->param('icqnumber');
	$bio = $query->param('bio');
	$bio=~s/\n/<br>/g;
	print PROF qq~	<br><br><table border=0 align=center>
				<tr><td><b>Username</b></td>
				<td><!--username-->$user<!--/username--></td></tr>
				<tr><td><b>Total Posts</b></td>
				<td><!--totalposts-->0<!--/totalposts--></td></tr>
				<tr><td><b>E-mail</b></td>
				<td><!--email-->$myemail<!--/email--></td></tr>
				<tr><td><b>Location</b></td>
				<td><!--location-->$location<!--/location--></td></tr>
				<tr><td><b>Date Joined</b></td>
				<td>$today</td></tr>
				<tr><td><b>Web Site</b></td><td><!--website-->$homepage<!--/website--></td></tr>
				<tr><td><b>AOL ID</b></td><td><!--aol-->$aol<!--/aol--></td></tr>
				<tr><td><b>ICQ #</b></td><td><!--icq-->$icq<!--/icq--></td></tr>
				<tr><td><b>Personal Bio</b></td><td><!--personalbio-->$bio<!--/personalbio--></td></tr>
				</table>
		~;
	print PROF qq~<!--#include virtual="bottom.html"-->~;
	close(PROF);

	$sig = $query->param('signature');
	$sig=~s/\n/[br]/g;
	$sig=~s/\r//g;

	open(SG,">/home/bbboy/public_html/bb/bb/all/sigs/$clean-1.cgi");
	print SG "Signature\n";
	print SG $sig;
	close(SG);

		print qq~	Registered sucessfully. Please check your e-mail for your password (sent to <a href="mailto:$email">$email</a>). When you have it, log in from <a href="/index.shtml">here</a>. You can change your password by clicking <a href="http://bb.bbboy.net/support-edituserprefs">here</a>. ~;
		print qq~	<a href="http://bb.bbboy.net/$bbuser">Click here</a> to return to the board you came from.~ if ($bbuser);
    
                $to = "$email";
                $from = "BbBoard <noreply\@bbboy.net>";
                $subject = "Your Registration Details";
                
                $message .= "\n";
                $message .= "Thank you for registering for Best Boards!\n\n\n";
                $message .= "Here is your username and password:\n\n";
                $message .= "Username: $user\n";
                $message .= "Password: $password\n\n\n";
                $message .= "Usernames and passwords are case sensitive. Having problems logging in? View this thread: http://bb.bbboy.net/support-viewthread?forum=1&thread=393\n\n";
                $message .= "http://bb.bbboy.net\n";
                $message .= "You came from: http://bb.bbboy.net/$bbuser" if ($bbuser);
                
            open(MAIL,"|/usr/lib/sendmail -t");
			print MAIL "To: $to\n";
			print MAIL "From: $from\n";
			print MAIL "Subject: $subject\n\n";
			print MAIL $message;
			close(MAIL);
                
                } # end send password to member
print $bott;
