Top chess
Success through clear vision, definite goals and clear roles
Saturday, January 19th, 2019

12 Carden Place


AB10 1UR


+44 (0)1224 658303



Senior Managers' E-Briefing : ISSN 1742-8033

Please go back and correct the errors as shown below:

"; if(isset($_POST['submit'])){ //validate email address$trimemail = trim($email); if(!ereg( "[a-zA-Z0-9_-]+@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)*([a-zA-Z]([a-zA-Z0-9-]*[a-zA-Z0-9]))", $trimemail)) { $validate_error .= "

The email address provided does not appear to be correct: $trimemail

"; $error="true"; } $trimvalidemail = trim($validemail); if(!ereg("[a-zA-Z0-9_-]+@([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)*([a-zA-Z]([a-zA-Z0-9-]*[a-zA-Z0-9]))", $trimvalidemail)) { $validate_error .= "

The validate email address provided does not appear to be correct: $trimvalidemail

"; $error="true"; } if(!($trimemail == $trimvalidemail)) { $validate_error .= "

The email address and validation email address are not the same.
Email: $trimemail
Validate email: $trimvalidemail

"; $error="true"; } //Validate details if(!$_POST['firstname']) { $validate_error .= "

Please enter your first name so we can correctly address the email to you.

"; $error="true"; } if(!$surname) { $validate_error .= "

Please enter your surname.

"; $error="true"; } if(!$jobtitle) { $validate_error .= "

Please enter your jobtitle.

"; $error="true"; } if(!$company) { $validate_error .= "

Please enter your Company name.

"; $error="true"; } if(!$hearabout) { $validate_error .= "

Please tell us how you heard about us.

"; $error="true"; } //Validate toc if(!$toc==1) { $validate_error .= "

You must accept the terms and conditions before we can subscribe you.

"; $error="true"; } // display any errors and exit if($error == "true") { echo "$validate_error

"; } else { // if valid, add a record to the database and send a Welcome email to the user $code = date("dhtsg"); $sql = "insert into pi_newsletter (firstname, surname, jobtitle, company, country, email, hearabout, code) values ('$firstname', '$surname','$jobtitle','$company', '$country', '$trimemail','$hearabout','$code')"; $conn = db_connect(); $result = mysql_query($sql, $conn); if(!$result) { echo "Subscription failed due to a database error. Please try again later, the Systems Administrator has been notified.
"; echo mysql_error() . "
"; } else { echo "$success_subscribe

"; $to = $trimemail; $subject = "$subscribe_subject"; //email formatted structure $content = "Dear !!%%firstname%%!!, Thank you for enrolling for the free Senior Managers' Briefing. Please click on the link below so that we can confirm you did indeed subscribe. !!%%website%%!!validate.php?email=!!%%email%%!!&id=!!%%code%%!! We respect your privacy and will NOT rent or sell your email address to third parties. Please feel free to suggest topics you want covered in the Senior Managers' Briefings. It would also be a great help if you could tell other professionals and managers about the Briefings. All the best Bill Having problems validating your email? Some mailreaders automatically break the line containing the URL or will not display the link as a clickable area. If this happens you can type (or copy and paste) the link manually into a browser address line. "; $content = ereg_replace('!!%%firstname%%!!', $firstname, $content); $content = ereg_replace('!!%%website%%!!', $website, $content); $content = ereg_replace('!!%%email%%!!', $trimemail, $content); $content = ereg_replace('!!%%code%%!!', $code, $content); $from = "From: $webmaster_email"; $mail = mail($to, $subject, $content, $from); if(!$mail) { echo "

$failed_email"; } //email to Bill telling him about this subscriber $to = $webmaster_email; $from = "From: $webmaster_email"; $subject = "Senior Briefing - New Subscriber!"; $content = "The following person subscribed to your newsletter! \n\n"; $content .= "Firstname: $firstname \n\n"; $content .= "Surname: $surname \n\n"; $content .= "Jobtitle: $jobtitle \n\n"; $content .= "Company: $company \n\n"; $content .= "Country: $country \n\n"; $content .= "Email: $trimemail \n\n"; $content .= "Heard about: $hearabout"; $mail = mail($to, $subject, $content, $from); } } } else{ include("newsletterF/actual-form.htm"); } ?>