#!/usr/bin/perl

#
###                   FREEWARE UBB SCRIPT                ##
#
# Ultimate Bulletin Board is copyright Infopop Corporation, 1998-2000.
#
#       ------------ ubbmisc.cgi -------------
#
#  This file contains functionality for the Freeware UBB.
#
#  Infopop Corporation offers no
#  warranties on this script.  The owner/licensee of the script is
#  solely responsible for any problems caused by installation of
#  the script or use of the script, including messages that may be
#  posted on the BB.
#
#  All copyright notices regarding the Ultimate Bulletin Board
#  must remain intact on the scripts and in the HTML
#  for the scripts.  These "powered by" and copyright notices MUST
#  remain visible when the pages are viewed on the Internet.
#
#  You may not SELL this script.  You may offer it freely to others.
#  It is freeware.  You may not alter the code and then call it another
#  name.  You may not alter the code and then resell it under another
#  name, either.
#
# For more info on the Ultimate BB, including licensing info,
# see http://www.UltimateBB.com
#
###############################################################
#
#If you are running UBB on IIS,
#you may need to add the following line
#if so, just remove the "#" sign before the print line below
#print "HTTP/1.0 200 OK\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 "UltBB.setup";
require "Date.pl";
require "mods.file";
require "ubb_library.pl";
require "ubb_library2.pl";

};

print ("Content-type: text/html\n\n");

if ($@) {
    print "Fehler - folgende Dateien konnten nicht geöffnet werden: $@\n";
    print "Bitte stellen Sie sicher, daß die Dateien existieren und/oder Zugriffsrechte und Pfade korrekt konfiguriert sind.";
exit;
}

&ReadParse;

foreach $row(@in) {
	($Name, $Value) = split ("=", $row);
	$Name = &decodeURL($Name);
	$Value = &decodeURL($Value);
	
		if ($Name eq "forum") {
			$Forum = $Value;
			$Forum =~ s/\/\\//g;
			$ForumCoded = &HTMLIFY($Forum);
			$ForumCoded =~ tr/ /+/;
			$Forum = &UNHTMLIFY($Forum);
	}
		if ($Name eq "TopicSubject") {
			$TopicSubject = $Value;
			$TopicSubject =~ s/<.+?>//g;
				$TopicSubject = &UNHTMLIFY($TopicSubject);
	}
		if ($Name eq "UserName") {
		$UserName = $Value;
		$UserNameFile = $UserName;
		$UserNameFile =~ s/ /_/g; #remove spaces
	}
		if ($Name eq "PasswordConfirm") {
			$PasswordConfirm = $Value;
		}

		if ($Name eq "number") {
			$number = $Value;
	}
		if ($Name eq "DaysPrune") {
			$DaysPrune = $Value;
	}
	if ($Name eq "topic") {
			$topic = $Value;
	}

	if ($Name eq "Email") {
			$Email = $Value;
			$Email =~tr/A-Z/a-z/; 
	}
	if ($Name eq "URL") {
			$URL = &CleanThis($Value);
			$URL = &PipeCleaner($URL);
	}
	if ($Name eq "Permissions") {
			$Permissions = $Value;
	}
	if ($Name eq "Occupation") {
			$Occupation = &CleanThis($Value);
			$Occupation = &PipeCleaner($Occupation);
	}
	if ($Name eq "Location") {
			$Location = &CleanThis($Value);
			$Location = &PipeCleaner($Location);
	}
	if ($Name eq "TotalPosts") {
		$TotalPosts = $Value;
	}
	if ($Name eq "Status") {
		$Status = $Value;
	}
	if ($Name eq "Interests") {
			$Interests = &CleanThis($Value);
			$Interests = &PipeCleaner($Value);
	}
		if ($Name eq "sendto") {
			$sendto = $Value;
	}
}  # end FOREACH $row

if ($VariablesPath eq "") {
	$VariablesPath = $CGIPath;
}
$ReplyMessage = $in{'ReplyMessage'};
$Message = $in{'Message'};

		$SubjectCoded = &HTMLIFY($TopicSubject);
		$SubjectCoded =~ tr/ /+/;


  
if ($in{'action'} eq "getbio") {
 &GetBio;
 } 
 
if ($in{'action'} eq "editbio") {
 &EditBio;
 } 


if ($in{'action'} eq "checkbioid") {
&CheckBioID;
 } 
 
if ($in{'action'} eq "modifybio") {
   &ModifyBio;
 }
  
  if ($in{'action'} eq "RegSubmit") {
 &RegSubmit;
 }
 
