<?
		$iserror = 0;
		
		if($act == "addok"){
			
				if($iserror == 0){
						$sql = "SELECT * FROM user_daka_config WHERE days = '".$days."'";
						if($db->query_num($sql)){
								$iserror = 1;
								$url = array("id"=>"","act"=>"add");
								$tourl = URL_admin_daymark($url);
								$pagecontent = "天数重复，该天已有设置！<br/>";
						}
				}
				
				if($iserror == 0 && $score <= 0){
						$iserror = 1;
						$url = array("id"=>"","act"=>"add");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "奖励不能小于0啊！亲！<br/>";
				}
				
				if($iserror == 0){
						$sql = "INSERT INTO user_daka_config(days,score,words)VALUES({$days},{$score},'{$words}')";
						$db->query($sql);
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "添加成功！<br/>";
				}
			
			
		}elseif($act == "edit"){
			
				$sql = "SELECT * FROM user_daka_config WHERE id = $id";
				$dakadata = $db->query_object($sql);	
				
				if(!$dakadata){
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "不存在要修改的天数！<br/>";
				}
				
		}elseif($act == "editok"){
			
				$sql = "SELECT * FROM user_daka_config WHERE id = $id";
				$dakadata = $db->query_object($sql);	
				
				if(!$dakadata){
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "不存在要修改的天数！<br/>";
				}
				
				if($iserror == 0){
						$sql = "SELECT * FROM user_daka_config WHERE days = '".$days."' AND id != $id";
						if($db->query_num($sql)){
								$iserror = 1;
								$url = array("id"=>$id,"act"=>"edit");
								$tourl = URL_admin_daymark($url);
								$pagecontent = "天数重复，该天已有设置！<br/>";
						}
				}
				
				if($iserror == 0 && $score <= 0){
						$iserror = 1;
						$url = array("id"=>$id,"act"=>"edit");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "奖励不能小于0啊！亲！<br/>";
				}
				
				if($iserror == 0){
						$sql = "UPDATE user_daka_config SET days=$days,score=$score,words='$words' WHERE id = $id";
						$db->query($sql);
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "修改成功！<br/>";
				}
				
		}elseif($act == "deletok"){
			
				$sql = "SELECT * FROM user_daka_config WHERE id = $id";
				$dakadata = $db->query_object($sql);	
				
				if(!$dakadata){
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "不存在要删除的天数！<br/>";
				}
				
				if($iserror == 0){
						$sql = "DELETE FROM user_daka_config WHERE id = $id";
						$db->query($sql);
						$iserror = 1;
						$url = array("id"=>"","act"=>"");
						$tourl = URL_admin_daymark($url);
						$pagecontent = "删除成功！<br/>";
				}
				
		}else{
			
				$sql = "SELECT * FROM user_daka_config ORDER BY days ASC";
				$dakadata = $db->query_array($sql);
				
		}
		
		if($iserror == 0){
			
				if($act == "add"){	
					
						$smartydate = array("pagetitle" => "签到设置",
																"posturl" => URL_admin_daymark(array("act"=>"addok")),
															);
    				
						$tplpath = "daymark_form.tpl";
						
				}elseif($act == "edit"){	
					
						$smartydate = array("pagetitle" => "签到设置",
																"posturl" => URL_admin_daymark(array("act"=>"editok","id"=>$id)),
																"dakadata" => $dakadata,
															);
    				
						$tplpath = "daymark_form.tpl";
						
				}else{
					
						$smartydate = array("pagetitle" => "签到设置",
																"dakadata" => $dakadata,
															);
    				
						$tplpath = "daymark_list.tpl";
							
				}
				
		}else{
			
				$smartydate = array("pagetitle" => "签到设置",
														"pagecontent" => $pagecontent,
														"tourl" => $tourl,
														"redirecturl" => $tourl,
				);
    		
				$tplpath = "public.tpl";
				
		}
?>