Ha phpers,
ik heb een beveiliging voor een formuliertje (niet zelf geschreven, maar van iemand anders. Die heeft hem denk ik ergens van internet gehaald).
hiermee roep ik hem aan:
<?php
$spam = trim($_POST['spam']);
include("securimage.php");
$img = new Securimage();
$valid = $img->check($_POST['spam']);
if($valid == false) {
$aFout[] = "De ingevoerde code is onjuist.";
unset($spam);
$fout['text']['spam'] = TRUE;
$fout['input']['spam'] = TRUE;
}
?>
in de construct functie van Securimage() staat niks.
<?php
function check($code)
{
$this->code_entered = $code;
$this->validate();
return $this->correct_code;
}
function validate()
{
if ( isset($_SESSION['securimage_code_value']) && !empty($_SESSION['securimage_code_value']) ) {
if ( $_SESSION['securimage_code_value'] == strtolower(trim($this->code_entered)) ) {
$this->correct_code = true;
$_SESSION['securimage_code_value'] = '';
} else {
$this->correct_code = false;
}
} else {
$this->correct_code = false;
}
}
?>
Nu is het zo dat $valid steevast false teruggeeft, ongeacht de invoer.
Hoe kan dit komen? Heeft iemand ervaring met zulke dingen?
2.468 views