Project

General

Profile

« Previous | Next » 

Revision 640

Added by thorn almost 17 years ago

Text-captcha: moved text-file to database.

View differences:

tool.php
52 52
	");
53 53

  
54 54
	// save text-captchas
55
	if($_POST['captcha_type'] == 'text') {
55
	if($_POST['captcha_type'] == 'text') { // ct_text
56 56
		$text_qa=$_POST['text_qa'];
57 57
		if(strpos($text_qa, '### example ###') === FALSE) {
58 58
			$text_qa=$admin->add_slashes($text_qa);
59
			$text_qa="<?php die(header('Location: ../index.php')); ?>\n".$text_qa;
60
			if($fh = fopen(WB_PATH.'/temp/.captcha_text.php', 'wb')) {
61
				fwrite($fh, $text_qa);
62
				fclose($fh);
63
			}
59
			$database->query("UPDATE $table SET ct_text = '$text_qa'");
64 60
		}
65 61
	}
66 62
	
......
78 74

  
79 75
	// load text-captchas
80 76
	$text_qa='';
81
	if(file_exists(WB_PATH.'/include/captcha/captchas/text.php')) {
82
		if(file_exists(WB_PATH.'/temp/.captcha_text.php')) {
83
			@$content = file(WB_PATH.'/temp/.captcha_text.php');
84
			if($content!==FALSE) {
85
				$content[0]='';
86
				$text_qa = $admin->strip_slashes(implode('', $content));
87
			}
88
		}
77
	if($query = $database->query("SELECT ct_text FROM $table")) {
78
		$data = $query->fetchRow();
79
		$text_qa = $admin->strip_slashes($data['ct_text']);
89 80
	}
90 81
	if($text_qa == '')
91 82
		$text_qa = $MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'];
......
199 190
<?php
200 191
}
201 192

  
202
?>
193
?>

Also available in: Unified diff