Пример #1
0
$usub_email = isset($_POST['usub_email']) ? $_POST['usub_email'] : "";
$subscribe = new SubscriptionManager();
if ($sub_email != "") {
    $subscribed = $subscribe->subscribe($sub_email);
    if ($subscribed) {
        echo "Subscribed successfully";
        $sub_body = "\n<html>\n<head>\n  <title>Tarboz Newsletter Subscription</title>\n</head>\n<body>\n        <b>Dear subscriber</b>, \n           <p>Thank you for subscribe out news letter. This is to confirm your subscription. Please note we have your permission to send you newsletters periodically.</p>\n           <p>To unsubscribe newsletter, please click <a href='http://zenit.senecac.on.ca:9086/tarboz'>here</a>.</p>\n           <br/>\n           Yours truly,<br/>\n           Tarboz Newsletter\n</body>\n</html>";
        $sub_subject = "Tarboz Newsletter Subscription";
        $subscribe->sendEmail($sub_email, $sub_body, $sub_subject);
    } else {
        echo "Failed successfully";
    }
    header("Location: ../index.php");
} else {
    if ($usub_email != "") {
        $subscribed = $subscribe->unsubscribe($usub_email);
        if ($subscribed) {
            echo "UnSubscribed successfully";
            $usub_body = "\n<html>\n<head>\n  <title>Tarboz Newsletter UnSubscription</title>\n</head>\n<body> \n           <p>Your email address has been removed from our mailing list. You are no longer receiving our newsletters.</p>\n           <p>To re-subscribe newsletter, please click <a href='http://zenit.senecac.on.ca:9086/tarboz'>here</a>.</p>\n           <br/>\n           Yours truly,<br/>\n           Tarboz Newsletter\n</body>\n</html>";
            $usub_subject = "Tarboz Newsletter UnSubscription";
            $subscribe->sendEmail($usub_email, $usub_body, $usub_subject);
        } else {
            echo "Email does not exist";
        }
        header("Location: ../index.php");
    }
}
?>

<script>
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;