[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 36/73: improve captcha, replace the global va
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 36/73: improve captcha, replace the global variable by a "DEFINE" constant |
Date: |
Fri, 28 May 2021 05:26:32 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 5b30467fad80dae476319899c9dc10409e35a71c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Apr 24 10:49:28 2021 +0200
improve captcha, replace the global variable by a "DEFINE" constant
---
html/index.php | 9 +++++----
html/js/scripts.js | 2 ++
html/login.php | 2 +-
include/constant.php | 7 +++++--
include/lib/config_file.php | 2 ++
include/verif_bilan.inc.php | 2 +-
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/html/index.php b/html/index.php
index 09521f8..3547a4c 100644
--- a/html/index.php
+++ b/html/index.php
@@ -150,6 +150,7 @@ echo '<!doctype html><HTML>
<link rel="stylesheet" type="text/css" href="css/bootstrap-grid.min.css"
media="screen">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"
media="screen">
<link rel="stylesheet" type="text/css" href="css/index.css" media="screen">
+<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scripts.js" type="text/javascript"></script>
</head>
<BODY>';
@@ -235,19 +236,19 @@ if
(isset($_REQUEST['reconnect'])&&isset($_REQUEST['backurl']))
<?php
// if captcha is used
- if ($g_captcha==true) :
+ if (defined('NOALYSS_CAPTCHA') && NOALYSS_CAPTCHA==true) :
?>
Indiquer le code que vous lisez dans l'image
- <img id="captcha" src="securimage/securimage_show.php"
alt="CAPTCHA Image" border=1/>';
+ <img id="captcha" src="securimage/securimage_show.php"
alt="CAPTCHA Image" border=1/>
<input type="text" class="input_text" name="captcha_code"
size="10" maxlength="6" autocomplete="off"/>
- <a href="#"
onclick="document.getElementById('captcha').src =
'securimage/securimage_show.php?\' + Math.random(); return false">Reload
Image</a>
+ <a href="#"
onclick="document.getElementById('captcha').src =
'securimage/securimage_show.php?' + Math.random(); return false">Reload
Image</a>
<?php
endif;
?>
<div class="form-group row justify-content-center">
- <INPUT TYPE="SUBMIT" class="button"
style="background-image: url('image/bg-submit2.gif'); width: 100%; height:
42px; border-radius: 11px; color: white;" NAME="login" value="se connecter">
+ <INPUT TYPE="SUBMIT" class="button" style="width:91%"
NAME="login" value="se connecter">
</div>
</form>
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 401ce3e..60d67fd 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -27,6 +27,8 @@ var ask_reload = 0;
// tag_choose Element which contains all the selected tags
var tag_choose = '';
var aDraggableElement = new Array();
+
+// document.viewport depends of prototype.js
var viewport = document.viewport.getDimensions(); // Gets the viewport as an
object literal
var width = viewport.width; // Usable window width
var height = viewport.height;
diff --git a/html/login.php b/html/login.php
index 7131420..3e4ab0b 100644
--- a/html/login.php
+++ b/html/login.php
@@ -60,7 +60,7 @@ if ( isset ($_POST["p_user"] ) )
require_once NOALYSS_INCLUDE."/class/user.class.php";
$User=new User($rep);
$User->Check(false,'LOGIN');
- if ($g_captcha == true)
+ if (defined('NOALYSS_CAPTCHA') && NOALYSS_CAPTCHA==true)
{
include("securimage/securimage.php");
$img = new Securimage();
diff --git a/include/constant.php b/include/constant.php
index 58197ae..c1189ac 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -79,9 +79,12 @@ if ( ! defined('OVERRIDE_PARAM')) {
* Ini session
*/
+if (! defined('NOALYSS_CAPTCHA') )
+{
+ define ("NOALYSS_CAPTCHA",false);
+}
-global $g_captcha,$g_failed,$g_succeed;
-$g_captcha=false;
+global $g_failed,$g_succeed;
$g_failed="<span style=\"font-size:18px;color:red\">✖</span>";
$g_succeed="<span style=\"font-size:18px;color:green\">✓</span>";
define ('SMALLX','#xe816;');
diff --git a/include/lib/config_file.php b/include/lib/config_file.php
index b780658..8a94e53 100644
--- a/include/lib/config_file.php
+++ b/include/lib/config_file.php
@@ -252,6 +252,8 @@ function display_file_config($p_array,$from_setup=1,$p_os=1)
print ("// for exporting document in PDF\r\n");
print ("// \$pdftk = /usr/bin/pdftk \r\n");
print ("// \$pdftk = /snap/bin/pdftk \r\n");
+ print ("// uncomment to activate the captcha on login page\r\n");
+ print ("// define('NOALYSS_CAPTCHA',true);\r\n");
}
/*!\brief create the config file
diff --git a/include/verif_bilan.inc.php b/include/verif_bilan.inc.php
index 0dff014..622eebd 100644
--- a/include/verif_bilan.inc.php
+++ b/include/verif_bilan.inc.php
@@ -27,7 +27,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas
permis');
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_bilan.class.php';
-global $g_captcha,$g_failed,$g_succeed;
+global $g_failed,$g_succeed;
$cn=Dossier::connect();
$exercice=$g_user->get_exercice();
echo '<div class="content">';
- [Noalyss-commit] [noalyss] 27/73: Javascript : waiting box display when exporting in PDF or CSV, (continued)
- [Noalyss-commit] [noalyss] 27/73: Javascript : waiting box display when exporting in PDF or CSV, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 37/73: Cosmetic improve smoke dg box, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 39/73: Bug #0001971: erreur calcul dans champ prix/unité htva, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 06/73: Cosmetic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 08/73: Warning if PHPVERSION < 7.2, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 10/73: Cosmetic : update fontello, button inplace_edit, doc, logo and dashboad, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 16/73: Currency : add a check , upgrade version of DB, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 24/73: Bug Select_Box = problem with DIV id, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 29/73: Cosmetic : display properly currency in detail operation, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 34/73: javascript : test and improve cosmetic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 36/73: improve captcha, replace the global variable by a "DEFINE" constant,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 41/73: Cosmetic : Card History, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 47/73: Fix block problem with font, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 49/73: Improve function display_row_custom for the custom sort key see Sorttable.js, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 50/73: Improve Manage_Table_SQL, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 55/73: Manage_Table_SQL : typo, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 56/73: Output_HTML adapt to bootstrap navbar, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 57/73: Task #1807: Boutons indistincts – thème 7 classic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 44/73: Cosmetic : width to large if recover passwd enable and icon trash not available for document (in operation detail), Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 28/73: Task #0001961: Devise : faciliter les calculs d'écarts de conversion, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 38/73: Task #1961 : Currency remove default currency, Dany De Bontridder, 2021/05/28