Please check permissions in the directory or create a file with coresponding name."); fputs($cf, "Mailing list subscribers\n"); fclose($cf); } // IF REQUEST HAS BEEN TO SUBSCRIBE FROM MAILING LIST, ADD EMAIL TO THE FILE if ($action=="subc"){ // check whether the email is already registered if(strpos($file_content,"<$email>")>0){die("Error: your email is already included in this mailing list/du er allerede registrert.");} // write the email to the list (append it to the file) $cf = fopen($file, "a"); fputs($cf, "\n<$email>"); // new email is written to the file in a new line fclose($cf); // notify subscription print "Your email has been added to our mailing list./din epost er blitt registrert.
Thanks for joining us./Takk for at du registrerte deg."; } // IF REQUEST HAS BEEN TO UNSUBSCRIBE FROM MAILING LIST, REMOVE EMAIL FROM THE FILE if ($action=="unsubc"){ // if email is not in the list, display error if(strpos($file_content,"<$email>")==0){die("Error: your email is not included in this mailing list/din epost er ikke registrert i mailinglisten.");} // remove email from the content of the file $file_content=preg_replace ("/\n<$email>/","",$file_content); // print the new content to the file $cf = fopen($file, "w"); fputs($cf, $file_content); fclose($cf); // notify unsubscription print "Your email has been removed from our mailing list./Din epost er blitt fjernet fra mailinglisten. "; } ?> 1 $test2=strpos(substr($email,strpos($email,"@")), "."); //value must be >1 $test3=strlen($email); //value must be >6 $test4=substr_count ($email,"@"); //value must be 1 if ($test1<2 or $test2<2 or $test3<7 or $test4!=1){die($message);} // check whether email is correct (advance checking) // extracts whatever is after "@" to variable $email_server $email_server=substr($email,strpos($email, "@")+1); // Check DNS records (0 => the server exists; 1=> the server does not exist) if (checkdnsrr($email_server)!=1){die ($message);} } // THIS FUNCTION WILL SHOW THE FORM // MODIFY IT AS REQUIRED function print_form(){ ?>


Innmelding Utmelding