Revision 250
Added by ryan almost 20 years ago
| submit_comment.php | ||
|---|---|---|
| 26 | 26 |
// Include config file |
| 27 | 27 |
require('../../config.php');
|
| 28 | 28 |
|
| 29 |
require_once(WB_PATH.'/framework/class.wb.php'); |
|
| 30 |
$wb = new wb; |
|
| 31 |
|
|
| 29 | 32 |
// Check if we should show the form or add a comment |
| 30 | 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'] != '') {
|
| 31 | 34 |
|
| 35 |
// Check captcha |
|
| 36 |
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
|
|
| 37 |
if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
|
|
| 38 |
// Check for a mismatch |
|
| 39 |
if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
|
|
| 40 |
$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA']; |
|
| 41 |
$_SESSION['comment_title'] = $_POST['title']; |
|
| 42 |
$_SESSION['comment_body'] = $_POST['comment']; |
|
| 43 |
exit(header('Location: '.WB_URL.'/modules/news/comment.php?id='.$_GET['post_id']));
|
|
| 44 |
} |
|
| 45 |
} else {
|
|
| 46 |
$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA']; |
|
| 47 |
$_SESSION['comment_title'] = $_POST['title']; |
|
| 48 |
$_SESSION['comment_body'] = $_POST['comment']; |
|
| 49 |
exit(header('Location: '.WB_URL.'/modules/news/comment.php?id='.$_GET['post_id']));
|
|
| 50 |
} |
|
| 51 |
} |
|
| 52 |
if(isset($_SESSION['catpcha'])) { unset($_SESSION['captcha']); }
|
|
| 53 |
|
|
| 32 | 54 |
// Insert the comment into db |
| 33 | 55 |
$page_id = $_GET['page_id']; |
| 34 | 56 |
$section_id = $_GET['section_id']; |
Also available in: Unified diff
Added Captcha to News module