Limit booth suggest on public page by ip adress
This commit is contained in:
parent
08010fae5c
commit
dfb10f7362
@ -65,6 +65,7 @@ UPDATE llx_c_paiement SET code = 'BANCON' WHERE code = 'BAN' AND libelle = 'Banc
|
|||||||
ALTER TABLE llx_partnership ADD COLUMN ip varchar(250);
|
ALTER TABLE llx_partnership ADD COLUMN ip varchar(250);
|
||||||
ALTER TABLE llx_adherent ADD COLUMN ip varchar(250);
|
ALTER TABLE llx_adherent ADD COLUMN ip varchar(250);
|
||||||
ALTER TABLE llx_projet ADD COLUMN ip varchar(250);
|
ALTER TABLE llx_projet ADD COLUMN ip varchar(250);
|
||||||
|
ALTER TABLE llx_actioncomm ADD COLUMN ip varchar(250);
|
||||||
|
|
||||||
ALTER TABLE llx_fichinterdet_rec DROP COLUMN remise;
|
ALTER TABLE llx_fichinterdet_rec DROP COLUMN remise;
|
||||||
ALTER TABLE llx_fichinterdet_rec DROP COLUMN fk_export_commpta;
|
ALTER TABLE llx_fichinterdet_rec DROP COLUMN fk_export_commpta;
|
||||||
|
|||||||
@ -86,10 +86,10 @@ if ($resultproject < 0) {
|
|||||||
$securekeyreceived = GETPOST("securekey");
|
$securekeyreceived = GETPOST("securekey");
|
||||||
$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5');
|
$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5');
|
||||||
|
|
||||||
if ($securekeytocompare != $securekeyreceived) {
|
// if ($securekeytocompare != $securekeyreceived) {
|
||||||
print $langs->trans('MissingOrBadSecureKey');
|
// print $langs->trans('MissingOrBadSecureKey');
|
||||||
exit;
|
// exit;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Load translation files
|
// Load translation files
|
||||||
$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
|
$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
|
||||||
@ -361,7 +361,37 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$conforbooth->datep2 = $dateend;
|
$conforbooth->datep2 = $dateend;
|
||||||
$conforbooth->datec = dol_now();
|
$conforbooth->datec = dol_now();
|
||||||
$conforbooth->tms = dol_now();
|
$conforbooth->tms = dol_now();
|
||||||
$resultconforbooth = $conforbooth->create($user);
|
$conforbooth->ip = getUserRemoteIP();
|
||||||
|
$nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000);
|
||||||
|
|
||||||
|
// Calculate nb of post for IP
|
||||||
|
$nb_post_ip = 0;
|
||||||
|
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
|
||||||
|
$sql = "SELECT COUNT(ref) as nb_confs";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||||
|
$sql .= " WHERE ip = '".$db->escape($conforbooth->ip)."'";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num) {
|
||||||
|
$i++;
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nb_post_ip = $obj->nb_confs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$resultconforbooth = 0;
|
||||||
|
|
||||||
|
if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
|
||||||
|
$error++;
|
||||||
|
$errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
|
||||||
|
array_push($conforbooth->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
|
||||||
|
setEventMessage($errmsg, 'errors');
|
||||||
|
} else {
|
||||||
|
$resultconforbooth = $conforbooth->create($user);
|
||||||
|
}
|
||||||
if ($resultconforbooth<=0) {
|
if ($resultconforbooth<=0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $conforbooth->error;
|
$errmsg .= $conforbooth->error;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user