Browse Source

Remove duplicate block for captcha to work on dev

pull/40/head
towards-a-new-leftypol 3 years ago
parent
commit
b64086ff26
  1. 2
      inc/captchaconfig.php
  2. 21
      post.php

2
inc/captchaconfig.php

@ -59,7 +59,7 @@ return array(
'session_name' => null, 'session_name' => null,
// change to true to store codes in a database // change to true to store codes in a database
'use_database' => false, 'use_database' => true,
// database engine to use for storing codes. must have the PDO extension loaded // database engine to use for storing codes. must have the PDO extension loaded
// Values choices are: // Values choices are:

21
post.php

@ -474,35 +474,22 @@ function handle_post(){
} }
} }
if(isset($config['securimage']) && $config['secureimage']){
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(isset($config['securimage']) && $config['securimage']){ if(isset($config['securimage']) && $config['securimage']){
if(!isset($_POST['captcha'])){ if(!isset($_POST['captcha'])){
error($config['error']['securimage']['missing']); error($config['error']['securimage']['missing']);
} }
if(empty($_POST['captcha'])){ if(empty($_POST['captcha'])){
error($config['error']['securimage']['empty']); error($config['error']['securimage']['empty']);
} }
$query=prepare('DELETE FROM captchas WHERE time<DATE_SUB(NOW(), INTERVAL 30 MINUTE)'); $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=prepare('DELETE FROM captchas WHERE ip=:ip AND code=:code LIMIT 1');
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':code', $_POST['captcha']); $query->bindValue(':code', $_POST['captcha']);
$query->execute(); $query->execute();
if($query->rowCount()==0){ if($query->rowCount()==0){
error($config['error']['securimage']['bad']); error($config['error']['securimage']['bad']);
} }

Loading…
Cancel
Save