51 if ($nb_post_max > 0) {
52 $sql =
"SELECT COUNT(".(!empty(
$object->table_rowid) ?
$object->table_rowid :
'rowid').
") as nb_posts";
53 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element;
54 $sql .=
" WHERE ip = '".$db->escape(
$object->ip).
"'";
55 if (array_key_exists(
'date_creation',
$object->fields)) {
56 $sql .=
" AND date_creation > '".$db->idate($minmonthpost).
"'";
58 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
60 $resql = $db->query($sql);
62 $num = $db->num_rows($resql);
66 $obj = $db->fetch_object($resql);
67 $nb_post_ip = $obj->nb_posts;
70 array_push(
$object->errors, $db->lasterror());
74 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
75 array_push(
$object->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));