DOS protection is per week instead of month

This commit is contained in:
Laurent Destailleur 2024-09-28 11:19:54 +02:00
parent 84183adaaa
commit 434787a63a

View file

@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
/**
* Check if the object exceeded the number of posts for a specific ip
* @param object $object Object to check
* @param int $nb_post_max Number max of posts
* Check if the object exceeded the number of posts for a specific ip in the same week
*
* @return int return <0 if error, >0 if OK
* @param object $object Object to check
* @param int $nb_post_max Number max of posts
* @return int Return <0 if error, >0 if OK
*/
function checkNbPostsForASpeceificIp($object, $nb_post_max)
{
@ -42,7 +42,7 @@ function checkNbPostsForASpeceificIp($object, $nb_post_max)
$nb_post_ip = 0;
$now = dol_now();
$minmonthpost = dol_time_plus_duree($now, -1, "m");
$minmonthpost = dol_time_plus_duree($now, -1, "w");
if (empty($object->ip)) {
$object->ip = getUserRemoteIP();