Mailing lista - prijava
UPSS mailing lista '; // GET EMAIL $email=$_POST["email"]; // To avoid problems, only lower case is used $email=strtolower($email); // Check whether email is correct by using a function // function requires the email address and the error message if(!check_email($email, "Greska: e-mail adresa nije ispravna.")) { return; } // GET VALUE FOR action : subc (subscribe) or unsubc (unsubscribe) $action=$_POST["action"]; // this is the file with the info (emails) // When using the link in the top to download the complete script, a new name for this file $file = "upss_emaillist_jklujdklsn.txt"; // lets try to get the content of the file if (file_exists($file)) { // If the file is already in the server, its content is pasted to variable $file_content $file_content = file_get_contents($file); } else { // If the file does not exists, lets try to create it // In case file can not be created (probably due to problems with directory permissions), // the users is informed (the first user will be the webmaster, who must solve the problem). $cf = fopen($file, "w"); fputs($cf, "Mailing lista"); 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) { echo "Greska: e-mail adresa se vec nalazi na listi"; } // write the email to the list (append it to the file) $cf = fopen($file, "a"); fwrite($cf, "\n<$email>"); // new email is written to the file in a new line fclose($cf); // notify subscription echo "Vasa e-mail adresa -" . $email . "- je dodata na listu.
Hvala."; echo '

'; } // 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) { echo "Greska: navedena e-mail adresa se ne nalazi na listi"; echo '

'; } // 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 echo "e-mail adresa je izbrisana sa liste. "; echo '

'; } echo ''; } // THIS FUNCTION WILL CHECK WHETHER AN EMAIL IS CORRECT OR NOT // FIRST, BASIC ARCHITECTURE IS CHECKED // THEM, EXISTANCE OF THE EMAIL SERVER IS CHECKED // If email is not correct, the error message is shown and page dies function check_email ($email, $message) { $res = true; // check if email exists if ($email=="") { echo $message; echo '

'; $res = false; } // check whether email is correct (basic checking) $test1=strpos($email, "@"); //value must be >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) { echo $message; echo '

'; $res = false; } // 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) return $res; } // THIS FUNCTION WILL SHOW THE FORM // MODIFY IT AS REQUIRED function print_form() { echo ' UPSS mailing lista



Na ovoj stranici se možete prijaviti
na mailing listu UPSS ako želite da dobijate
povremena obaveštenja o aktivnostima Udruženja.

Ako želite da odjavite svoju e-mail adresu sa liste,
označite "Odjavljujem se sa liste"

upišite svoju e-mail adresu
Prijavljujem se na listu Odjavljujem se sa liste

'; } ?>
Korisničko ime


Zaboravili ste lozinku?
Tražite novu.