D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
designpitara.com
/
ajax
/
Filename :
about-us-mail.php
back
Copy
<?php if ( !filter_var( $_POST['name'], FILTER_SANITIZE_STRING ) ) { $msg['status'] = "false"; $msg['captchaError'] = "Invalid Name Format"; echo json_encode( $msg ); exit(); } elseif ( !filter_var( $_POST['service'], FILTER_SANITIZE_STRING ) ) { $msg['status'] = "false"; $msg['captchaError'] = "Invalid Company Name"; echo json_encode( $msg ); exit(); } elseif ( !filter_var( $_POST['phone'], FILTER_VALIDATE_INT ) ) { $msg['status'] = "false"; $msg['captchaError'] = "Invalid Phone No"; echo json_encode( $msg ); exit(); } elseif ( !filter_var( $_POST['message'], FILTER_SANITIZE_STRING ) ) { $msg['status'] = "false"; $msg['captchaError'] = "Message is not in proper format."; echo json_encode( $msg ); exit(); } else { if ( isset( $_POST['g-recaptcha-response'] ) && !empty( $_POST['g-recaptcha-response'] ) ) { if ( isset( $_POST['companyname'] ) || isset( $_POST['name'] ) ) { // Get the submitted form data $txtname = filter_var( $_POST['name'], FILTER_SANITIZE_STRING ); $phone = filter_var( $_POST['phone'], FILTER_VALIDATE_INT ); $services = filter_var( $_POST['service'], FILTER_SANITIZE_STRING ); $txtmessage = filter_var( $_POST['message'], FILTER_SANITIZE_STRING ); $re_captcha = $_POST['g-recaptcha-response']; $secretKey = "6LeOYc8dAAAAAFQYm5rGp28LL1EY0OXJiDSCYWM2"; $ip = $_SERVER['REMOTE_ADDR']; $regDate = date( 'd-m-Y H:i' ); $response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$re_captcha."&remoteip=".$ip ); $responseKeys = json_decode( $response, true ); if ( intval( $responseKeys["success"] ) !== 1 ) { $msg['status'] = "false"; $msg['msg'] = "You are spammer ! Get the @$%K out"; $msg['captchaError'] = "You are spammer ! Get the @$%K out"; exit; } else { $to = 'ravindra@designpitara.com'; //$to = 'designpitara1@gmail.com'; $from = 'contact@designpitara.com'; $fromName = 'Design Pitara'; $subject = "About us page Enquiry"; $htmlContent = ' <html> <head> <title></title> </head> <body> <p><b>Name</b> : '.$txtname.'</p> <p><b>Phone</b> : '.$phone.'</p> <p><b>Service</b> : '.$services.'</p> <p><b>Message</b> : '.$txtmessage.'</p> </body> </html>'; // Set content-type header for sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // Additional headers $headers .= 'From: '.$fromName.'<'.$from.'>' . "\r\n"; // Send email if ( mail( $to, $subject, $htmlContent, $headers ) ) { $msg['status'] = "true"; $msg['msg'] = "Query Submit Successfully . Our Team Contact You As Soon As Possible"; $msg['captchaError'] = "Query Submit Successfully . Our Team Contact You As Soon As Possible"; echo json_encode( $msg ); } else { $msg['status'] = "false"; $msg['captchaError'] = "Please Enter required fields."; echo json_encode( $msg ); } } } else { $msg['status'] = "false"; $msg['msg'] = "Please Enter required fields."; $msg['captchaError'] = "Please Enter required fields."; exit; } } else { $msg['status'] = "false"; $msg['msg'] = "Please check on the reCAPTCHA box."; $msg['captchaError'] = "Please check on the reCAPTCHA box."; echo json_encode( $msg ); exit; } }