Figured I would post this.
Go to google and get your keys https://www.google.com/recaptcha/intro/v3.html
in the default theme (whichever theme you have set as theme id 1) header.php, at the bottom, put
enter your keys below and replace your account-login.php, or pull code from below and add it to your own custom login
Alter this portion of the code to set a light or dark background for the re-captcha to fit your theme
[ATTACH type="full"]5036[/ATTACH]
Go to google and get your keys https://www.google.com/recaptcha/intro/v3.html
in the default theme (whichever theme you have set as theme id 1) header.php, at the bottom, put
<script src="https://www.google.com/recaptcha/api.js" async defer></script>enter your keys below and replace your account-login.php, or pull code from below and add it to your own custom login
<?php
require_once("backend/functions.php");
dbconn();
///Enter google keys below
$siteKey = 'key_here';
$secret = 'secretkey_here';
///end google reCAPTCHA
session_start();
$site_config["LEFTNAV"] = $site_config["MIDDLENAV"] = $site_config["RIGHTNAV"] = false;
///WARNING COMMENTED IF YOU HAVE A FULL PAGE LOGIN. OTHERWISE UNCOMMENT.
//if (!empty($_REQUEST["returnto"])) {
// if (!$_GET["nowarn"]) {
// $nowarn = T_("MEMBERS_ONLY");
// }
//}
// END WARNING COMMENT
if ($_POST["username"] && $_POST["password"]) {
$password = passhash($_POST["password"]);
if (!empty($_POST["username"]) && !empty($_POST["password"])) {
$res = SQL_Query_exec("SELECT id, password, secret, status, enabled FROM users WHERE username = " . sqlesc($_POST["username"]) . "");
$row = mysqli_fetch_assoc($res);
$captcha;
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
$message = '<h2>Please check the the captcha form.</h2>';
header("Refresh: 1; url= account-login.php");
}
$secretKey = "<?php echo $secret;?>";
$ip = $_SERVER['REMOTE_ADDR'];
$response="file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip.")";
if ( ! $row || $row["password"] != $password )
$message = T_("LOGIN_INCORRECT");
elseif ($row["status"] == "pending")
$message = T_("ACCOUNT_PENDING");
elseif ($row["enabled"] == "no")
$message = T_("ACCOUNT_DISABLED");
} else
$message = T_("NO_EMPTY_FIELDS");
if (!$message){
logincookie($row["id"], $row["password"], $row["secret"]);
if (!empty($_POST["returnto"])) {
header("Refresh: 0; url=" . $_POST["returnto"]);
die();
}
else {
header("Refresh: 0; url=index.php");
die();
}
}else{
show_error_msg(T_("ACCESS_DENIED"), $message, 1);
}
}
unset($_POST['g-recaptcha-response']);
logoutcookie();
stdhead(T_("LOGIN"));
if ($nowarn)
show_error_msg(T_("ERROR"), $nowarn, 0);
begin_frame(T_("LOGIN"));
?>
<form method="post" action="account-login.php">
<table border="0" cellpadding="2" align="center">
<tr><td align="center"><b><?php echo T_("USERNAME"); ?>:</b> <input type="text" size="40" name="username" /></td></tr>
<tr><td align="center"><b><?php echo T_("PASSWORD"); ?>:</b> <input type="password" size="40" name="password" /></td></tr>
<tr><td align="center"><div class="g-recaptcha" data-theme="light" data-sitekey="<?php echo $siteKey; ?>"></div></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="<?php echo T_("LOGIN"); ?>" /><br /><br /><i><?php echo T_("COOKIES");?></i></td></tr>
</table>
<?php
if ( ! empty($_REQUEST["returnto"]) )
{
print("<input type=\"hidden\" name=\"returnto\" value=\"" . cleanstr($_REQUEST["returnto"]) . "\" />\n");
}
?>
</form>
<p align="center"><a href="account-signup.php"><?php echo T_("SIGNUP"); ?></a> | <a href="account-recover.php"><?php echo T_("RECOVER_ACCOUNT"); ?></a></p>
<?php
end_frame();
stdfoot();
?>Alter this portion of the code to set a light or dark background for the re-captcha to fit your theme
data-theme="light"
[ATTACH type="full"]5036[/ATTACH]
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
