if ($action=="sign"){
if ($email=="" || (!ereg(".+\@.+\..+", $email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $email))){
echo "<div align=\"center\">".$emtymessage."</div>
";
}
elseif ($found==1){
# When there is already a subscription for this email Display Sorrymessage
echo "<div align=\"center\">
".$sorrysignmessage.$email."</div>
";
$disp="yes";
}
# otherwise, add the email to the list
else {
$disp="no";
$newfile = fopen($filelocation,"a+");
$add = "%".$email;
fwrite($newfile, $add);
fclose($newfile);
# display the message of subscription
echo "<div align=\"center\">
".$subscribemessage.$email."</div>
";
# send confirmation Mail
$submailheaders = "From: $lettername subscription form\n";
$submailheaders .= "Reply-To: $youremail\n";
mail ($email,$lettername." subscription",$subscribemail,$submailheaders);
}
}