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

		if($act == "save" and $iserror == 0){
				$pz = isset($pz) ? intval($pz) : 1;
				$bg = isset($bg) ? intval($bg) : 0;
				$fz = isset($fz) ? intval($fz) : 16;
				
				$tourl = $backurl;
				
				$_SESSION["set"]["pagesize"] = isset($_SESSION["set"]["pagesize"]) ? intval($_SESSION["set"]["pagesize"]) : 1;
				
				if($_SESSION["set"]["pagesize"] != $pz){
						$urlarray = parse_url($tourl);
						$tourl = $urlarray["path"]."?".urldecode(url_set_value($urlarray["query"],"page","1"));
				}
				$urlarray = parse_url($tourl);
				$tourl = $urlarray["path"]."?".urldecode(url_set_value($urlarray["query"],"sid",$_SESSION["member"]->sid));
				
				$bgcolor = array("默认","夜间","茶绿","淡粉");
				
				$_SESSION["set"]["pagesize"] = $pz;
				$_SESSION["set"]["bgcolor"] = $bg;
				$_SESSION["set"]["fontsize"] = $fz;
				
				$iserror = 2;
				$pagecontent = "<p>设置成功</p>";
				$pagecontent .= "<p>1.阅读字数设为".$_SESSION["set"]["pagesize"]."000字每页</p>";
				$pagecontent .= "<p>2.背景颜色设为".$bgcolor[$_SESSION["set"]["bgcolor"]]."</p>";
				$pagecontent .= "<p>3.字体大小设为".$_SESSION["set"]["fontsize"]."号</p>";	
				
				if($_SESSION["member"]->uid){
						$sql="update hon6_sid set setdata = '".serialize($_SESSION["set"])."' where uid = ".$_SESSION["member"]->uid;
						$db->query($sql);
				}
								
		}else{
				$urlarray = parse_url($backurl);
				$backurl = $urlarray["path"]."?".urldecode(url_set_value($urlarray["query"],"sid",$_SESSION["member"]->sid));	
		}
		
		if($iserror == 0){
				$smartydate = array("pagetitle" => "字数设置",
														"backurl" => $backurl,
													);
				$tplpath = "user/readset.tpl";
		}else{
				$smartydate = array("pagetitle" => "阅读设置-提醒",
													"pagecontent" => $pagecontent,
													"torul" => $tourl,
													"redirecturl" => $tourl,
													);
				$tplpath = "public.tpl";
		}
?>