Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_SERVER["HTTP_ORIGIN"])){
- header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
- }
- if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
- header('Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS');
- header('Access-Control-Allow-Headers: token, Content-Type');
- header("Access-Control-Max-Age: 600");
- header('Content-Length: 0');
- header('Content-Type: text/plain');
- die();
- }
- header('Content-Type: application/json');
- include('common.php');
- if(isset($_POST['action']) && $_POST['action']=='partner_application'){
- //captcha validation
- if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
- $secret = '6LfHdygTAAAAACwxNmCDPR8YB76GTuScqKJCLU2q';
- $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
- $responseData = json_decode($verifyResponse);
- if($responseData->success==1){
- //email blank chk
- if(empty($_POST['email'])){
- $ret=array('success'=>0,'msg'=>'Not a valid email. lease try later.');
- } else{
- $to='service@zamenhof.net';
- $from='service@zamenhof.net';
- $subject='Contact form';
- $attachment=array();
- $body = 'Contact form from: '.$_POST['email'].'<br />';
- $body .= 'IP: '.$_SERVER['REMOTE_ADDR'].'<br />';
- $body .= 'Name: '.$_POST['first_name'].' '.$_POST['last_name'].'<br />';
- $body .= 'Website: '.$_POST['website'].'<br />';
- $body .= 'Country: '.$_POST['country'].'<br />';
- $body .= 'Volume: '.$_POST['volume'].'<br />';
- $body .= 'Other: '.$_POST['remarks'].'<br />';
- sl_mail($subject,$to,$from,$body,$attachment);
- $ret=array('success'=>1,'msg'=>'Your application was</br>successfully submitted.</br></br>We will contact you shortly.');
- }
- } else {
- $ret=array('success'=>0,'msg'=>'Captcha is not validated. Please try later.');
- }
- } else {
- $ret=array('success'=>0,'msg'=>'Captcha is not clicked');
- }
- echo json_encode($ret);
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement