function sendEmail() { global $sid; $to = getEmailForCurrentSession(); //from functions.php if ($to == 'undef') { $to = str_replace("'", '', $_SESSION['postEmail']); } $email_sent = true; foreach ($_SESSION['mediaId'] as $id => $mediaId) { //tis avoid duplicates being sent when someone reloads the page if (!has_seen_negative_option($sid)) { echo "Sending " . $mediaId . "</br>"; include 'PHPMailer/mailer.php'; } } unset($_SESSION['mediaId']); }
} if (has_finished(-1)) { redir("thankYouPage.php"); } else { if (!array_key_exists('sid', $_COOKIE)) { redir("consent.php", true); } else { $sid = intval($_COOKIE['sid']); if (!has_consented($sid)) { redir("consent.php", true); } else { if (!has_done_presurvey($sid)) { if ("intro.php" != basename($_SERVER["SCRIPT_FILENAME"])) { redir("shopping.php"); } } else { if (!has_seen_negative_option($sid)) { //pre survey done redir('purchase.php', true); //go to negative options page } else { if (has_finished($sid)) { redir("thankYouPage.php"); } else { redir('endSurvey.php'); } } } } } }