Maililisti regamine

Lisab POSTitud e-mailid maililisti jaoks tekstifaili. Koodi alguses on aadressivorm,
kasutamiseks eemalda kommentaarid või kopeeri vorm sihtkohta.

<!--  MESSAGE FORM
<form method="post" action="">
   < div style="float:right;border:0px solid #bbb;background:inherit;width:190px;";> 
   < input type="text" size="20" name="mail" style="height:18px;color:#999;" 
    value="e-mail" onclick="this.value=''">    < input type="submit" class="groov" value="OK" style="height:21px;"><br/>     < font color="#999">Liitu maililistiga</font></div> </form> //-->
<?php   // MAIL.PHP $fail = "mail.txt"; $mail = htmlspecialchars($_POST["mail"], ENT_QUOTES);    if ((strlen($mail) > 1) && (strpos($mail,"@") > 1)) {    if (file_exists($fail)) {      $fh = fopen($fail, "r");      $fcontent = fread($fh, filesize($fail));      fclose ($fh);    } else touch($fail);    $sisu = $mail ."\n";    $towrite = $sisu . $fcontent;    $fh2 = fopen($fail, 'w') or die();    fwrite ($fh2, $towrite);    fclose ($fh2);    echo $mail . " registreeritud"; } else echo $mail . " ei ole sobiv aadress"; echo "<META HTTP-EQUIV='refresh' content='0;URL=../index.php?q=5'>";   // redirect ?>