Here it is, chomod it 755 and link it thats it.
#!/usr/local/bin/perl
#####################################################################
#
# Script Title: Change Username v1.1
# Written By: Andy Tomaka{atom911} atom911@ubbhackers.com
# Last Modifies: June 16, 2000
#
#####################################################################
#####################################################################
# Set the variables the script needs #
#####################################################################
# The $trackfile variable is used to decide whether to write the
# new username and the old username to a file for admins to view
# Set the bariable to yes or no(CaSE sEnSTivE)
$trackfile = "yes";
# The $DaysLimit variable it used to disallow a user to change their
# name if they have changed their name with in X days where X is the
# numerical value of $DaysLimit. Set it to 0 if you don't want a
# limit, or 1, 2, etc for that amount of days
$DaysLimit = "7";
#####################################################################
# Do not change anything below this line unless you know what you #
# know what you are doing #
#####################################################################
# Parse the URL
READQS: {
@RQSPairs = split /&/, $ENV{'QUERY_STRING'};
foreach $RQSPair (@RQSPairs) {
my ($RQSName, $RQSValue) = split /=/, $RQSPair;
$RQSValue =~ s/+/ /g;
$RQSValue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex(1))/eg;
$QueryString{$RQSName} = $RQSValue;
}
}
# Parse the form
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;
$value =~ s/n/ /g; # replace newlines with spaces
$FORM{$name} = $value;
}
# Allows the script to work with HTML
print ("content-type:text/htmlnn");
# Substitute all require files here for the file
require "UltBB.setup";
require "Styles.file";
require "ubb_library.pl";
require "ubb_library2.pl";
require "Date.pl";
$today_julian_date = &today();
$JulianDateToday = $today_julian_date;
# Put $BGColor in the correct HTML format
$BGColor = qq~bgcolor="$BGColor"~;
# Put $PageBackground in the correct HTML format
$PageBackground = qq~background="$PageBackground"~;
# Decide what to do
if ($FORM{'action'} eq "usernamelogincheck") {
&usernamelogincheck;
exit;
} elsif ($FORM{'action'} eq "usernameformhtml") {
&usernameformhtml;
exit;
} elsif ($FORM{'action'} eq "usernamechange") {
&usernamechange;
exit;
} elsif ($QueryString{'action'} eq "ViewChanges") {
&usernameviewtrack;
exit;
} else {
&usernamelogin;
exit;
}
###############################################################
# The subroutine that handles logging in
###############################################################
sub usernamelogin {
print qq~
<HTML>
<HEAD><TITLE>$BBName - Change UserName</TITLE>
$HeaderInsert
</HEAD>
<BODY $BGColor $PageBackground text="$TextColor" link="$LinkColor" alink="$ActiveLinkColor" vlink="$VisitedLinkColor" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>
<FONT SIZE="2" FACE="$FontFace" COLOR="$TextColor">
$Header
</font>
<FONT SIZE="3" FACE="$FontFace" COLOR="$LinkColor"><B>Change UserName</B></FONT>
<FONT SIZE="$TextSize" FACE="$FontFace">
You can now modify your username! To modify your username, please login to the script that allows you to change your username.
<form method="post">
<INPUT TYPE="hidden" NAME="action" VALUE="usernamelogincheck">
<table border=0>
<tr>
<td>
<FONT SIZE="$TextSize" FACE="$FontFace"><B>UserName</B></FONT>
</td>
<td>
<INPUT TYPE="TEXT" NAME="UserName" SIZE=25 MAXLENGTH=25>
</td></tr>
<tr>
<td>
<B><FONT SIZE="$TextSize" FACE="$FontFace">Password</FONT></B>
</td>
<td>
<INPUT TYPE="PASSWORD" NAME="Password" SIZE=13 MAXLENGTH=13> <FONT SIZE="1" FACE="$FontFace"><A HREF="$CGIURL/Ultimate.cgi?action=lostpw">Forget your password?</A></font>
</td></tr>
</table>
<center>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit Identification">
<INPUT TYPE="RESET" NAME="Reset" VALUE="Clear Fields">
</center>
</form>
If you have previously registered, but forgotten your password, <A HREF="$CGIURL/Ultimate.cgi?action=lostpw">click here</A>.
$Footer
</FONT>
</BODY></HTML>
~;
}
###############################################################
# The Subroutine that checks the ID
###############################################################
sub usernamelogincheck {
# Set the Username and password from the form to $UserName and $Password
$UserName = $FORM{'UserName'};
$Password = $FORM{'Password'};
# See if emailfile.cgi exists
unless (-e "$MembersPath/emailfile.cgi") {
# If it doesn't exist, say we are upgrading
&UserNameHTML("We are upgrading our software at the moment and cannot process new registrations. Please try registering again in a little while. Thank you!");
exit;
}
# See if the temp file exists in members directory
if (-e "$MembersPath/temp.file") {
# If it does, then say we are upgrading
&UserNameHTML("We are temporarily upgrading our Memberships. This process only takes a minute or two. Please try registering again in a couple of minutes. Thank you!");
exit;
}
# See if temp file exists in the cgi directory
if (-e "$CGIPath/temp.file") {
# If it does, say we are upgrading
&UserNameHTML("We are temporarily upgrading our Memberships. This process only takes a minute or two. Please try registering again in a couple of minutes. Thank you!");
exit;
}
# Make sure Username and password fields were not blank
if (($UserName eq "")||($Password eq "")) {
# If they weren't say fields were not complete.
&UserNameHTML("You did not complete all required form fields! Please go back and re-enter.");
} else {
$NameFound = "no";
# Open Profile
$ProfileNumber = &GetUserNumber($UserName);
if ($ProfileNumber ne "") {
$NameFound = "yes";
} else {
$NameFound = "no";
}
if ($NameFound eq "yes") {
#Check Password Now
@profile = &OpenProfile("$ProfileNumber.cgi");
if ($Password eq "$profile[1]") {
$pwmatch = "true";
&usernameformhtml;
}
}
if ($NameFound ne "yes") {
&UserNameHTML("We have no one registered with that user name. Use your back button to try again.");
}
if (($NameFound eq "yes") && ($pwmatch ne "true")) {
&UserNameHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button.");
}
} # end check for missing fields
}
###############################################################
# The subroutine that prints the form
###############################################################
sub usernameformhtml {
# Print the form HTML
print qq~
<HTML>
<HEAD><TITLE>Change Your UserName</TITLE>
$HeaderInsert
</HEAD>
<BODY $BGColor $PageBackground text="$TextColor" link="$LinkColor" alink="$ActiveLinkColor" vlink="$VisitedLinkColor" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>
<FONT SIZE="2" FACE="$FontFace" COLOR="$TextColor">
$Header
</font>
<FONT SIZE="3" FACE="$FontFace" COLOR="$LinkColor"><B>Change UserName</B></FONT>
<FONT SIZE="$TextSize" FACE="$FontFace">
Input your new username. This new username must follow all rules defined for usernameswhen you registered.
<form method="post">
<INPUT TYPE="hidden" NAME="action" VALUE="usernamechange">
<INPUT TYPE="hidden" NAME="oldusername" VALUE="$UserName">
<table border=0>
<tr>
<td>
<FONT SIZE="$TextSize" FACE="$FontFace"><B>Current UserName</B></FONT>
</td>
<td>
$profile[0]
</td></tr>
<tr>
<td>
<B><FONT SIZE="$TextSize" FACE="$FontFace">New UserName</FONT></B>
</td>
<td>
<input type="text" name="newusername" size="30">
</td></tr>
</table>
<center>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit New UserName">
<INPUT TYPE="RESET" NAME="Reset" VALUE="Restart">
</center>
</form>
$Footer
</FONT>
</BODY></HTML>
~;
}
###############################################################
# Subroutine that handles the changes
###############################################################
sub usernamechange {
$OldUserName = $FORM{'oldusername'};
$NewUserName = $FORM{'newusername'};
&usernamedatelegal($NewUserName,$OldUserName);
&usernamelegal($NewUserName);
if ($LegalUsername eq "False") {
&UserNameHTML("Your new username, <b>$NewUserName</b>, was either a duplicate, left blank, or contained illegal charactors. Please use your back button and submit a new name that corrects these problems.");
} else {
# Get the profile number
$ProfileNumber = &GetUserNumber($OldUserName);
# Open the profile in read mode
open (PROFILEREAD, "$MembersPath/$ProfileNumber.cgi");
# Write the contents of the profile to the variable @profile
@profile = <PROFILEREAD>;
# Closes profile
close (PROFILEREAD);
# Set the new username to $profile[0]
$profile[0] = $NewUserName;
# Open the profile in write mode
open (PROFILEWRITE, ">$MembersPath/$ProfileNumber.cgi");
# Print the new user name to the profile
print PROFILEWRITE "$profile[0]n";
# Make every variable in profile $line
foreach $line(@profile[1..15]) {
# Print the $line
print PROFILEWRITE "$line";
}
# Close the profile
close(PROFILEWRITE);
# Run the subroutine that pringts to the memberslist.cgi file
&usernamememberslist($NewUserName,$OldUserName);
# Check to see if $trackfile is equal to yes
if ($trackfile eq "yes") {
# Run the subroutine that creates the track file if $trackfile is equal to yes
&usernametrackfile($NewUserName,$OldUserName,$today_julian_date);
}
# Print ending HTML
print qq~
<HTML>
<HEAD><TITLE>$BBName - Change UserName Successful</TITLE>
$HeaderInsert
</HEAD>
<BODY $BGColor $PageBackground text="$TextColor" link="$LinkColor" alink="$ActiveLinkColor" vlink="$VisitedLinkColor" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>
<FONT SIZE="2" FACE="$FontFace" COLOR="$TextColor">
$Header
</font>
<FONT SIZE="3" FACE="$FontFace" COLOR="$LinkColor"><B>Change UserName Successful</B></FONT>
<FONT SIZE="$TextSize" FACE="$FontFace">
Your username has been changed successfully and is now <b>$NewUserName</b>. Please use this new name when posting notes.
If you made a typo while inputing your username, or would like to change it again, <A HREF="$CGIURL/ubbUserName.cgi">click here</A>.
$Footer
</FONT>
</BODY></HTML>
~;
}
}
###############################################################
# Subroutine that checks to see if the username is a duplicate
# or if it is an illegal name
###############################################################
sub usernamelegal {
$LegalUsername = "True";
# Begin duplicate check
# Parse username to UBB's liking
$NewUserName =~ s/s+/ /g;
# Get the Member List Array
&GetMemberListArray;
# Store something as $LCusername
$LCusername = lc($NewUserName);
# Check @members for duplicates
CHECKDUPLICATELEGAL: for $checkthis(@members) {
$LCcheckthis = lc($checkthis);
if ($LCcheckthis eq "$LCusername") {
$LegalUsername = ("False");
last CHECKDUPLICATELEGAL;
}
}
if ($Censor eq "ON") {
@censored = split(/ /, $censorwords);
CHECKCENSORLEGAL: for (@censored) {
if (m/({)(.*)(})/) {
$_ = ("$2");
}
if ($NewUserName =~ /$_/i) {
$LegalUsername = "False";
$CensorWord = $_;
last CHECKCENSORLEGAL;
}
}
}
if (($NewUserName eq "")||($NewUserName =~ m/^s/)||($NewUserName =~ m/ /)||($NewUserName =~ m/s$/)||($NewUserName =~ m/s{2,}/)||($NewUserName =~ m/|!/)||($NewUserName =~ m/||/)||($NewUserName =~ m/|$/)||($NewUserName =~ m/^|/)||($NewUserName =~ m/></)||($NewUserName =~ m/memberslist/)||($NewUserName =~ m/emailfile/)||($NewUserName =~ m/;/) ||($NewUserName !~ /^[a-zA-Z0-9!?#$@*&^+-~:][']/)||($NewUserName !~ /[a-zA-Z0-9!?#$@*&^+-~:][']$/)) {
$LegalUsername = "False";
}
}
###############################################################
# Subroutine that writes the new username to the
# memberslist.cgi file
###############################################################
sub usernamememberslist {
open (LISTREAD, "$MembersPath/memberslist.cgi");
while(chomp($this=<LISTREAD> <img src="wink.gif" border="0" alt="" /> ) {
($un,$pn) = split(/|!!|/, $this);
if($un eq $OldUserName) {
push (@newcontents, qq($NewUserName|!!|$pnn));
} else {
push (@newcontents, qq($un|!!|$pnn));
}
}
close LISTREAD;
&Lock("lock.file");
open (LISTWRITE, ">$MembersPath/memberslist.cgi");
print LISTWRITE @newcontents;
close LISTWRITE;
&Unlock("lock.file");
chmod (0666, "$MembersPath/memberslist.cgi");
}
###############################################################
# Subroutine that writes to the username tracking file
###############################################################
sub usernametrackfile {
unless (-e "$CGIPath/changes.track") {
open (TRACKWRITE, ">$CGIPath/changes.track");
print TRACKWRITE qq($OldUserName||$NewUserName||$JulianDateTodayn);
close (TRACKWRITE);
chmod (0666, "$CGIPath/changes.track");
} else {
open (TRACKREAD, "$CGIPath/changes.track");
@newcontents = <TRACKREAD>;
push (@newcontents, qq($OldUserName||$NewUserName||$JulianDateTodayn));
close (TRACKREAD);
open (TRACKWRITE, ">$CGIPath/changes.track");
print TRACKWRITE @newcontents;
close (TRACKWRITE);
chmod (0666, "$CGIPath/changes.track");
}
}
###############################################################
# Subroutine that views the username tracking file
###############################################################
sub usernameviewtrack {
unless (-e "$CGIPath/changes.track") {
&UserNameHTML("No one has changed their username.");
} else {
print qq~
<html>
<head><title>Username Changes Tracking</title></head>
<body bgcolor="#FFFFFF" text="#000066" link="#FF0000" alink="#FF0000" vlink="#FF0000">
<center><h1>Username Changes Tracking</h1></center>
<center>
$BorderTop
<table width=$TableWidth2 border=0 cellspacing=1 cellpadding=4>
<tr bgcolor="$AltColumnColor1"><td><b><font face="$FontFace" size="2" color="$CategoryStripTextColor">Old UserName</font></b></td><td><b><font face="$FontFace" size="2" color="$CategoryStripTextColor">New UserName</b></font></td><td><b><font face="$FontFace" size="2" color="$CategoryStripTextColor">Date Changed</b></font></td></tr>
~;
open (TRACKREAD, "$CGIPath/changes.track");
@Tracking = <TRACKREAD>;
close (TRACKREAD);
foreach $line(@Tracking) {
@TrackVars = split(/||/, $line);
($month,$day,$year,$weekday) = &jdate($TrackVars[2]);
print qq~<tr><td valign="top" bgcolor="$AltColumnColor2"><font face="$FontFace" size="2" color="$CategoryStripTextColor">$TrackVars[0]</font></td><td valign="top" bgcolor="$AltColumnColor2"><font face="$FontFace" size="2" color="$CategoryStripTextColor">$TrackVars[1]</font></td><td valign="top" bgcolor="$AltColumnColor2"><font face="$FontFace" size="2" color="$CategoryStripTextColor">$month<b>/</b>$day<b>/</b>$year</font></td></tr>~;
}
print qq~
</table>
$BorderBottom
</center>
$Footer
</BODY>
</HTML>
~;
}
}
###############################################################
# Subroutine that checks if the user has waited the set amount
# of days since the last change.
###############################################################
sub usernamedatelegal {
open(TOOSOONREAD,"changes.track");
@TooSoon = <TOOSOONREAD>;
close(TOOSOONREAD);
foreach $line(@TooSoon) {
($CheckOldUserName, $CheckUserName, $CheckLastDate) = split(/||/, $line);
if ($OldUserName eq $CheckUserName) {
$JulianDateToday = &today();
$DaysWaited = $JulianDateToday - $CheckLastDate;
if ($DaysWaited < $DaysLimit) {
$DaysMore = $DaysLimit - $DaysWaited;
&UserNameHTML("You most wait at least <b>$DaysLimit</b> between name changes. Currently, you have only waited <b>$DaysWaited</b> days and must wait <b>$DaysMore</b> more days before changing your name again.");
exit;
}
}
}
}
###############################################################
# Subroutine that handles the standard HTML.
###############################################################
sub UserNameHTML {
my $Text = shift;
print qq~
<HTML>
<HEAD><TITLE>$BBName - Change UserName</TITLE>
$HeaderInsert
</HEAD>
<BODY $BGColor $PageBackground text="$TextColor" link="$LinkColor" alink="$ActiveLinkColor" vlink="$VisitedLinkColor" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>
<FONT SIZE="2" FACE="$FontFace" COLOR="$TextColor">
$Header
</font>
<A HREF="$CGIURL/Ultimate.cgi?action=intro&BypassCookie=true"><IMG SRC="$NonCGIURL/$BBTitle" BORDER=0></A>
<FONT SIZE="$TextSize" FACE="$FontFace">$Text</FONT>
$Footer
</FONT>
</BODY></HTML>
~;
}
###############################################################
# Subroutine that loads when a subroutine cannot be found
###############################################################
AUTOLOAD {
&UserNameHTML("Subroutine $AUTOLOAD not found. Please contact the administrator of this bulliten board.");
exit;
}