Для проекта я реализовал Google Recaptcha V2 (с выбором изображения). Я могу использовать Google Recaptcha в любом другом браузере, кроме мобильного браузера UC.
пример кода (html):
<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
<style>.g-recaptcha {transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;}</style>
</script>
<head>
<form action="contact-email.php" method="post">
<div class="row">
<div class="form-group col-lg-6 col-md-6 col-sm-6 padysclass">
<label>First Name*</label>
<input type="text" class="form-control" id="fname" name="fname"
data-validation="required" required="">
</div>
<div class="form-group col-lg-6 col-md-6 col-sm-6 padnoclass" style="">
<label>Last Name*</label>
<input type="text" class="form-control" id="lname" name="lname"
data-validation="required" required="">
</div>
</div>
<div class="row">
<div class="form-group col-lg-6 col-md-6 col-sm-6 padysclass">
<label>Phone*</label>
<input type="text" class="form-control" id="connumber" name="connumber"
data-validation="length" data-validation-length="6-15" required=""
data-validation-error-msg="Please provide a valid number">
</div>
<div class="form-group col-lg-6 col-md-6 col-sm-6 padnoclass">
<label>Email*</label>
<input type="email" class="form-control" id="email" name="email"
data-validation="email" required=""
data-validation-error-msg="You have not given valid email-id">
</div>
</div>
<div class="row">
<div class="form-group">
<label>Subject :</label>
<input type="text" class="form-control" id="subject" name="subject">
</div>
<div class="form-group">
<label>Message :</label>
<textarea class="form-control" id="comment" name="comment"></textarea>
</div>
<div class="g-recaptcha"
data-sitekey="SITEKEY"></div>
<div class="form-group">
<button type="submit" class="btn active btn-sm subbutn">Submit</button>
<button type="reset" class="btn btn-sm subbutn">Reset</button>
</div>
</div>
</form>
контакт-email.php ()
<?php
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$connumber = $_POST["connumber"];
$email = $_POST["email"];
$form_subject = $_POST["subject"];
$comment = $_POST["comment"];
if(isset($_SERVER['HTTP_REFERER'])) {
$current_url=$_SERVER['HTTP_REFERER'];
}
if(isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
$captcha = "";
$captcha=$_POST["g-recaptcha-response"];
if ($captcha == "") {
$current_url_data=$current_url.'?r';
header('Location:'.$current_url_data);
exit();
}
$secretKey = "SECRET_KEY";
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
$current_url_data=$current_url.'?r';
header('Location:'.$current_url_data);
exit();
}
$msg = "First Name : " . $fname . "<br>Last Name : " . $lname . "<br>Phone : " . $connumber . "<br>Email : " . $email ."<br>Form Subject : " . $form_subject . "<br>Message : " . $comment;
$to = "sampleemail1@email.com";
$subject = "Contact Enquiry From ATEES.SG";
$headers = "From: " . $email . "\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "Return-Path: " . $email . "\r\n";
$headers .= "CC: sampleemail2@email.com\r\n";
$headers .= "CC: sampleemail3@email.com \r\n";
$headers .= "Content-type: text/html\r\n";
$email_val = mail("$to", "$subject", "$msg", "$headers");
if ($email_val)
{ $current_url_data=$current_url.'?s';
header('Location:'.$current_url_data);
}
else
{
$current_url_data=$current_url.'?f';
header('Location:'.$current_url_data);
}
?>
HTML-код для формы, которая содержит recaptcha. PHP-код предназначен для обработки данных формы и отправки электронных писем.
Можно ли выполнить этот запуск в браузере UC?
Как я могу решить это?
Спасибо.