<?
		//$listuser -> checklogin($_SESSION["member"]->uid);
		
		switch($act){
				case "send":
						$type = "send";
						break;
				case "立即举报":
						$type = "sendok";
						break;
				default:
						$type = "send";
						break;
		}
		
		$iserror = 0;
		
		if(!is_numeric($bid) or $bid<1){
				$iserror = 1;
				$url = array();
				$tourl = URL_book_index($url);
				$pagecontent = "<b>提醒：</b><br/>";
				$pagecontent .= "不存在的作品！<br/>";	
		}

		$dirid = intval($bid/1000);
		$cachefilepath = HON6_ROOT."/cache/book/chapter/".$dirid."/".$bid."/".$cid.".cache";
		$txtfilepath = PRO_ROOT."/files/article/txt/".$dirid."/".$bid."/".$cid.".txt";
		
		if(!file_exists($txtfilepath) or !is_numeric($cid) or $cid<1){
				$iserror = 1;
				$url = array("bid"=>$bid);
				$tourl = URL_book_chapter_list($url);
				$pagecontent = "<b>提醒：</b><br/>";
				$pagecontent .= "不存在的章节！<br/>";
		}
		/**获取页面内容，检查是否有缓存**/
		if($iserror == 0){
				if(!file_exists($cachefilepath)){
					
						$chapterdata = $db->query_array("select articlename,chaptername,chapterorder,chaptertype from ".JIEQI_DB_PREFIX."_article_chapter where chapterid=".$cid);
						
				}else{
						
						require_once($cachefilepath);//加载缓存
						$chapterdata = unserialize($data);//加载缓存
						
				}
		}
		
		if($type == "send"){
			
				if($iserror==0){ 
						$smartydate = array("pagetitle" => $chapterdata[0]["chaptername"]."-".$chapterdata[0]["articlename"]. "-报错",
													"chapterdata" => $chapterdata,
													"data" => array("bid"=>$bid,"cid"=>$cid),
													);
									
						$tplpath = "book/error.tpl";
				}else{
						$smartydate = array("pagetitle" => "信息发送报告",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
														);
														
						$tplpath = "public.tpl";
				}
				
		}elseif($type == "sendok"){
			
				$iserror = 0;
				
				/*接受举报信件用户ID*/
				$uid = 2;
				
				/*举报用户ID 姓名*/
				$posterid = isset($_SESSION["member"]->uid) ? $_SESSION["member"]->uid : 0;
				$postername = isset($_SESSION["member"]->name) ? $_SESSION["member"]->name : getip();
				
				if($resonse == ""){
						$iserror = 1;
						$pagecontent = "<b>举报失败！</b><br/>";
						$pagecontent .= "请输入举报原因！<br/>";
						$url = array("bid" => $bid,
												"cid" => $cid,
												);
						$tourl = URL_book_error($url);
				}
				if($iserror==0){
						$db->query("INSERT INTO ".JIEQI_DB_PREFIX."_system_message (siteid,postdate,fromid,fromname,toid,toname,title,content,messagetype,isread,fromdel,todel,enablebbcode,enablehtml,enablesmilies,attachsig,attachment) VALUE(0,'".time()."',".$posterid.",'".$postername."',".$uid.",'".$listuser->getuserdate("name",$uid)."','【举报】《".$chapterdata[0]["chaptername"]."》','章节【".$chapterdata[0]["articlename"]."】原因:".$resonse."',0,0,0,0,1,0,1,0,0)");
						$pagecontent = "发送成功！<br/>";
						$url = array("bid" => $bid,
												"cid" => $cid,
												"page" => "",
												);
						$tourl = URL_book_chapter($url);	
				}
				
				$smartydate = array("pagetitle" => "信息发送报告",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
														);
														
				$tplpath = "public.tpl";
				
		}
?>