argh sql syntaxes
This commit is contained in:
parent
565b15c91e
commit
ddf61714f6
1 changed files with 3 additions and 2 deletions
|
@ -374,9 +374,10 @@ class CommentList extends SimpleExtension {
|
||||||
$window = int_escape($config->get_int('comment_window'));
|
$window = int_escape($config->get_int('comment_window'));
|
||||||
$max = int_escape($config->get_int('comment_limit'));
|
$max = int_escape($config->get_int('comment_limit'));
|
||||||
|
|
||||||
|
// window doesn't work as an SQL param because it's inside quotes >_<
|
||||||
$result = $database->get_all("SELECT * FROM comments WHERE owner_ip = :remote_ip ".
|
$result = $database->get_all("SELECT * FROM comments WHERE owner_ip = :remote_ip ".
|
||||||
"AND posted > date_sub(now(), interval :window minute)",
|
"AND posted > now() - interval '$window minute'",
|
||||||
Array("remote_ip"=>$_SERVER['REMOTE_ADDR'], "window"=>$window));
|
Array("remote_ip"=>$_SERVER['REMOTE_ADDR']));
|
||||||
|
|
||||||
return (count($result) >= $max);
|
return (count($result) >= $max);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue