<!--#include file="session.asp"-->
<!--#include file="conn.asp"-->

<%


if request.Form("action")="add" then
classname=trim(request.Form("classname"))

if classname="" then
response.Write("<script>alert('类别不能为空');history.go(-1);</script>")
response.end()
end if
Set rsa = server.CreateObject("adodb.recordset")
sql="select * from news_class where classname='"&classname&"' "
rsa.Open sql, conn, 1, 3
if not rsa.eof  then
response.write("<script>alert('此分类已存在');history.go(-1)</script>")
response.end
end if
rsa.addnew
rsa("classname")=classname

rsa.update
rsa.close
set rsa=nothing


response.write("<script>alert(""添加成功"");location.href("""&Request.ServerVariables("HTTP_REFERER")&""");</script>")
response.end()
end if
%>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
.STYLE1 {font-size: 12px}
-->
</style>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">添加分类</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9">
   <!--内容开始-->
   <form name="form1" method="post" action="">
     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:20px;">
       <tr>
         <td width="10%"  height="30" align="right"><span class="STYLE1">文章类别：</span></td>
         <td width="90%"  height="30"><input type="text" name="classname"  > 
           * </td>
       </tr>
	   <tr><td height=10 colspan=2></td></tr>
       <tr>
         <td align="right" height="30">&nbsp;</td>
         <td height="30"><input type="submit" name="submit"  value="确定添加" style="border:0px; width:100px; height:26px; background:url(images/submit_button.jpg); color:#FFFFFF; font-weight:bold;"> <input name="action" type="hidden"  value="add"> </td>
       </tr>
     </table>
      </form>
   <!--内容结束-->    </td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td>
    <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
<%

conn.close
set conn=nothing
%>
