كود PHP:
<?
function IsEmailAddress($themail)
{
if (ereg(
"^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-z
A-Z0-9-]+(.[a-zA-Z0-9-]+)*$",$themail,
$regs)) {
return true;
}
else {
return false;
}
}
if
(!isset($themail))
{
?>
<form
name="emils" action="email.php"
method="post">
<input name="themail"
type="text" value="Enter Your Email">
<input type="submit" value="Send">
</form>
<?
}
else
{
if (!IsEmailAddress($themail))
{
echo "<p> الإيميل غلط
</p>";
}else{
$fp=fopen("email.txt","a+");
$fr = fread($fp, 32000);
echo $fr;
if(substr_count($fr, $themail) <> 0){
?>
<p>الإيميل موجود من الأول</p>
<?
}
else{
fwrite($fp,"$themail\n");
?>
<p>الإيميل أضيف .. شكرا</p>
<?
}
fclose($fp);
}
}
?>