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_page.php
28 28
	header('Location: ../index.php');
29 29
	exit(0);
30 30
}
31
	
31

  
32
require_once(WB_PATH.'/include/captcha/captcha.php');
33
require_once(WB_PATH.'/include/captcha/asp.php');
34

  
32 35
// Get comments page template details from db
33
$query_settings = $database->query("SELECT comments_page,use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
36
$query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
34 37
if($query_settings->numRows() == 0) {
35 38
	header("Location: ".WB_URL.PAGES_DIRECTORY."");
36 39
	exit(0);
37 40
} else {
38 41
	$settings = $query_settings->fetchRow();
42

  
39 43
	// Print comments page
40 44
	echo str_replace('[POST_TITLE]', POST_TITLE, ($settings['comments_page']));
41 45
	?>
42 46
	<form name="comment" action="<?php echo WB_URL.'/modules/news/submit_comment.php?page_id='.PAGE_ID.'&section_id='.SECTION_ID.'&post_id='.POST_ID; ?>" method="post">
47
	<?php if(ENABLED_ASP) { // add some honeypot-fields
48
	?>
49
	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
50
	<p class="nixhier">
51
	email address:
52
	<label for="email">We dont want to know your email-address. Leave this field empty:</label>
53
	<input id="email" name="email" size="60" value="" /><br />
54
	Homepage:
55
	<label for="homepage">Do not enter a homepage-url here, use field comment instead if you want:</label>
56
	<input id="homepage" name="homepage" size="60" value="" /><br />
57
	URL:
58
	<label for="url">Don't write anything in this url field:</label>
59
	<input id="url" name="url" size="60" value="" /><br />
60
	</p>
61
	<?php }
62
	?>
43 63
	<?php echo $TEXT['TITLE']; ?>:
44 64
	<br />
45 65
	<input type="text" name="title" maxlength="255" style="width: 90%;"<?php if(isset($_SESSION['comment_title'])) { echo ' value="'.$_SESSION['comment_title'].'"'; unset($_SESSION['comment_title']); } ?> />
......
55 75
	}
56 76
	// Captcha
57 77
	if($settings['use_captcha']) {
58
	$_SESSION['captcha'] = '';
59
	for($i = 0; $i < 5; $i++) {
60
		$_SESSION['captcha'] .= rand(0,9);
61
	}
62 78
	?>
63 79
	<table cellpadding="2" cellspacing="0" border="0">
64 80
	<tr>
65
	<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
66
	<td><img src="<?php echo WB_URL; ?>/include/captcha.php?t=<?php echo time(); ?>" alt="Captcha" /></td>
67
	<td><input type="text" name="captcha" maxlength="5" /></td>
81
		<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
82
		<td><?php call_captcha(); ?></td>
68 83
	</tr></table>
69 84
	<br />
70 85
	<?php
......
75 90
	<?php
76 91
}
77 92

  
78
?>
93
?>

Also available in: Unified diff