<?php
if (isset($_POST['submit'])) {
    $secret = '6Ld_YSQqAAAAALnnAUnnmIDzTgVKxG3Z-Zhv3Cbs';
    $response = $_POST['g-recaptcha-response'];
    $remoteip = $_SERVER['REMOTE_ADDR'];
    $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip";
    $data = file_get_contents($url);
    $row = json_decode($data, true);

    if ($row['success'] == true) {
        $Name=$_POST['con_name'];
        $Emailid=$_POST['con_email'];
        $Phone=$_POST['con_phone'];
        $Qualification=$_POST['Qualification'];
        $con_message=$_POST['con_message'];
        $to  = 'info@jsfl.in';
        $subject = "JSFL : Career";
        $message= " Name: $Name\n\n
         Emailid : $Emailid\n\n
         Phone : $Phone\n\n
         Qualification : $Qualification\n\n
         Message : $con_message";
        
         
        $from.= "From:$Emailid" .  "\r\n";
        
        $sent = mail($to, $subject, $message, $from) ; 
        if($sent) 
        {
        Header("Location:thanks.html");
        }
        else 
        {print "We encountered an error sending your mail"; }
    } else {
        echo "<script>alert('Oops you are a robot');</script>";
        header("Location: CONTACTS.php");
        exit;
    }
}
?>
