www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > master/notebook.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>notebook</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="notebook.asp?action=del&id="+id; } else {} } function CheckAll(form) { for (var i=0;i<form.elements.length;i++) { var e = form.elements[i]; if (e.Name != "chkAll") {e.checked = document.all["chkall"].checked;} } } </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 style='margin-bottom:5px;'><tr><th height=25>我的日记分类</th></tr><tr class=""tdbg"">"&_ "<td width=""66%"" class=Forumrow> " Set rs=conn.Execute("Select * From notebookcategory order by id asc") Do While Not rs.eof Response.Write "<a href=""notebook.asp?CID="& rs("id") &""">"& rs("category") &"</a> " rs.MoveNext Loop Response.Write "</td></tr></table>" End Sub Call Head() action=RequestSafeStr("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 "delall" Call delall() Case "top" Call top() Case else Call show() End Select %> <% Sub save() title=RequestFormStr("title") categoryid=RequestFormNum("categoryid") content=RequestFormStr("content") password=RequestFormStr("password") If title="" Then Call MessageBox("请输入标题!","") Response.End End If If content="" Then Call MessageBox("请输入内容!","") Response.End End If set rs=Server.CreateObject("ADODB.Recordset") sql="select * from notebook" rs.open sql,conn,1,3 rs.addnew rs("title")=title rs("categoryid")=categoryid rs("content")=content rs("password")=password rs.update rs.close Call MessageBox("添加日记成功!","notebook.asp") End Sub Sub editSave() id=RequestFormNum("id") If id<>0 then title=RequestFormStr("title") categoryid=RequestFormNum("categoryid") content=RequestFormStr("content") password=RequestFormStr("password") set rs=Server.CreateObject("ADODB.Recordset") sql="select * from notebook Where id="& id &"" rs.open sql,conn,2,3 If Not rs.eof then rs("title")=title rs("categoryid")=categoryid rs("content")=content rs("password")=password rs.update End If rs.close Call MessageBox("修改日记成功!","notebook.asp") End If End Sub 'del Sub del() id=RequestQueryNum("id") If id<>0 Then conn.Execute("delete From notebook Where id="& id &"") Call MessageBox("删除成功!","notebook.asp") End If End Sub 'delall Sub delall() id=RequestFormStr("id") If id="" Then Call MessageBox("请选择一项!","") Response.end End If 'response.write id 'response.end conn.Execute("delete From notebook Where id in ("& id &")") Call MessageBox("删除成功!","notebook.asp") End Sub 'top Sub top() id=RequestQueryNum("id") intTop=RequestQueryNum("top") If id<>0 Then conn.Execute("Update notebook set [top]="& intTop &",toptime=Now() Where id="& id &"") If intTop=1 Then strMsg="置顶成功!" Else strMsg="取消置顶成功!" End If Call MessageBox(strMsg,"notebook.asp") End If End Sub Sub show() cid=RequestQueryNum("cid") If cid<>0 Then sql="Select * From notebook Where categoryid="& cid &" order by top desc,id desc" Else sql="Select * From notebook order by id desc" End If Set mypage=new xdownpage '创建对象 mypage.getconn=conn '得到数据库连接 mypage.getsql=sql mypage.pagesize=20 '设置每一页的记录条数据为5条 set rs=mypage.getrs() '返回Recordset %> <table width="98%" align=center cellpadding="2" cellspacing="1"> <tr><td> <a href="notebook.asp?action=add"><strong>写日记</strong></a> </td></tr></table> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form action="noteBook.asp" method="post" name="formComment"> <input type="hidden" name="action" value="delall"> 全选/取消<input type="checkbox" value="on" name="chkall" onClick="CheckAll(document.formComment)"><input type="submit" class=buttonface value="删除" name="delAtticleId"> <tr> <th height="25" colspan="8">日记管理</th> </tr> <tr> <td class=Forumrow width="30">编号</td> <td class=Forumrow width="25">选择</td> <td class=Forumrow>标题</td> <td class=Forumrow width="50">查看</td> <td class=Forumrow width="50">点击</td> <td class=Forumrow width="150">发表日期</td> <td class=Forumrow align="center" width="150">操作</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><input type="checkbox" name="id" value="<%=rs("id")%>"></td> <td class=Forumrow><a href="notebook.asp?action=edit&id=<%=rs("id")%>"><%=rs("title")%></a></td> <td class=Forumrow ><a href="../articleshow.asp?id=<%=rs("id")%>" target="_blank">查看</a></td> <td class=Forumrow ><%=rs("hits")%></td> <td class=Forumrow ><%=rs("posttime")%></td> <td class=Forumrow align="center" > <%If rs("top")=0 then%> <a href="?action=top&id=<%=rs("id")%>&top=1">置顶</a> <%else%> <a href="?action=top&id=<%=rs("id")%>&top=0" class=red>取消置顶</a> <%End If%> <a href="?action=edit&id=<%=rs("id")%>">修改</a> <a href="javascript:del(<%=rs("id")%>)">删除</a></td> </tr> <% rs.MoveNext Next %> <tr align="left"> <td class=Forumrow></td> <td colspan="7" class=Forumrow> <input type="submit" name="submit" value="删除"> </td> </tr> <tr align="center"><td colspan="8" class=Forumrow><%mypage.showpage() %></td></tr> <form> </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="notebook.asp"> <input type="hidden" name="action" value="save"> <tr> <th height="25" colspan="2">写日记</th> </tr> <tr> <td width="15%" height="25" align="right" class=Forumrow>标题:</td> <td align="left" class=Forumrow> <input name="title" type="text" value="" size="25" style="width:300"> <span class="red">*</span></td> </tr> <tr> <td height="25" align="right" class=Forumrow>分类:</td> <td align="left" class=Forumrow> <Select name="categoryid"> <% Set rs=conn.Execute("Select * From notebookcategory order by id asc") Do While Not rs.eof %> <option value="<%=rs("id")%>"><%=rs("category")%></option> <% rs.MoveNext Loop rs.close Set rs=nothing %> </select></td> </tr> <tr> <td height="25" align="right" class=Forumrow>内容:</td> <td align="left" class=Forumrow style="padding-left:15px;"> <textarea name="content" style="display:none" ></textarea> <IFRAME ID="eWebEditor1" src="eWebEditor/ewebeditor.asp?id=content&style=standard_coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME> </td> </tr> <tr> <td height="25" align="right" class=Forumrow>加密:</td> <td align="left" class=Forumrow> <input name="password" type="text" value="" size=20 style="width:200">(不写,表示不设置密码)</td> </tr> <tr> <td class=Forumrow></td> <td height="30" class=Forumrow> <input type="submit" name="Submit" value="提 交" class="input1"> <input type="reset" name="Submit" class="input1"></td> </tr> </form> </table> <% End Sub Sub edit() id=RequestQueryNum("id") Set rs=conn.Execute("Select * From notebook 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="notebook.asp"> <input type="hidden" name="action" value="editsave"> <input type="hidden" name="id" value="<%=id%>"> <tr> <th height="25" colspan="2">修改日记</th> </tr> <tr> <td width="15%" height="25" align="right" class=Forumrow>标题:</td> <td align="left" class=Forumrow> <input name="title" type="text" value="<%=rs("title")%>" size="25" style="width:300"> <span class="red">*</span></td> </tr> <tr> <td height="25" align="right" class=Forumrow>分类:</td> <td align="left" class=Forumrow> <Select name="categoryid"> <% Set rsC=conn.Execute("Select * From notebookcategory order by id asc") Do While Not rsC.eof %> <option value="<%=rsC("id")%>" <%If rs("categoryid")=rsC("id") Then Response.Write "selected=""true""" End If %>><%=rsC("category")%></option> <% rsC.MoveNext Loop rsC.close Set rsC=nothing %> </select></td> </tr> <tr> <td height="25" align="right" class=Forumrow>内容:</td> <td align="left" class=Forumrow style="padding-left:15px;"> <textarea name="content" style="display:none" ><%=rs("content")%></textarea> <IFRAME ID="eWebEditor1" src="eWebEditor/ewebeditor.asp?id=content&style=standard_coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME> </td> </tr> <tr> <td height="25" align="right" class=Forumrow>加密:</td> <td align="left" class=Forumrow> <input name="password" type="text" value="<%=rs("password")%>" size=20 style="width:200">(不写,表示不设置密码)</td> </tr> <tr> <td class=Forumrow></td> <td height="30" class=Forumrow> <input type="submit" name="Submit" value="修改" class="input1"> <input type="reset" name="Submit" class="input1"></td> </tr> </form> </table> <% End If End Sub %> </body> </html>