sub GetBio {
@thisprofile = &OpenProfile("$UserName.cgi");
$EmailView = $thisprofile[11];
$Signature = $thisprofile[12];
chomp($Signature);

if (($EmailBlock eq "ON") || ($EmailView eq "no")) {
$EmailField = "Nicht verfügbar.";
}  else {
$EmailField = "<A HREF=\"mailto:$thisprofile[2]\">$thisprofile[2]</A>";
}
&ViewBioHTML;
}  ## END GET BIO sr

sub CheckBioID {
if (($in{'UserName'} eq "") || ($in{'Password'} eq "")) {
&StandardHTML("Sie haben nicht alle Pflichtfelder ausgefüllt - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
} else {

$NameFound = "no";
if (-e "$MembersPath/$UserNameFile.cgi") {
      $NameFound = "yes";
	} 

	if ($NameFound eq "yes") {
		#Check Password Now
		
	@thisprofile = &OpenProfile("$UserName.cgi");
	
         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];
			$DateRegistered = $thisprofile[10];
	$EmailView = $thisprofile[11];

            &ProcessEdit;
         }
    } ## END IF MEMBER = Username.cgi condition

if ($NameFound ne "yes") {
   &StandardHTML("Der von Ihnen angegebene Benutzername existiert nicht in unserem System - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
}
if (($NameFound eq "yes") && ($pwmatch ne "true")) {
   	&StandardHTML("Das von Ihnen eingegebene Kennwort ist nicht korrekt  - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
}
} # end check for missing fields
}  ## END CheckBioID SR ###




## HTML CODE ####
  
sub EditBio {
print<<EDITbioHTML;
<HTML>
<HEAD><TITLE>$BBName - Profil editieren</TITLE>
</HEAD>
 <BODY bgcolor="#FFFFFF"   text="#000000" link="#000080" vlink="#800080">
<FONT SIZE="3" FACE="Verdana, Arial" COLOR="#000000">

</font>
<A HREF="Ultimate.cgi?action=intro"><IMG SRC="$NonCGIURL/bbtitle5.jpg" BORDER=0></A>
<FONT SIZE="3" FACE="Verdana, Arial" COLOR="#000080"><B>Modifizierung Ihres Profils</B></FONT>
<p>
<FONT SIZE="2" FACE="Verdana, Arial">
Sie sind dafür verantwortlich, daß Ihre persönlichen Daten immer auf dem aktuellsten Stand sind.
Für die Änderung Ihrer persönlichen Daten ist nicht der Administrator zuständig 
<p>
Um Ihre persönlichen Daten zu ändern, identifizieren Sie sich bitte zunächst: 

<p>
<FORM ACTION="ubbmisc.cgi" METHOD="POST" NAME="EditProfile">
<table border=0>
<tr>
<td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Ihr Benutzername</B></FONT>
</td>
<td>
<INPUT TYPE="TEXT" NAME="UserName" SIZE=25 MAXLENGTH=25>
</td></tr>
<tr>
<td>
<B><FONT SIZE="2" FACE="Verdana, Arial">Ihr Kennwort</FONT></B>
</td>
<td>
<INPUT TYPE="PASSWORD" NAME="Password" SIZE=13 MAXLENGTH=13>
</td></tr>
</table>
<center>
<INPUT TYPE="HIDDEN" NAME="action" VALUE="checkbioid">
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Identifikation senden">
<INPUT TYPE="RESET" NAME="Reset" VALUE="Felder löschen">
</center>

</form>


<P>
<center>

</center>
</FONT>
</BODY></HTML>
EDITbioHTML

}  ##END EDIT BIO SR

sub BioModifyConfirmHTML {
print<<HTML;
<HTML>
<HEAD><TITLE>
Veränderung des Profils - Bestätigung</title>
</head>
 <BODY bgcolor="#FFFFFF"  text="#000000" link="#000080" vlink="#800080"><BR><BR>
<p><FONT SIZE="2" FACE="Verdana, Arial"><B>
Vielen Dank, $UserName.  Das Update Ihres Profils wurde erfolgreich durchgeführt.
<P>
$ModifyWarning
<P>
<table border=0>
<TR>
<TD valign=top>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Zurück zu:</B></FONT></td>
<td valign=top><FONT SIZE="2" FACE="Verdana, Arial"><B>
<A HREF="Ultimate.cgi?action=intro&BypassCookie=true">Foren-Übersicht</A>
<BR><A HREF="$CGIURL/ubbmisc.cgi?action=editbio">
Modifikation Ihres Profils</a>
<BR>
<A HREF="$NonCGIURL/faq.html" target=_blank>Hilfe</A>

</B></FONT>

</td></tr></table>
</B>
</FONT>
</body>
</html>
HTML
}  ## END Bio Modify Confirmation sr



sub ViewBioHTML {

if ($thisprofile[10] eq "") {
$DateRegistered = "Nicht verfügbar.";
}  else {
$DateRegistered = "$thisprofile[10]";
}

print <<BioHTML;
<HTML>
 <BODY bgcolor="#FFFFFF"   text="#000000" link="#000080" vlink="#800080">
<FONT SIZE="2" FACE="Verdana, Arial"><B>Profil für $thisprofile[0]</B></FONT>
<HR>
<BLOCKQUOTE>
<table border=0>
<tr><td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Datum der Registration:</B></FONT></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$DateRegistered</FONT>
</td></tr>
<tr><td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Status:</B></FONT></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$thisprofile[8]</FONT>
</td></tr>
<tr><td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Erstellte Beiträge:</B></FONT></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$thisprofile[7]</FONT>
</td></tr>
<tr><td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>eMail-Adresse:</B></FONT></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$EmailField</FONT>
</td></tr>
<TR>
<td><FONT SIZE="2" FACE="Verdana, Arial"><B>Homepage:</B></font></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080"><A HREF="$thisprofile[3]" target=_top>$thisprofile[3]</A></font>
</td></tr>
<TR>
<td><FONT SIZE="2" FACE="Verdana, Arial"><B>OBeruf:</B></font></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$thisprofile[5]</font>
</td></tr>
<TR>
<td><FONT SIZE="2" FACE="Verdana, Arial"><B>Wohnort:</B></font></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$thisprofile[6]</font>
</td></tr>
<TR>
<td><FONT SIZE="2" FACE="Verdana, Arial"><B>Hobbies:</B></font></td>
<td><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$thisprofile[9]</font>
</td></tr>
</table>
</BLOCKQUOTE>
<HR>
</BODY></HTML>
BioHTML
}  ## END View BIO HTML sr

sub ProcessEdit {

if ($EmailView eq "no") {
	$EVno = "CHECKED";
} else {
	$EVyes = "CHECKED";
}



print<<EditHTML;
<HTML><HEAD></HEAD>
 <BODY bgcolor="#FFFFFF" text="#000000" link="#000080" vlink="#800080">
<FONT SIZE="3" FACE="Verdana, Arial" COLOR="#000000">
<A HREF="Ultimate.cgi?action=intro"><IMG SRC="$NonCGIURL/bbtitle5.jpg" BORDER=0></A>
<FONT SIZE="3" FACE="Verdana, Arial" COLOR="#000080"><B>Verändern Sie Ihr Profil</B></FONT>
<p><FONT SIZE="2" FACE="Verdana, Arial">
Vielen Dank! Ihre Identität wurde durch das System bestätigt, $UserName ($Status).
<p>
Bitte ändern Sie die entsprechenden Felder nach Ihrer Wahl ab.
<P>
</FONT>
<FORM ACTION="ubbmisc.cgi" METHOD="POST">
<table border=0>
<tr>
<td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Ihre eMail-Adresse</B></FONT>
</td>
<td>
<INPUT TYPE="TEXT" NAME="Email" VALUE="$Email" SIZE=30 MAXLENGTH=155>
</td></tr>
<tr>
<td>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Ihr Kennwort</B></FONT>
</td>
<td>
<INPUT TYPE="TEXT" NAME="NewPassword" VALUE="$Password" SIZE=30 MAXLENGTH=155>
</td></tr>
<tr>
<td>
<B><FONT SIZE="2" FACE="Verdana, Arial">Ihre Homepage</FONT></B>
</td>
<td>
<INPUT TYPE="TEXT" NAME="URL" VALUE="$URL" SIZE=30 MAXLENGTH=200>
</td></tr>
<tr>
<td>
<B><FONT SIZE="2" FACE="Verdana, Arial">Ihr Beruf</FONT></B>
</td>
<td>
<INPUT TYPE="TEXT" NAME="Occupation" VALUE="$Occupation" SIZE=30 MAXLENGTH=100>
</td></tr>
<tr>
<td>
<B><FONT SIZE="2" FACE="Verdana, Arial">Stadt, PLZ, Land</FONT></B>
</td>
<td>
<INPUT TYPE="TEXT" NAME="Location" VALUE="$Location" SIZE=30 MAXLENGTH=150>
</td></tr>
<tr>
<td>
<B><FONT SIZE="2" FACE="Verdana, Arial">Ihre Hobbies</FONT></B>
</td>
<td>
<INPUT TYPE="TEXT" NAME="Interests" VALUE="$Interests" SIZE=50 MAXLENGTH=200>
</td></tr>

<tr>
<TD valign=top><FONT SIZE="2" FACE="Verdana, Arial"><B>Soll Ihre eMail-Adresse für andere Benutzer sichtbar sein?</B></FONT></TD>
<TD valign=top><CENTER><FONT SIZE="2" FACE="Verdana, Arial"><INPUT TYPE="RADIO" NAME="EmailView" VALUE="yes" $EVyes>
 ja <INPUT TYPE="RADIO" NAME="EmailView" VALUE="no" $EVno> nein</font>
</CENTER> </TD>
</TR>
</table>
<center>
<P>
<INPUT TYPE="HIDDEN" NAME="action" VALUE="modifybio">
<INPUT TYPE="HIDDEN" NAME="UserName" VALUE="$UserName">
<INPUT TYPE="HIDDEN" NAME="Password" VALUE="$in{'Password'}">
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Modifikation durchführen">
<INPUT TYPE="RESET" NAME="Reset" VALUE="Felder löschen"><center>

</center>
</form></font>
</BODY></HTML>
EditHTML
}  ##END Process Edit SR


sub RegSubmit {

if (($UseEmail eq "ON") && ($EmailVerify eq "ON")) {

	if ( ($in{'UserName'} eq "") || ($in{'Email'} eq "") || ($in{'Email'} !~ /\@/) )  {
		&StandardHTML("Sie haben nicht alle Pflichtfelder ausgefüllt oder keine korrekte eMail-Adresse eingegeben - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
		} else {
		&GoAhead;
	}

} else {

	if ( ($in{'UserName'} eq "") || ($in{'Email'} !~ /\@/) || 	($in{'Password'} eq "") || ($PasswordConfirm eq "") )  {
		&StandardHTML("Sie haben nicht alle Pflichtfelder ausgefüllt oder keine korrekte eMail-Adresse eingegeben - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
	}  else {
	
		if ($in{'Password'} eq "$PasswordConfirm") {
			&GoAhead; 
			}  else {
			&StandardHTML("Registration fehlgeschlagen!<P>Die wiederholte Kennwort-Eingabe stimmt nicht mit Ihrem gewählten Kennwort überein  - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
		}
	}
}
}  ## END RegSubmit SR ##


sub GoAhead  {	
#check for illegal (non alphanumeric characters)
$_ = "$UserNameFile";
&CheckBadChars($UserNameFile);
if ((m/\W+/) || (m/\b[_]/) || (m/[_]\b/) || (m/_{2,}/)) {
&StandardHTML("Der von Ihnen gewählte Benutzername kann aus einem der folgenden Gründen nicht verwendet werden:<P><blockquote>1.  Sie haben Sonderzeichen benutzt, bitte benutzen Sie ausschließlich Buchstaben und Zahlen - Leerzeichen sind nicht erlaubt.<p>2.  Sie haben einen Benutzernamen eingegeben, welcher keine Buchstaben oder Zahlen enthält.</B></blockquote><p><CENTER>Bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!</center>");
}  else {
#check to make sure Username is unique

&GetMemberListArray;

$LCUNFile = "$UserNameFile"; #Get ready to lower case it
	$LCUNFile =~ tr/A-Z/a-z/; #convert to lc for check
$duplicate = "no";


CHECKDUPES: for $checkthis(@members) {
	$checkthisLC = "$checkthis";
	$checkthisLC =~ tr/A-Z/a-z/; #convert to lc for check
	if ($checkthisLC eq "$LCUNFile.cgi") {
		$duplicate = "yes";
		&StandardHTML("Der von Ihnen angegebene Benutzername wird in unserem System bereits verwendet - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und wählen Sie einen anderen Benutzernamen aus!");
		last CHECKDUPES;
	}

#CHECK to make sure email isn't a duplicate too

if (($duplicate ne "yes") && ($EmailCheck eq "true")) {

open (MEM, "$MembersPath/$checkthis") or die(&StandardHTML("FEHLER: Das Verzeichnis der Mitglieder-Dateien kann nicht gelesen werden. $!"));
@checkemail = <MEM>;
close (MEM);

	@profile = split (/\|/, $checkemail[0]);
	
	if ($Email eq &PipeRestore($profile[2])) {
		$duplicate = "yes";
		&StandardHTML("Die von Ihnen angegebene eMail-Adresse wird bereits durch einen anderen Benutzer verwendet - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
	}
}  #END if duplicate ne yes
}  # end checkdupes loop
if ($duplicate ne "yes") {

$Password= &CleanThis($in{'Password'});

if ($Password =~ /(\W+)/ ) {
	&StandardHTML("The password you have attempted to register is illegal for one of the following reasons:<P><blockquote>1.  You may have included an illegal character in your password.  You should only use letters, numbers, or spaces (apostrophes, for example, are not permitted). You may not begin or end a password with a space.  You may not have two or more consecutive spaces.<p>2.  You may have attempted to use a word that doesn't include any letters or numbers.</B></blockquote><p><CENTER>Use your back button to try again.</center>");
	exit;
}

# Get Today's Date so we can log the date of registration

&GetDateTime;

@filter_these = ("Occupation","Location","URL","Interests","Email"); # rem HTM and unclosed tags
	foreach(@filter_these){
		$$_ =~ s/<.+?>//g;
		$$_ =~ s/</&lt;/g;
	}

@translate_these = ("UserName","PassWord","Email","URL","Occupation","Location"); # filter out pipes
	foreach(@translate_these){
		$$_ = &PipeCleaner($$_);
	}



## APPEND NEW REGISTRATION TO REG FILE
&Lock ("lock.file");
open (MEMBERSHIP, ">$MembersPath/$UserNameFile.cgi") or die(&StandardHTML("FEHLER: Die neue Mitglieds-Datei kann nicht erstellt werden. $!"));
	print MEMBERSHIP ("$UserName|");
	print MEMBERSHIP ("$Password|");
	print MEMBERSHIP ("$Email|");
	print MEMBERSHIP ("$URL|");
	print MEMBERSHIP ("Write|");
	print MEMBERSHIP ("$Occupation|");
	print MEMBERSHIP ("$Location|");
	print MEMBERSHIP ("0|");
	print MEMBERSHIP ("Junior-Mitglied|");
	print MEMBERSHIP ("$Interests|");
	print MEMBERSHIP ("$HyphenDate|");
	print MEMBERSHIP ("$in{'EmailView'}|");
	print MEMBERSHIP (" \n");
close (MEMBERSHIP);
&Unlock ("lock.file");

$RegWording1 = "Sie haben sich erfolgreich in unserem System registriert.";
$RegWording2 = "$in{'Password'}";

&PrintRegistrationHTML;

} ### end if dupe ne yes
} # end if/else /m
}  # end GoAhead subroutine

sub PrintRegistrationHTML {
print <<HTML;
<HTML>
<HEAD><TITLE>
Bestätigung der Registration</title></head>
 <BODY bgcolor="#FFFFFF"   text="#000000" link="#000080" vlink="#800080">
<FONT SIZE="2" FACE="Verdana, Arial" color="#000000">

<table border=0>
<tr><td colspan=2>
<FONT SIZE="2" FACE="Verdana, Arial"><B>Herzlichen Glückwunsch!
<P>
$RegWording1  Sie können jetzt Beiträge erstellen oder auf vorhandene Beiträge antworten.<br> Die Daten Ihrer Registration:</B></FONT>
</td></tr>
<tr>
<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihr Benutzername</B></FONT></TD>
<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$UserName</font>
 </TD>
</tr>

<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihr Kennwort</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$RegWording2</font>
 </TD>
</tr>
<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihre eMail-Adresse</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$Email</font>
 </TD>
</TR>
<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Stadt, PLZ, Land</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$Location</font>
 </TD>
</TR>
<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihr Beruf</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$Occupation</font>
 </TD>
</tr>
<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihre Hobbies</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$Interests</font>
 </TD>
</tr>
<TR>
	<TD bgcolor="#F7F7F7"><FONT SIZE="2" FACE="Verdana, Arial"><B>Ihre Homepage</B></FONT></TD>
	<TD bgcolor="#dedfdf"><FONT SIZE="2" FACE="Verdana, Arial" COLOR="#000080">$URL</font>
 </TD>
</tr>

</TABLE>
<p><FONT SIZE="2" FACE="Verdana, Arial">
<A HREF="$CGIURL/Ultimate.cgi?action=intro">Klicken Sie hier, um jetzt unsere Foren zu betreten!</A><br><br>
</FONT>
<br><br><br>
</font></body></html>
HTML
} ## END Print Registration sr



sub ModifyBio {
if (($Email eq "") || ($in{'NewPassword'} eq "") || ($Email !~ /\@/)) {
&StandardHTML("Sie haben nicht alle Pflichtfelder ausgefüllt - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
 }  else {
 
## Confirm UserName and Password to prevent hacking

unless (-e "$MembersPath/$UserName.cgi"){
	&StandardHTML("Es existiert kein Benutzer mit dem Namen <b>$UserName</b>.");
	exit;
}


&OpenProfile("$UserName.cgi");  #returns @profileinfo
$CurrentEmail = "$profileinfo[2]";
$Permissions = "$profileinfo[4]";
$TotalPosts = "$profileinfo[7]";
$Status = "$profileinfo[8]";
$DateRegistered = "$profileinfo[10]";
chomp($DateRegistered);

if ($profileinfo[1] eq "$in{'Password'}") {

## check for duplicate email addresses, if applicable

if ($EmailCheck eq "true") {
&GetMemberListArray;
$duplicate = "";

CHECKEMAIL: for $checkemails(@members) {

open (MEM, "$MembersPath/$checkemails") or die(&StandardHTML("FEHLER: Das Verzeichnis der Mitglieds-Dateien kann nicht gelesen werden. $!"));
@checkemail = <MEM>;
close (MEM);

	@profileEM = split (/\|/, $checkemail[0]);
	
	if (($Email eq "$profileEM[2]") && ($UserName ne "$profileEM[0]")) {
		$duplicate = "yes";
		last CHECKEMAIL;
	}
} # end for $checkemails
}  #END if Email check eq TRUE

if ($duplicate eq "yes") { 
	&StandardHTML("Die von Ihnen angegeben eMail-Adresse wird bereits von einem anderen Benutzer verwendet.");
} else {

$Password= &CleanThis($in{'NewPassword'});

if ($Password =~ /(\W+)|\|/ ) {
	&StandardHTML("The password you have attempted to register is illegal for one of the following reasons:<P><blockquote>1.  You may have included an illegal character in your password.  You should only use letters, numbers, or spaces (The pipe |, for example, is not permitted). You may not begin or end a password with a space.  You may not have two or more consecutive spaces.<p>2.  You may have attempted to use a word that doesn't include any letters or numbers.</B></blockquote><p><CENTER>Use your back button to try again.</center>");
	exit;
}

$ModifyWarning = "";

@filter_these = ("Occupation","Location","URL","Interests","Email"); # rem HTML and unclosed tags
	foreach(@filter_these){
		$$_ =~ s/<.+?>//g;
		$$_ =~ s/</&lt;/g;
	}

@translate_these = ("UserName","PassWord","Email","URL","Occupation","Location"); # filter out pipes
	foreach(@translate_these){
		$$_ = &PipeCleaner($$_);
	}

&CheckBadChars($UserNameFile);

&Lock("lock.file");
##print profile fields to file
open (MEMBERSHIP, ">$MembersPath/$UserNameFile.cgi") || die(&StandardHTML("FEHLER: Mitglieds-Datei kann nicht erstellt werden. $!"));

	print MEMBERSHIP ("$UserName|");
	print MEMBERSHIP ("$Password|");
	print MEMBERSHIP ("$Email|");
	print MEMBERSHIP ("$URL|");
	print MEMBERSHIP ("$Permissions|");
	print MEMBERSHIP ("$Occupation|");
	print MEMBERSHIP ("$Location|");
	print MEMBERSHIP ("$TotalPosts|");
	print MEMBERSHIP ("$Status|");
	print MEMBERSHIP ("$Interests|");
	print MEMBERSHIP ("$DateRegistered|");
	print MEMBERSHIP ("$in{'EmailView'}|");
	print MEMBERSHIP (" \n");
close (MEMBERSHIP);
&Unlock("lock.file");
#confirm processing to user, provide links to other places

&BioModifyConfirmHTML;
}

}  else  {
&StandardHTML("Der Zugriff auf ein Profil eines anderen Benutzers ist nicht zugelassen, Sie können ausschließlich Ihr eigenes Profil editieren.");
}

} # end if/else complete fields
}  ## END Modify Bio SR
