Please indicate: "'.$strFieldName.'"'; }elseif(strlen($strInput)>$intMaxLength){ return '
"'.$strFieldName.'" field is too long. (max '.$intMaxLength.' characters)'; }else{ return ''; } } function strip_magic_slashes($str){ //added this function as a workaround to the php magic quotes thing return get_magic_quotes_gpc() ? stripslashes($str) : $str; } //sendEmail function abbreviated function sendEmail($to,$from,$fromName) { $mail = new PHPMailer(); $mail->From = $from; $mail->FromName = $fromName; //$mail->Host = "mail-relay.tru.ca"; //$mail->Host = SMTPSERVER; $mail->Host = 'mail-relay.tru.ca'; // $mail->Subject = $subject; $mail->Mailer = "smtp"; // $mail->Body = $body; $mail->AddAddress($to); if(!$mail->Send()) { return 0; } return 1; } //clean data in _REQUEST $dataFilter = new InputFilter($tags, $attr, $tag_method, $attr_method, $xss_auto); $_POST = $dataFilter->process($_POST); //declare variables $error_msg = ""; $btnSubmit = isset($_POST['btnSubmit']) ? trim($_POST['btnSubmit']) : ""; $form_email = isset($_POST["form_email"]) ? trim($_POST['form_email']) : ""; $form_name = isset($_POST["form_name"]) ? trim($_POST['form_name']) : ""; $form_action = isset($_POST["form_action"]) ? trim($_POST['form_action']) : ""; ?>
Name:
Email address:
 
> Subscribe >Unsubscribe
$error_msg";?>
process($_POST); //get the cleaned POST data (use the strip_magic_slashes function where we want to allow single quotes) $form_name = isset($_POST["form_name"]) ? strip_magic_slashes(trim($_POST['form_name'])) : ""; $form_email = isset($_POST["form_email"]) ? strip_magic_slashes(trim($_POST['form_email'])) : ""; //subscribe or unsubscribe $form_action = isset($_POST["form_action"]) ? strip_magic_slashes(trim($_POST['form_action'])) : ""; $tostring=""; if ($form_action == '-leave') { $tostring = '-leave@news.tru.ca'; } else { $tostring = '-join@news.tru.ca'; } //if no errors so far (no errors saving to database) then send an email if(strlen($error_msg)==0) { // the first value is the name of the list - OLNews_list $emailsent=sendEmail("OLNews_list".$tostring,$form_email,$form_name); //Send email echo "Thank you

You will receive an email shortly requesting a confirmation of your subscription
"; //check for email sending errors here? if(!$emailsent) { $error_msg.="there was an error sending the message"; } } } } else { $form_action=$_GET['action']; $form_name=$_GET['form_name']; $form_email=$_GET['form_email']; ?>
Name:
Email address:
 
> Subscribe >Unsubscribe