<?php	

		$iserror = 0;
		
		$listuser -> checklogin($_SESSION["member"]->uid);
	
		if($act == "delet"){
				
				unset($_SESSION["autobookmark"][$id]);
				$iserror = 1;
				$pagecontent = 	"成功删除自动书签！<br/>";
				$tourl = URL_user_autobookmark(array("page"=>"","id"=>"","act"=>"",));
				
		}else{
			
				$pagelistnum = 10;
				
				$totalbookmark = count($_SESSION["autobookmark"]);
				
				$cid = "";
				$i = 1;
				foreach($_SESSION["autobookmark"] as $bid => $cid){
						
						$cids .= $cid["cid"];
						if($i != $totalbookmark)$cids .= ",";
						$i++;
					
				}
				
				$totalpage = ceil($totalbookmark/$pagelistnum);
				
				$page = isset($page)?intval($page):"1";
				$page = ($page>$totalpage)?($totalpage):($page);
				$totalpage = ($totalpage==0)?1:intval($totalpage);
				$page = ($page<1)?(1):($page);
				
				$sqlstart = ($page-1)*$pagelistnum;
				
				if($cid != ""){
						$sql = "SELECT chapterid,articleid,articlename,chaptername,chapterorder,chaptertype FROM ".JIEQI_DB_PREFIX."_article_chapter WHERE chapterid IN (".$cids.") ORDER BY field(chapterid,".$cids.") DESC LIMIT ".$sqlstart.",".$pagelistnum;
						$markdata = $db -> query_array($sql);
				}

				
		}
		
		if($iserror == 0){

						$smartydate = array("pagetitle" => "自动书签",
													"markdata" => $markdata,
													"totalbookmark" => $totalbookmark,
													"page" => $page,
													"totalpage" => $totalpage,
													"pagelistnum" => $pagelistnum,
													"data" => array("act"=>""),
													);
											
						$tplpath = "user/autobookmark.tpl";

		}else{		
				
				$smartydate = array("pagetitle" => "自动书签",
												"pagecontent" => $pagecontent,
												"tourl" => $tourl,
												"redirecturl" => $tourl,
												);
												
				$tplpath = "public.tpl";
				
		}
?>