File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/sv-inns.com/mail.php
Back
<?php function reCaptcha($recaptcha){ $secret = "6LcQnskqAAAAAMAm6OVRrDvvIZXP-gc5K2sVlMZx"; $ip = $_SERVER['REMOTE_ADDR']; $postvars = array("secret"=>$secret, "response"=>$recaptcha, "remoteip"=>$ip); $url = "https://www.google.com/recaptcha/api/siteverify"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); $data = curl_exec($ch); curl_close($ch); return json_decode($data, true); } // Only process POST reqeusts. if (isset($_POST)) { // Get the form fields and remove whitespace. $name = strip_tags(trim($_POST["name"])); $name = str_replace(array("\r","\n"),array(" "," "),$name); $lastname = strip_tags(trim($_POST["lastname"])); $lastname= str_replace(array("\r","\n"),array(" "," "),$lastname); $email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL); $contact = strip_tags(trim($_POST["contact"])); $message = strip_tags(trim($_POST["message"])); if ( empty($name) OR !filter_var($email, FILTER_VALIDATE_EMAIL) OR $contact =='' ) { echo "Oops! There was a problem with your submission. Please complete the form and try again."; exit; } $subject="Enquiry Mail"; // Set the email subject. $subject = " $subject"; $message1="<table><tr><td>Name</td><td>".$name."</td></tr> <tr><td>Lastname</td><td>".$lastname."</td></tr> <tr><td>Email</td><td>".$email."</td></tr> <tr><td>Contact</td><td>". $contact."</td></tr> <tr><td>Message</td><td>". $message."</td></tr> </table>"; $recipient = "reservations@sv-inns.com"; // $email_content .= "Name: $name\n"; // $email_content .= "Email: $email\n"; // $email_content .= "Message:\n$message\n\n"; // Build the email headers. $email_headers = "From: $name <$email>"; $email_headers .= "Reply-To: $email \r\n"; $email_headers .= "Content-Type: text/html; charset=utf-8"; // Send the email. if (mail($recipient, $subject,$message1, $email_headers)) { // Set a 200 (okay) response code. echo "Thank You! Your message has been sent."; } else { // Set a 500 (internal server error) response code. echo "Oops! Something went wrong and we couldn't send your message."; } } else { // Not a POST request, set a 403 (forbidden) response code. echo "There was a problem with your submission, please try again."; } ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.14 |
proxy
|
phpinfo
|
Settings