Project

General

Profile

« Previous | Next » 

Revision 596

Added by thorn almost 17 years ago

added new CAPTCHA and ASP (Advanced Spam Protection)

View differences:

comment.php
34 34
$post_id = $_GET['id'];
35 35
$section_id = $_GET['sid'];
36 36

  
37

  
38
// Include database class
39
require_once(WB_PATH.'/framework/class.database.php');
40
$database = new database();
41

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

  
51 37
// Query post for page id
52 38
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
53 39
if($query_post->numRows() == 0) {
......
76 62
		exit(0);
77 63
	}
78 64

  
65
	// don't allow commenting if ASP enabled and user doesn't comes from view.php
66
	if(ENABLED_ASP && !isset($_SESSION['comes_from_view'])) {
67
		header("Location: ".WB_URL.PAGES_DIRECTORY."");
68
		exit(0);
69
	}
70

  
79 71
	// Get page details
80 72
	$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
81 73
	if($query_page->numRows() == 0) {

Also available in: Unified diff