data[0]; if(!isset($_POST['submit'])) { $catname = utf8entities($var_id); $catrealname = utf8entities(stripslashes($category['Name'])); echo(""); echo("
Your post was successful! It may take a few seconds to appear.
"); } else { $var_code = ANONNEWS_ERROR_DATABASE_ERROR; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_POST_TOPIC; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_POST_BODY; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_INCORRECT_CAPTCHA; require("module.error.php"); } } } } elseif($var_mode == "reply") { // Post a reply to an existing thread. $recaptcha = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if($recaptcha->is_valid) { $post_id = (is_numeric($var_id)) ? $var_id : 0; $name = (!empty($_POST['name'])) ? mysql_real_escape_string($_POST['name']) : "Anonymous"; $body = mysql_real_escape_string($_POST['body']); if(!empty($body)) { if($result = mysql_query_cached("SELECT * FROM forum_posts WHERE `Id`='{$post_id}'")) { $parent = $result->data[0]; $query = "INSERT INTO forum_posts (`CategoryId`, `ParentId`, `Name`, `Topic`, `Posted`, `Body`, `Replies`, `LastReplyUser`, `LastReplyTime`) VALUES ('{$parent['CategoryId']}', '{$post_id}', '{$name}', '', CURRENT_TIMESTAMP, '{$body}', '0', '', CURRENT_TIMESTAMP)"; if(mysql_query($query)) { $insid = mysql_insert_id(); $topic = mysql_real_escape_string(stripslashes($parent['Topic'])); mysql_query("UPDATE forum_categories SET `Posts`=`Posts`+1 , `LastPostTime`=CURRENT_TIMESTAMP , `LastPostTopic`='{$topic}' WHERE `Id`='{$parent['CategoryId']}'"); mysql_query("UPDATE forum_posts SET `Replies`=`Replies`+1 , `LastReplyUser`='{$name}' , `LastReplyTime`=CURRENT_TIMESTAMP WHERE `Id`='{$post_id}'"); echo("Your post was successful! It may take a few seconds to appear.
"); } else { $var_code = ANONNEWS_ERROR_DATABASE_ERROR; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_NOT_FOUND; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_POST_BODY; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_INCORRECT_CAPTCHA; require("module.error.php"); } } else { $var_code = ANONNEWS_ERROR_NOT_FOUND; require("module.error.php"); } ?>