Created
March 14, 2019 07:22
-
-
Save uurtech/a5a54967aefed93e6e93b2f9b60a4a07 to your computer and use it in GitHub Desktop.
simple as f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$recaptcha = $_POST['g-recaptcha-response']; | |
if (!empty($recaptcha)) | |
{ | |
$google_url = "https://www.google.com/recaptcha/api/siteverify"; | |
$secret = 'YOUR_SECRET'; | |
$ip = $_SERVER['REMOTE_ADDR']; | |
$url = $google_url . "?secret=" . $secret . "&response=" . $recaptcha . "&remoteip=" . $ip; | |
$res = curlgetter($url); | |
$res = json_decode($res, true); | |
if($res['success']){ | |
$msg = $_POST["name"] ." " . $_POST["email"] . " " . $_POST["msg_subject"] . " " . $_POST['message']; | |
if(!mail("to@mail.com","$subject",$msg)){ | |
error_log("E-posta Gönderiminde hata, şu mesaj gönderilemedi : " . $msg, 3, "/var/log/wawlabs.log"); | |
} | |
} | |
} | |
//not valid | |
function curlgetter($url) { | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 10); | |
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"); | |
$curlData = curl_exec($curl); | |
curl_close($curl); | |
return $curlData; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment