forked from leftypol/leftypol
Add basic captcha
This commit is contained in:
parent
661837a4b1
commit
11bab0a9ad
8 changed files with 3935 additions and 0 deletions
16
post.php
16
post.php
|
@ -491,6 +491,22 @@ function handle_post(){
|
|||
}
|
||||
}
|
||||
|
||||
if(isset($config['securimage']) && $config['securimage']){
|
||||
if(!isset($_POST['captcha'])){
|
||||
error($config['error']['securimage']['missing']);
|
||||
}
|
||||
if(empty($_POST['captcha'])){
|
||||
error($config['error']['securimage']['empty']);
|
||||
}
|
||||
$query=prepare('DELETE FROM captchas WHERE time<DATE_SUB(NOW(), INTERVAL 30 MINUTE)');
|
||||
$query=prepare('DELETE FROM captchas WHERE ip=:ip AND code=:code LIMIT 1');
|
||||
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
|
||||
$query->bindValue(':code', $_POST['captcha']);
|
||||
$query->execute();
|
||||
if($query->rowCount()==0){
|
||||
error($config['error']['securimage']['bad']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(($post['op'] && $_POST['post'] == $config['button_newtopic']) ||
|
||||
(!$post['op'] && $_POST['post'] == $config['button_reply']))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue