<?
		$iserror = 0;
		
		$listuser -> checklogin($_SESSION["member"]->uid);

		$topicid = isset($topicid)?intval($topicid):0;
		
		$gettopic = $db->query_object("select ownerid,islock from ".JIEQI_DB_PREFIX."_article_reviews where topicid = ".$topicid);
		
		if(!$gettopic){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>回复失败：</b><br/>";
				$pagecontent .= "该主题不存在或已被删除！<br/>";
		}
		if($gettopic->islock == 1 and $iserror == 0){
				$iserror = 1;
				$url = array("topicid"=>$topicid,"page"=>"");
				$tourl = URL_book_reviews_topic($url);
				$pagecontent = "<b>回复失败：</b><br/>";
				$pagecontent .= "抱歉，该帖已被管理员锁定，不允许回复！<br/>";
		
		}
		if((mb_strlen($content,"utf-8")<5 or mb_strlen($content,"utf-8")>60) and $iserror == 0){
				$iserror = 1;
				$url = array("topicid"=>$topicid,"page"=>"");
				$tourl = URL_book_reviews_topic($url);
				$pagecontent = "<b>回复失败：</b><br/>";
				$pagecontent .= "回复字数请控制在5-60字范围内！<br/>";
		
		}
		if($iserror == 0){
				$db->query("INSERT INTO ".JIEQI_DB_PREFIX."_article_replies (siteid,topicid,istopic,replypid,ownerid,posterid,poster,posttime,posterip,editorid,edittime,iconid,attachment,subject,posttext) VALUE(0,$topicid,0,0,$gettopic->ownerid,".$_SESSION["member"]->uid.",'".$_SESSION["member"]->name."','".time()."','".$listuser -> getip()."',0,'".time()."',0,'','','".$content."')");//添加新纪录

				$db->query("UPDATE ".JIEQI_DB_PREFIX."_article_reviews SET replies=replies+1 where topicid = ".$topicid);//回帖成功增加积分
				
				$db->query("UPDATE ".JIEQI_DB_PREFIX."_system_users SET experience=experience+".$jieqiConfigs['forum']['scorereply'].",score=score+".$jieqiConfigs['forum']['scorereply']." WHERE uid=".$_SESSION["member"]->uid);//回帖成功增加积分
				
				$_SESSION["member"]->score	= $_SESSION["member"]->score	+ $jieqiConfigs['forum']['scorereply'];//增加用户积分
				$_SESSION["member"]->experience	= $_SESSION["member"]->experience	+ $jieqiConfigs['forum']['scorereply'];//增加用户积分
				
				$url = array("topicid"=>$topicid,"page"=>"");
				$tourl = URL_book_reviews_topic($url);
				$pagecontent = "<b>回复成功：</b><br/>";
				$pagecontent .= "您的评论发布成功！您的积分+".$jieqiConfigs['forum']['scorereply']."分<br/>";
				
		}
		$smartydate = array("pagetitle" => "回复帖子",
												"pagecontent" => $pagecontent,
												"tourl" => $tourl,
												"redirecturl" => $tourl,
												);
														
		$tplpath = "public.tpl";
?>