".$sorrysignmessage.$email."
";
		$disp="yes";
		$logentry = "$datestamp $email has tried to subscribe to the list,but is already subscribed.\n";
	$newlog = fopen($logfile,"a");
	fwrite($newlog, $logentry);
	fclose($newlog);
	}
# otherwise, add the email to the list
	else {
	$disp="no";
	$newfile = fopen($subscribersfile,"a+");
	$add = "%".$email;
	fwrite($newfile, $add);
	fclose($newfile);
# display the message of subscription
	echo "".$subscribemessage.$email."
";
# Add entry to logfile that email has been subscribed
	$logentry = "$datestamp $email has subscribed to the list.\n";
	$newlog = fopen($logfile,"a");
	fwrite($newlog, $logentry);
	fclose($newlog);
# send confirmation Mail
	$submailheaders = "From: $lettername aanmelding\n";
	$submailheaders .= "Reply-To: $youremail\n";
	mail ($email,$lettername." subscription",$subscribemail,$submailheaders);
	}
}
########################################################################
# Signing out
########################################################################
if ($action=="delete"){		
$disp="no";
# If the email is in the list...
	if ($found == 1){
	$newfile = fopen($subscribersfile,"w+");
	fwrite($newfile, $out);
	fclose($newfile);
# display the message for deleted items...
	echo "".$unsubscribemessage.$email."
";
	$disp="no";
#write to logfile that entry was deleted
	$logentry = "$datestamp $email has been unsubscribed from list.\n";
	$newlog = fopen($logfile,"a");
	fwrite($newlog, $logentry);
	fclose($newlog);
	}
# if the email is not in the list	
	if ($found != 1){
# display the message that tells that...
	echo "".$failedunsubscriptionmessage.$email."
";
	$disp="YES";
#write attempt to logfile
	$logentry = "$datestamp $email was trying to unsubscribe from list,but no entry was found.\n";
	$newlog = fopen($logfile,"a");
	fwrite($newlog, $logentry);
	fclose($newlog);
	}
}
########################################################################
# The core for the owner of the letter
########################################################################
if ($pw	== $pass && $send == "mail" ){
# When nothing was entered so far, display the form
if ($send != "yes" && $send != "test"){
print'';
}
# Predefine the Mail Settings for sending...
$mailheaders = "From: $lettername\n";
$mailheaders .= "Reply-To:$youremail\n";
# add data in bcc fields
# Data was ok, send button is pressed
if ($send == "yes"){
	$message=stripslashes($message);
	$subject=stripslashes($subject);
	$lines = explode("%",$content);
		for ($key=1;$keyHet volgende bericht is verstuurd!";
	print "$mailheaders\n$subject\n\n$message
";
	$newhistory = fopen($historyfile,"a");
	$addhistory = "Datum:$datestamp\nOnderwerp:$subject\nBericht:\n$message\n\n";
	fwrite($newhistory, $addhistory);
	fclose($newhistory);
	}
}
# Show the logfile
if ($log == "show" ) {
	$disp="no";
	echo 'Viewing Logfile
';
	echo '';
	$logshow = implode ("
",file($logfile));
	echo $logshow;
	echo '';
	}
# Show the content of the newsletter historyfile
if ($history == "show" ) {
	$disp="no";
	echo 'Viewing History file
';
	print '';
	$history = implode("
",file($historyfile));
	echo $history;
	print '';
	}
########################################################################
# The Form for the users...
########################################################################
if ($pw != $pass && $disp != "no"){
echo " $welcomemessage ";
print'
';
}
?>