<?php	
define('IN_OUN', true);
include_once( "includes/command.php");

if($Aconf['priveMessage'] != '')
{
   echo showMessage($Aconf['priveMessage']);
   exit;
}

$db_table = $pre."filter";
if( $_POST['action'] == 'add' || $_POST['action'] == 'edit' )
{


    if( $_POST['action'] == 'add' && $_POST['scid'] == 0){
		$sql = "INSERT INTO " . $db_table . " (ips,words,states)" .
                    "VALUES ('$_POST[ips]','$_POST[words]','$_POST[states]')"; 
        $oPub->query($sql);
    }

   if( $_POST['action'] == 'edit' && $_POST['fid'] > 0){
	   $_POST['fid'] = $_POST['fid'] + 0;
 
       $sql = "UPDATE " . $db_table . " SET  ips='$_POST[ips]',words='$_POST[words]',states='$_POST[states]'  
		        WHERE  fid='".$_POST['fid']."'";
        $oPub->query($sql);

   }

}
/* 网站配置信息 */
$db_table = $pre."filter";
$sql = "SELECT * FROM ".$db_table." ORDER BY fid ASC LIMIT 1";
$Anorm = $oPub->selectrow($sql);

?>
<?php
   include_once( "header.php"); 
?>

<DIV class=content>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="button">
<tr>
  <td align="left">
 <span style="font-weight:bold">用户留言,关键词及IP过滤设置:</span>
 </td>
</tr>
</table>
<TABLE width="100%" border=0>
  <TR>
  <form name="form1" method="post" action=""> 
    <TD width="13%" align="left"> 
		<p style="margin-left: 20px;margin-top:0px;"> 
		<span style="font-weight:bold">是否启用过滤:</span>
		<?PHP
		 $temChecked1 = ($Anorm['states'])?'CHECKED':'';
		 $temChecked0 = ($Anorm['states'])?'':'CHECKED';
		?>
		是<INPUT TYPE="radio" NAME="states" value="1" <?php echo $temChecked1;?>>
		否<INPUT TYPE="radio" NAME="states" value="0" <?php echo $temChecked0;?>>
		<br/>
		<span style="font-weight:bold">过滤关键词:</span>[<U>关键词之间用","号分隔</U>]<br/>
		<TEXTAREA NAME="words" style="height:200px;width: 600px" ><?php echo $Anorm['words'];?></TEXTAREA>
        <br/>
        <span style="font-weight:bold">过滤IP:</span>[<U>IP之间用","号分隔</U>]<br/>
		<TEXTAREA NAME="ips" style="height:200px;width: 600px" ><?php echo $Anorm['ips'];?></TEXTAREA>

		<br/>
		<input type="hidden" name="action" value="<?php echo ($Anorm['fid'])?'edit':'add';?>" />
        <input type="submit" name="Submit" value="<?php echo ($Anorm['fid'])?'编辑修改':'增加';?>" style="background-color: #FFCC66"/>
		<input type="hidden" name="fid" value="<?php echo ($Anorm['fid'])?$Anorm['fid']:'0';?>" />  
		</p>

    </TD>
    </form>
  </TR>	
 
</TABLE>
 
</DIV>
<?php
include_once( "footer.php");
?>