$error_script = '<script type="text/javascript">if (typeof $ != \'undefined\') {';
/* Email*/
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if (preg_match($email_exp, $email) == 0) {
    $error_message .= 'Invalid email.';
    $error_script .= '$("#semail").addClass(".has-error"); ';
}
$error_script .= "}</script>";
if (strlen($error_message) > 0) {
    died($error_message, $error_script);
}
/* UPDATE DATABASE */
$user = MarketingUserIdWithEmail($email);
//check if this user already exists in our database
if ($user > 0) {
    if (UpdateMarketingUser($user, "{$fname} {$lname}", '', $company, $phone, 1)) {
        //		echo 'Updated marketing user '.$user."...\n";
    } else {
        //		echo 'Failed to update marketing user '.$user."...\n";
    }
} else {
    if (AddMarketingUser("{$fname} {$lname}", '', $company, $email, $phone, 0, $app, 1)) {
        $user = MarketingUserIdWithEmail($email);
        //		echo 'Added marketing user '.$user."...\n";
    } else {
        //		echo 'Failed to add marketing user '.$user."...\n";
    }
}
function clean_string($string)
{
    $bad = array("content-type", "bcc:", "to:", "cc:", "href");
示例#2
0
    die;
}
if ($user > 0) {
    /* QUERY DATABASE */
    $fname = MarketingUserNameWithId($user);
    $email = MarketingUserEmailWithId($user);
    $company = MarketingUserCompanyWithId($user);
    $phone = MarketingUserPhoneWithId($user);
} else {
    /* VALIDATE FORM */
    validateForm();
    /* UPDATE DATABASE */
    $user = MarketingUserIdWithEmail($email);
    //check if this user already exists in our database
    if ($user > 0) {
        if (UpdateMarketingUser($user, $fname, '', $company, $phone, $adv)) {
        } else {
            trigger_error('Failed to update marketing user ' . $user . "...\n");
        }
    } else {
        if (AddMarketingUser($fname, '', $company, $email, $phone, 0, $app, $adv)) {
            $user = MarketingUserIdWIthEmail($email);
        } else {
            trigger_error("Failed to add new marketing user...\n");
        }
    }
}
/* INTERNAL EMAIL */
sendInternalEmail();
/* EMAIL CONFIRMATION */
sendEmailConfirmation();