Project

General

Profile

« Previous | Next » 

Revision 639

Added by thorn almost 17 years ago

Security bugfix: Text file for text-captcha was readable from everywhere. Text-captcha: empty line in test file, following a question, was accepted as answer. Fixed.

View differences:

text.php
28 28

  
29 29
global $admin;
30 30
$name = 'text';
31
$file = WB_PATH."/temp/.captcha_$name.txt";
31
$file = WB_PATH."/temp/.captcha_$name.php";
32 32

  
33 33
srand((double)microtime()*100000);
34 34
$_SESSION['captcha'] = rand(0,99999);
......
61 61
	$s=next($content);
62 62
	$s=trim(rtrim(rtrim($s,"\n"),"\r")); // remove newline
63 63
	$s=$admin->strip_slashes($s);
64
	if(isset($s{0}) && $s{0}!='!') continue;
65
	$a=substr($s,1);
66
	$qa[$lang][$q]=$a;
67
	next($content);
64
	if(isset($s{0}) && $s{0}=='!') {
65
		$a=substr($s,1);
66
		$qa[$lang][$q]=$a;
67
		next($content);
68
	}
68 69
}
69 70
if($qa == array()) {
70 71
	echo '<b>Error</b>: no text defined! Enter <b>0</b> to solve this captcha';

Also available in: Unified diff