www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > master/photocategory.asp
<!--#include file="check.asp"--> <!-- #include file="../inc/conn.asp" --> <!-- #include file="../inc/function.asp" --> <!--#include file="../inc/asppage.asp"--> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>photocategory</title> <link href="css.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function del(id) { var ok; ok=confirm("删除此相册,此相册下的所有相片都将被删除,且不可恢复!您确定要删除此相册吗?"); if (ok==true) { window.location="photocategory.asp?action=del&id="+id; } else {} } </script> </head> <body topmargin="10" background="images/bg1024.gif"> <% Sub Head() Response.Write "<table cellpadding=""5"" cellspacing=""1"" border=""0"" width=""98%"" class=""tableBorder"" align=center><tr><th height=25>相册分类</th></tr><tr class=""tdbg"">"&_ "<td width=""66%""> <a href=""photocategory.asp"">分类管理</a> | <a href=""photocategory.asp?action=add"">添加分类</a> </td></tr></table>" End Sub action=Request("action") Select Case action Case "add" Call add() Case "save" Call save() Case "edit" Call edit() Case "editsave" Call editSave() Case "del" Call del() Case else Call show() End Select %> <% Sub save() category=RequestFormStr("category") cindex=RequestFormNum("cindex") If category="" Then Call MessageBox("请输入分类名称!","") Response.End End If set rs=Server.CreateObject("ADODB.Recordset") sql="select * from photocategory" rs.open sql,conn,1,3 rs.addnew rs("category")=category rs("cindex")=cindex rs.update rs.close Call MessageBox("添加相册分类成功!","photocategory.asp") End Sub Sub editSave() id=RequestFormNum("id") If id<>0 then category=RequestFormStr("category") cindex=RequestFormNum("cindex") set rs=Server.CreateObject("ADODB.Recordset") sql="select * from photocategory Where id="& id &"" rs.open sql,conn,2,3 If Not rs.eof then rs("category")=category rs("cindex")=cindex rs.update End If rs.close Call MessageBox("修改相册分类成功!","photocategory.asp") End If End Sub 'del Sub del() id=RequestQueryNum("id") If id<>0 Then conn.Execute("delete From photo Where categoryid="& id &"") conn.Execute("delete From photocategory Where id="& id &"") Call MessageBox("删除成功!","photocategory.asp") End If End Sub Sub show() sql="Select * From photocategory Order by id desc" Set mypage=new xdownpage '创建对象 mypage.getconn=conn '得到数据库连接 mypage.getsql=sql mypage.pagesize=20 '设置每一页的记录条数据为5条 set rs=mypage.getrs() '返回Recordset 'Set rs=conn.Execute("Select * From photocategory Order by id desc") %> <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" > <tr><td> <form method="post" action="?action=save"> <input type="text" name="category" value="请输入分类名称..." style="color:#ccc;" onclick="javascript:this.value='';"> <input type="submit" value="增加分类"> </form> </td></tr></table> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <tr> <th height="25" colspan="5">相册分类</th> </tr> <tr> <td class=Forumrow width="100">编号</td> <td class=Forumrow>类名</td> <td class=Forumrow width="50">排序</td> <td class=Forumrow align="center" width="200">操作</td> </tr> <% for i=1 to mypage.pagesize If rs.eof Then Exit for End If %> <tr> <td class=Forumrow><%=rs("id")%></td> <td class=Forumrow><a href="photo.asp?cid=<%=rs("id")%>"><%=rs("category")%></a></td> <td class=Forumrow><%=rs("cindex")%></td> <td class=Forumrow align="center"> <a href="?action=edit&id=<%=rs("id")%>">编辑</a> <a href="javascript:del(<%=rs("id")%>)">删除</a></td> </tr> <% rs.MoveNext Next %> <tr align="center"><td colspan="4"td><%mypage.showpage() %></td></tr> </table> <% End Sub Sub add() %> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form name="add" method="post" action="?action=save"> <tr> <th height="25" colspan="3">添加相册分类</th> </tr> <tr> <td width="35%" height="25" align="right" class=Forumrow>分类名称:</td> <td width="180" align="left" class=Forumrow> <input name="category" type="text" value="" size="20" style="width:150"></td> <td height="30" class=Forumrow> <input type="submit" name="Submit" value="提 交" class="input1"></td> </tr> </form> </table> <% End Sub Sub edit() id=RequestQueryNum("id") Set rs=conn.Execute("Select * From photocategory Where id="& id &"") If Not rs.eof Then %> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form name="add" method="post" action="?action=editsave"> <input type="hidden" name="id" value="<%=id%>"> <tr> <th height="25" colspan=2>修改相册分类</th> </tr> <tr> <td width="30%" height="25" align="right" class=Forumrow>分类名:</td> <td width="70%" align="left" class=Forumrow> <input name="category" type="text" value="<%=rs("category")%>" size="20" style="width:150"></td> </tr> <tr> <td height="25" align="right" class=Forumrow>排序:</td> <td align="left" class=Forumrow> <input name="cindex" type="text" size=20 value="<%=rs("cindex")%>" style="width:150">(0表示系统默认排序)</td> </tr> <tr align="center"> <td height="30" colspan=2 class=Forumrow><input type="submit" name="Submit" value="提 交" class="input1"></td> </tr> </form> </table> <% End If End Sub %> </body> </html>