<%dbs="../"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="uccook.asp"-->
<!--#include file="uc.asp"-->
<%
act=request("act")
if act="add" then
PCN=Replace(Replace(Left(request.Form("PCN"),5),"<","["),">","]")
PCX=Replace(Replace(Left(request.Form("PCX"),9),"<","["),">","]")
if PCN="" then
		response.Write "<script >alert('提示：\n\n请填写分类名称,立即返回...');history.back(-1);</script>"
		response.End()	
end if
if PCX="" then
		response.Write "<script >alert('提示：\n\n请填写排序数字,立即返回...');history.back(-1);</script>"
		response.End()	
end if
if IsNumeric(PCX)<>true then
response.write "<script >alert('提示：\n\n对不起，排序只能填写数字！...');history.back(-1);</script>"
response.End()
end if

sql="SELECT COUNT(*) AS Expr1 FROM H_Class where uid="&UID&" and PCF=3"
rs.open sql,conn,1,1
Classcount=rs("Expr1")
rs.close
if Classcount>5 then 
response.write "<script >alert('提示：\n\n对不起，系统规定只能添加5个分类！...');history.back(-1);</script>"
response.End()
end if
set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Class"
	rs.open sql,conn,1,3
	rs.addnew
	rs("UID")=UID
	rs("PCN")=PCN
	rs("PCF")=3
	rs("PCX")=PCX
	rs.update
	rs.close
	set rs=nothing	
	response.Write "<script >alert('提示：\n\n增加成功,立即返回...');location.href='CProducts.asp';</script>"
	response.End()	
end if
act=request("act")
if act="edit" then
if request("PCN")="" then
		response.Write "<script >alert('提示：\n\n请填写分类名称,立即返回...');history.back(-1);</script>"
		response.End()	
end if
if request("PCX")="" then
		response.Write "<script >alert('提示：\n\n请填写排序数字,立即返回...');history.back(-1);</script>"
		response.End()	
end if
if IsNumeric(request("PCX"))<>true then
response.write "<script >alert('提示：\n\n对不起，排序只能填写数字！...');history.back(-1);</script>"
response.End()
end if
PCN=Replace(Replace(Left(request.Form("PCN"),5),"<","["),">","]")
if IsNumeric(request("id"))<>true then
response.write "<script >alert('提示：\n\n对不起，系统错误！...');history.back(-1);</script>"
response.End()
end if
set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Class where UID="&UID&" and  id="&request("id")&""
	rs.open sql,conn,1,3
	rs("PCN")=PCN
	rs("PCF")=3
	rs("PCX")=request("PCX")
	rs.update
	rs.close
	set rs=nothing	
	response.Write "<script >alert('提示：\n\n修改成功,立即返回...');location.href='CProducts.asp';</script>"
	response.End()	
end if

act=request("act")
if act="del" then
set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Products where H_class="&request("id")&""
	rs.open sql,conn,1,1
	if not rs.eof then
	response.Write "<script >alert('提示：\n\n该分类有产品，请转移文章所属分类后删除！...');location.href='CProducts.asp';</script>"
	response.End()
	end if 
conn.execute("delete from H_Class where id="&request("id")&"")
end if
	
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<title><%=W_title%>,会员中心</title>

<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="style.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="images/jquery.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=javascript src="images/function.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=javascript type=text/javascript>
<!--


/*
function AddnewType()
*/
-->
</SCRIPT>

<META content="MSHTML 6.00.3790.4426" name=GENERATOR>
</HEAD>
<BODY><!--用户中心头部-->
<!--#include file="top.asp"-->
<table width="960" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="150" valign="top"><!--#include file="left.asp"--></td>
      <td width="810" align="right" valign="top"><table width="800" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td width="20" align="center"><img src="images/ico_4.gif" width="12" height="12"></td>
                <td height="30" align="left"><a href="index.asp" target="_self">用户中心</a> <span class="uc_huise">&gt; 增加分类</span></td>
            </tr>
            <tr>
                <td height="1" colspan="2" bgcolor="#EEEEEE"></td>
        </tr>
        </table>
            <table width="600" height="5" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
            </table>
			<form name="form" action="CProducts.asp?act=add" method="post"  target="_self">
            <table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#EEEEEE">
                <tr>
                    <td height="30" colspan="5" align="left" bgcolor="#FFFFFF" class="uc_huise">增加分类  | <span class="fc_red">注意：分类请5个字以内，否则系统将自动切除后面的字符</span> </td>
                </tr>
                <tr>
                    <td width="128" height="30" align="right" bgcolor="#FFFFFF" class="fc_green" >分类名称：</td>
                  <td width="166" height="30" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="PCN" type="text" id="PCN"></td>
                  <td width="48" align="left" bgcolor="#FFFFFF" class="uc_huise" >排序</td>
                  <td width="227" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="PCX" type="text" id="PCX" size="5">
                  数字大，靠前排</td>
                  <td width="235" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="Submit" type="submit" class="biao" value="立即增加"></td>
                </tr>
            </table>
	        
			</form>
			
		    <table width="200" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
			
			
			
			
			
		    <table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#EEEEEE">
              <tr>
                <td height="30" colspan="6" align="left" bgcolor="#FFFFFF" class="uc_huise">分类管理</td>				
              </tr>
			  
			  <%
		set rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from H_Class where UID="&UID&" and PCF=3  order by PCX desc"
	rs.open sql,conn,1,1
	if rs.eof then
	response.Write " <td class=uc_huise bgcolor=#FFFFFF height=30 align=center >没有增加分类</td>"
	else
	do while not rs.eof 
		%>
			  
			  <form action="CProducts.asp?act=edit&id=<%=rs("id")%>" target="_self" method="post">
			  
              <tr>
                <td width="128" height="30" align="right" bgcolor="#FFFFFF" class="fc_green" >分类名称：</td>
                <td width="166" height="30" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="PCN" type="text" id="PCN" value="<%=rs("PCN")%>"></td>
                <td width="48" align="left" bgcolor="#FFFFFF" class="uc_huise" >排序</td>
                <td width="227" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="PCX" type="text" id="PCX" value="<%=rs("PCX")%>" size="5">
                数字大，靠前排</td>
                <td width="113" align="left" bgcolor="#FFFFFF" class="uc_huise" ><input name="Submit" type="submit" class="biao" value="立即修改"></td>
                <td width="113" align="center" bgcolor="#FFFFFF" >
				<table width="66" height="23" border="0" cellpadding="0" cellspacing="0" class="biao">
                  <tr>
                    <td align="center"><a href="?act=del&id=<%=rs("id")%>" target="_self">删除</a></td>
                  </tr>
			  </table></td>				
              </tr>
			  
		  	  </form>
				
				<%
				rs.movenext 
				
				loop
				rs.close
				end if
				%>
			  
            </table>
			
		
			
			
			
			
	  </td>
    </tr>
</table>
<!--#include file="end.asp"-->

</BODY></HTML>
