$pagina_login = true;
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (!$disableCaptcha) {
$required_js[] = "https://www.google.com/recaptcha/api.js?render=6Lcj75wUAAAAAIwBGvI9-HkFD6gtKaSXq1Pihx1s";
}
if (!isset($_SESSION["utente"]) &&
(
(isset($_SESSION["id_sessione"]) && md5(session_id()) == $_SESSION["id_sessione"] && isset($_SESSION["ente"]))
||
(isset($_SESSION["id_sessione-admin"]) && sha1(session_id()) == $_SESSION["id_sessione-admin"] && !isset($_SESSION["ente"]))
)
) {
include($root."/layout/topLogin.php");
$form = true;
if (!empty($_POST)) {
if (tokenVerify() && (!empty($_POST["g-recaptcha-response"]) || $disableCaptcha)) {
$score = 0;
if ($disableCaptcha) { $score = 1; }
if (!empty($_POST["g-recaptcha-response"])) { $score = verifyGoogleCaptchaV3($_POST["g-recaptcha-response"]); }
if ((isset($_POST["g-recaptcha-response"]) && $score > 0 || $disableCaptcha) && (!empty($_POST["email"]) && !empty($_POST["password"]))) {
$login = Utente::login($_POST["email"],$_POST["password"],(isset($_POST["force"]))?true:false);
}
}
$soglia_bot = 0.3;
$bot = false;
if (isset($login) && is_a($login,"Utente")) {
if ($score >= $soglia_bot || $login->botVerify == "N") {
$_SESSION["utente"] = $login;
if ($_SESSION["utente"]->gerarchia >= 100) {
session_write_close();
echo '';
die();
} else {
session_write_close();
echo '';
die();
}
} else {
$bot = true;
}
}
if (isset($login) && $login === -1) {
$login_force = true;
} else {
$login_error = true;
$form = false;
$locked = false;
$msg = "";
if ($bot) {
$locked = true;
} else if (!empty($login)) {
$residui = 5 - $login["tentativi"] ;
if ($residui <= 0 || $login["scaduto"]=="S") {
$locked = true;
} else {
if ($residui != 5) {
$msg = "
" . __('Tentativi residui:') . $residui;
}
}
}
}
}
?>
echo __('Utente non riconosciuto'); if(! empty($msg)) { echo $msg; } ?>
= __("Riprova") ?> } ?>