<?php
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$params = array(
"firstname" => _post('firstname'),
"lastname" => _post('lastname'),
"email" => _post('email'),
"privacy" => _post('privacy'),
"privacy1" => _post('privacy'),
);
if (!$params['firstname'] ||
!$params['lastname'] ||
!$params['email'] ||
!_email($params['email']) ||
!$params['privacy']) {
header("Content-Type: text/json; charset=\"UTF8\"");
echo json_encode(array("status" => 0));
} else if(_newsletter_check($params) == 1) {
header("Content-Type: text/json; charset=\"UTF8\"");
echo json_encode(array("status" => 2));
} else {
_newsletter($params);
header("Content-Type: text/json; charset=\"UTF8\"");
echo json_encode(array("status" => 1));
}
}
exit;