Hello friends ajj me apko btaunga ki ki parkar ham apni website me kisi be form me google recaptcha verification code(I am not reboot) integrate kar sakte hai easily.
Step1-
https://www.google.com/recaptcha/admin
Url open kijiye
step2- ab aap sabse pehle label me apni website ka url enter kijiye jis website me aap google recaptcha verification add karna chahte ho
step3-ab aap recaptcha v2 par click kijiye
step4-domains me apne website ka name enter kijiye jese label me kiya tha
step5-Accept the reCAPTCHA Terms of Service. Ke samne checkbox ko tik kar lijiye(select)
step6-ab register par click kijiye
step6-ab yanha apko site key and secret key milegi aap in key ko yanha se copy kar lijiye or niche diye gye code me paste kar dijiye.
Html form me sitekey ke samne sitekey paste kijiye.
Google Recaptcha Contact Form-
<center>
<?php
$conn=mysqli_connect("hostname","username","yourpassword","databasename");
$name = '';
$email = '';
$message = '';
if(isset($_POST['submit'])){
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
$secret = '6LfVAUoUAAAAAOG_hahTo6bdDZS1WUPGNAM_2or5';
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
echo 'Your contact request have submitted successfully.';
$sql = "INSERT INTO google(name, email, message)
VALUES ('$name', '$email', '$message')";
mysqli_query($conn, $sql);
}
else{
echo "Robot verification failed, please try again Please Check On Recaptcha Box ";
}
}
?>
<html>
<head>
<title>contect us</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<style>
#registration {
background-color: green;
background-color: lightblue;
height:280px;
width:380px;
}
</style>
</head>
<body>
<div id="registration">
<h2>Contact Form</h2>
<div class="form-info">
<fieldset>
<form action="" method="POST">
Name- <input type="text" class="text" placeholder="Your full name" name="name" required><br>
Email <input type="email" class="text" placeholder="Email adress" name="email"required ><br>
Message <textarea type="text" placeholder="Message..." required="" name="message" required> </textarea><br>
<div class="g-recaptcha" data-sitekey="6LfVAUoUAAAAAMtm0rXfuh_fbuENrqRD0O8pe7Ry"></div><br>
<input type="submit" name="submit" value="SUBMIT">
</form></fieldset>
</div>
</body>
</html>
</center>
Note- userinfomation like id,name,email and message ko database me save karne ke liye database bana lijiye jisme 4 field create kar lijiye.
Is parkar easily aap simple contact form bana sakte ho.me ummid karta hu ki apko ye post achi lagi hogi agar apko koi problem a rhe hai to aap comment me puch sakte ho
Thank You
Team Gajabwap Web In Hindi
2 comments
Click here for commentsbro nice code keep it up kaffi samaye se is code ko dund rahaetha ajjeapki wajah se mil gya thanks
ReplyThanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. anti captcha key
ReplyConversionConversion EmoticonEmoticon