TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kishan Kumar
NA
127
27.2k
How to add recapcha in our website.
Feb 19 2018 12:59 AM
<html>
<head>
<title>reCAPTCHA </title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<form action="captcha.php" method="POST">
<input type="email" name="email"/>
<div class="g-recaptcha" data-sitekey="6LcSH0QUAAAAAG_R_YNgzXIhKfI_WsiGYc5kYyea"></div>
<br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
</html>
<?php
$email;$comment;$captcha;
if(isset($_POST['email'])){
$email=$_POST['email'];
}if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=YOUR SECRET KEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false)
{
echo '<h2>You are spammer ! Get the @$%K out</h2>';
}else
{
echo '<h2>Thanks for posting comment.</h2>';
}
?>
Some errors....
i will attach the file Please resolve now...
Thanks
(Kishan).
Attachment:
Recpatcha.zip
Reply
Answers (
1
)
passing date value to another php page
How to set up radio button validation in php.