hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
ubuntu
/
bmse.net
/
Upload FileeE
HOME
<?php class BasicMathSecurity { private $name; private $operand1, $operand2; public function BasicMathSecurity( $name = 'math' ) { $this->name = $name; $this->generateNumbers(); } public function generateNumbers() { $this->operand1 = mt_rand( 1, 9 ); $this->operand2 = mt_rand( 1, 9 ); $_SESSION['captcha_result']=$this->operand1 + $this->operand2; } public function getField() { $label = '<label for="t_'.$this->name.'">'.$this->operand1.' + '.$this->operand2.'</label>'; $math = '<span><input placeholder="Enter total sum.." id="t_' . $this->name . '" type="text" name="' . $this->name . '" value="" id="' . $this->name . '"></input></span>'; $string = $label . "\n" . $math; return $string; } public function isCorrect() { $answer = $this->name . '-answer'; if( !isset( $_REQUEST[ $this->name ] ) || !isset( $_REQUEST[ $answer ] ) ) return false; return (int) $_REQUEST[ $this->name ] == (int) $_REQUEST[ $answer ]; } } ?>