html Google Invisible Captcha

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Google Invisible Captcha相关的知识,希望对你有一定的参考价值。

<?php
require_once('lib/phpMail/class.phpmailer.php');

if (!$_POST) exit;

$adSoyad = $_POST['adSoyad'];
$eposta = $_POST['eposta'];
$mesaj = $_POST['mesaj'];
$response = "";

if (trim($adSoyad) == '') {
    echo $response = 'notOk';
    exit();


} else if (trim($eposta) == '') {
    echo $response = 'notOk';
    exit();


} else if (trim($mesaj) == '') {
    echo $response = 'notOk';
    exit();

} else {
    $body .= "İsim Soyisim: " . $adSoyad . "<br/>";
    $body .= "Eposta Adresi: " . $eposta . "<br/>";
    $body .= "Mesaj: " . $mesaj . "<br/>";
    $body .= "<br/><br/><br/><br/>" . "Bu mail fonasis.com üzerinden gönderilmiştir.";

}

if (get_magic_quotes_gpc()) {

    $body = stripslashes($body);

}

$secret = '6LfRsxkUAAAAAGVrHq26qv7a9QFkEvfvgpTjWhkJ';
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];

$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip");
//hata verirse
$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip", false, stream_context_create($arrContextOptions));
$result = json_decode($url, TRUE);
if ($result['success'] == 1) {

    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug = 0;

    $mail->Host = 'smtp.zoho.com';
    $mail->Port = 465;
    $mail->Username = 'info@fonasis.com';
    $mail->Password = 'sertj6789K';
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';

    $mail->SetFrom('info@fonasis.com', "Fonasis.com");
    $mail->AddReplyTo("info@fonasis.com", "Fonasis.com");
    $mail->CharSet = 'UTF-8';
    $mail->isHTML(true);

    $mail->Subject = 'Fonasis.com İletişim Formu';
    $mail->Body = $body;

    $mail->addBCC("info@fonasis.com");

    if (!$mail->send()) {
        echo $response = 'notOk';

    } else {
        echo $response = 'ok';
    }

} else {
    echo $response = 'notOk';
}
<form id="form_bizeUlasin" action="gonder.php" method="POST">
                                <div class="form-group">
                                    <input type="text" class="form-control" name="adSoyad" placeholder="Ad ve Soyad">
                                </div>
                                <div class="form-group">
                                    <input type="email" class="form-control" name="eposta" placeholder="E-posta Adresi">
                                </div>
                                <div class="form-group">
                                    <textarea cols="30" rows="10" class="form-control" placeholder="Mesaj"
                                              name="mesaj"></textarea>
                                </div>
                                <div class="g-recaptcha"
                                data-sitekey="6LfRsxkUAAAAAN1fV5nZR5mnvItxl6uQwtPM-zZe"
                                data-callback="submit"
                                data-size="invisible">
    </div>
                                <button type="submit" id="btngonder" class="btn btn-primary btn-lg">Gönder</button>
                            </form>

<script src='https://www.google.com/recaptcha/api.js'></script>
<script src="assets/js/jquery.validate.min.js"></script>
<script type="text/javascript">
 var form = $("#form_bizeUlasin");
    $(document).ready(function () {
        appMaster.preLoader();

        form.validate({
            rules: {
                ignore: ".ignore",
                adSoyad: {
                    required: true,
                    minlength: 4
                },
                mesaj: {
                    required: true,
                    minlength: 10
                },
                eposta: {
                    required: true,
                    email: true
                }
            },
            messages: {
                adSoyad: {
                    required: "Lütfen adınızı ve soyadınızı giriniz.",
                    minlength: "En az 4 karakter girmelisiniz."
                },
                eposta: {
                    required: "Lütfen bir eposta adresi giriniz.",
                    email: "Girilen değer eposta değil. Kontrol ediniz."
                },
                mesaj: {
                    required: "Lütfen bir mesaj giriniz.",
                    minlength: "En az 10 karakter girmelisiniz."
                }
            },
            submitHandler: function (form) {
                grecaptcha.execute();
                }
            });



    });

    function submit() {
        $('#btngonder').attr("disabled", true);
                    $.ajax({
                        type: "POST",
                        url: "gonder.php",
                        data: form.serialize(),
                        success: function (response) {
                            if (response == "ok") {
                                $(form).html('<div class="media">' +
                                    '<a class="pull-left" href="#">' +
                                    '<i class="fa fa-check fa-2x"></i>' +
                                    '</a>' +
                                    '<div class="media-body">' +
                                    '<h4 class="media-heading">' +
                                    'E-posta gönderilmiştir. Yakında sizinle irtibata geçilecektir.' +
                                    '</h4>' +
                                    '</div>' +
                                    '</div>');

                            } else if (response == "notOk") {
                                $(form).html('<div class="media">' +
                                    '<a class="pull-left" href="#">' +
                                    '<i class="fa fa-exclamation-triangle fa-2x"></i>' +
                                    '</a>' +
                                    '<div class="media-body">' +
                                    '<h4 class="media-heading">' +
                                    'E-posta gönderilemedi. Lütfen tekrar kontrol ediniz.' +
                                    '</h4>' +
                                    '</div>' +
                                    '</div>');
                            } else {

                            }

                        }
                    });
    }
            

</script>

以上是关于html Google Invisible Captcha的主要内容,如果未能解决你的问题,请参考以下文章

Oracle 11g新特性invisible index(不可见的索引)

Spanner, 真时和CAP理论

android:visibility

Google Recaptcha 启用禁用的提交按钮

MySQL 8.0新特性--invisible index

visible,invisible,gone区别