首页 > Linux操作系统 > Linux操作系统 > ASP进阶之文章在线管理更新(八)(转)
上面的程序很简单,都是HTM的结构,我就不多说了,下面我来讲讲验证用户名和密码的页面chklogin.asp"打开并建立数据库连接<!--#include file=conn.asp--><%dim sqldim rsdim founduserdim usernamedim passworddim errmsgdim founderrfounderr=falseFoundUser=false"接受从login.asp返回的用户信息username,passwordusername=trim(request.form("username"))password=trim(Request.Form("password"))"假如用户名username和密码password都为空,则返回login.asp页面if username="" thenresponse.redirect "login.asp"end ifif password="" thenresponse.redirect "login.asp"end if"利用username打开记录集admin中指定的记录set rs=server.createobject("adodb.recordset")sql="select * from admin where username='"&username&"'"rs.open sql,conn,1,1if not rs.eof then"在指定记录中假如返回的密码password和数据库中的密码相等,则将页面导向管理页面manage.asp,这里的response.cookies("adminok")=true是当用户为正确的时候,确认一个cookies,这样可以下次不用登陆直接可以进入管理页面if password=rs("password") thenresponse.cookies("adminok")=trueresponse.redirect "manage.asp"else"假如密码不正确,把页面导向登陆页面login.aspresponse.redirect "login.asp"end ifelseresponse.redirect "login.asp"end if"关闭数据库连接rs.closeconn.closeset rs=nothingset conn=nothing%>通过了密码验证以后就进入了文章管理系统的管理主页面,下一节的内容就是管理页面的主要结构和功能。
"显示栏目信息,当你点击了任何一个栏目,在typename的位置都会显示相关信息,这里没有采用栏目的自动显示方式是考虑了页面的显示效果,而采用手工添加的模式,要想采用自动模式,就自己写吧:)相信你学习到现在,不会连这个都编不出来吧!动网ASP技巧专题>><%response.write ""&typename&""%>ASP FAQ|ASP组件 |ASP文摘|ASP实例|ASP安全
没有或没有找到任何文章
<%=rs("articleid")%>
&typeid=<%=cstr(typeid)%>')"><%=rs("title")%>
<%=rs("date")%>
<%=rs("hits")%>
>>分页 ""如果当前页数小于2,则显示的文章首页和上一页不显示连接,否则用当前页数减去1来显示上一页,直接用page=1来显示首页if CurrentPage<2 thenresponse.write "首页 上一页 "elseresponse.write "首页 "response.write "上一页 "end if"假如分页页数小于1,则直接显示下一页和尾页,否则用当前页数加上1来显示下一页,用已经算出的文章分页数N显示文章的尾页if n-currentpage<1 thenresponse.write "下一页 尾页"elseresponse.write ""response.write "下一页 尾页"end if"用N和maxperpage显示文章的分页数和每页的文章数response.write " 页次:"&CurrentPage&"/"&n&"页 "response.write " 共"&totalnumber&"篇文章 "&maxperpage&"篇文章/页 ""直接输入文章所在页面转到相关页面response.write " 转到:"response.write "
标题: <%"显示与文章相关的栏目信息,可以选择一个进行查询,这里的typeid也赋值给了typeid,以使前面的显示文章的程序对需要显示内容做出判断typesql="select * from type"rstype.open typesql,conn,1,1do while not rstype.eofsel="selected" response.write ""+rstype("type")+""+chr(13)+chr(10)rstype.movenextlooprstype.closeset conn=nothing%>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7178747/viewspace-161817/ ,如需转载,请注明出处,否则将追究法律责任。
注册时间:2006-04-07