Project

General

Profile

« Previous | Next » 

Revision 375

Added by Matthias almost 18 years ago

Fixed Captcha didn't work in news comments (#337)

View differences:

trunk/wb/modules/news/comment.php
42 42
require_once(WB_PATH.'/framework/class.database.php');
43 43
$database = new database();
44 44

  
45
$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
46
$use_captcha=$query_settings['use_captcha'];
47
if($use_captcha) {
48
	$_SESSION['captcha'] = '';
49
	for($i = 0; $i < 5; $i++) {
50
		$_SESSION['captcha'] .= rand(0,9);
51
	}
52
}
53

  
45 54
// Query post for page id
46 55
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
47 56
if($query_post->numRows() == 0) {
trunk/wb/modules/news/submit_comment.php
33 33
if(is_numeric($_GET['page_id']) AND is_numeric($_GET['section_id']) AND isset($_GET['post_id']) AND is_numeric($_GET['post_id']) AND isset($_POST['comment']) AND $_POST['comment'] != '') {
34 34
	
35 35
	// Check captcha
36
	$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
36
	$query_settings = $database->query("SELECT use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".$_GET['section_id']."'");
37 37
	if($query_settings->numRows() == 0) { 
38 38
		exit(header('Location: '.WB_URL.'/pages/'));
39 39
	} else {
......
75 75
	$page = $query_page->fetchRow();
76 76
	header('Location: '.$wb->page_link($page['link']).'?id='.$post_id);
77 77
} else {
78
	header('Location: '.WB_URL.'/pages/');
78
	header('Location: '.WB_URL.'/modules/news/comment.php?id='.$_GET['post_id']);
79 79
}
80 80

  
81 81
?>

Also available in: Unified diff