/
/
home
/
u523034047
/
domains
/
idsautomation.in
/
public_html
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.60
PHP 8.3.30
Dir:
/home/u523034047/domains/idsautomation.in/public_html
Edit:
/home/u523034047/domains/idsautomation.in/public_html/mail.php
<?php include ('admin/conn.php');?> <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $to = 'shailendra@idsautomation.in'; $email = $_POST['email']; $mobile = $_POST['mobile']; $description = $_POST['description']; $subject = 'Online Enquiry Details From Website'; $message = "Name: ".$name."<br>"."Email: ".$email."<br>"."Mobile No: ".$mobile."<br>"."Message: ".$description."<br>"; $header = "From:shailendra@idsautomation.in \r\n"; $header .= "Cc:shailendra@idsautomation.in \r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html\r\n"; $mail = mail ($to,$subject,$message,$header); if(!$mail== true ) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { header('location: thank-you.php'); } } ?> <?php if (isset($_POST['submit2'])) { // =============== 1. reCAPTCHA Verification =============== $secretKey = "6LfEziMsAAAAAINhdX4fp3omWD1Y2XEDO-0H2UAz"; $responseKey = $_POST['g-recaptcha-response']; $userIP = $_SERVER['REMOTE_ADDR']; $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$responseKey&remoteip=$userIP"; $response = file_get_contents($url); $response = json_decode($response); if (!$response->success) { die("Captcha verification failed. Please go back and try again."); } // =============== 2. Get Form Fields =============== $name = mysqli_real_escape_string($connection, $_POST['name2']); $email = mysqli_real_escape_string($connection, $_POST['email2']); $mobile = mysqli_real_escape_string($connection, $_POST['mobile2']); $description = mysqli_real_escape_string($connection, $_POST['description2']); // =============== 3. Save to Database =============== $sql = "INSERT INTO send_message (Name, email, mobile, message) VALUES ('$name', '$email', '$mobile', '$description')"; mysqli_query($connection, $sql); // =============== 4. Send Email =============== $to = 'shailendra@idsautomation.in'; $subject = 'Online Enquiry Details From Website'; $message = " <h3>New Online Enquiry</h3> <p><strong>Name:</strong> $name</p> <p><strong>Email:</strong> $email</p> <p><strong>Mobile No:</strong> $mobile</p> <p><strong>Message:</strong> $description</p> "; $header = "From: shailendra@idsautomation.in\r\n"; $header .= "Cc: shailendra@idsautomation.in\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html; charset=UTF-8\r\n"; if (mail($to, $subject, $message, $header)) { header('Location: thank-you.php'); exit(); } else { echo "Message could not be sent."; } } ?>
Ukuran: 2.8 KB