只有管理员才有权限进入后台修改数据库,其部分代码如下:
session("shopadmin")=""
session("init")=""
dim myconn
msg=""
shopopendatabase myconn
on error resume next
if request("submit")<>"" then
sql = "select * from tbluser where fldusername=“" & request("username")&"“andfldpassword=“"&request("password")& "“"
set rs = myconn.execute(sql)
if err.number>0 then
msg=session("openerror")
else
if not rs.eof then
session("shopadmin") = rs("fldusername")
loguser session("shopadmin"), "in", myconn
shopclosedatabase myconn
response.redirect "shopadmin1.asp"
else
msg="用户名或者密码错误!<br>"
end if
end if
end if
shoppageheader
if msg <> "" then
response.write msg
end if
%>
</center>
<form action="shopadmin.asp" method="post" name="loginform">
<center><font face=arial size=2 color="#0080c0">
<b>此页面仅供管理员使用</b></font></center><br>
</font></font>
<table width=300 border=1 cellpadding=3 cellspacing=0
align="center" bordercolordark="#333399" bordercolorlight="#666699">
<tr>
<td bgcolor="#0080c0" colspan=2 align=left valign=top>
<font face="trebuchet ms, arial, helvetica">
<font face="arial, arial, helvetica">
<font face="arial" size=2 color=white><b>高级用户登陆</b></font>
</font></font></td>
</tr>
<tr>
<td width=50 align=left valign=top>
<font face="trebuchet ms, arial, helvetica">
<font face="arial, arial, helvetica">
<font face="arial" size=2><b>用户名:</b>
</font></font></font></td>
<td align=left valign=top>
<font face="trebuchet ms, arial, helvetica">
<font face="arial, arial, helvetica">
<input type=text name="username" value="<%=request("username") %>">
</font></font></td>
</tr>
<tr>
<td width=50 align=left valign=top>
<font face="trebuchet ms, arial, helvetica">
<font face="arial, arial, helvetica">
<font face="arial" size=2><b>密码:
</b></font></font></font></td>
<td align=left valign=top>
<font face="trebuchet ms, arial, helvetica">
<font face="arial, arial, helvetica">
<input type=password name="password">
</tr>
其用来登陆的用户名、密码、及登陆后的权限都与系统数据库相连
如过用户名、密码错误将来到以下界面
输入管理员用户名、密码后来到以下界面
进入后台数据库管理系统,其部分代码如下:
%>
<p align="center">选择相应的项可以进行管理编辑</p>
<p>
<center>
<%
dim myconn
shopopendatabase myconn
formatheader
list = getaccess(session("shopadmin"), myconn)
ac = split(list,",")
for each item in ac
sql = "select * from tblaccess where fldauto = " & cint(item)
set objrec = myconn.execute(sql)
formatrow objrec
next
shopclosedatabase myconn
formattrailer
end sub
sub formatheader
%>
<table border="2" cellspacing="1" width="90%" bordercolor="#008080">
<tr>
<td width="50%">
<p align="center"><b><font face="verdana">功能</font></b></td>
<td width="50%">
<p align="center"><b><font face="verdana">描述</font></b></td>
</tr>
<%
end sub
sub formatrow (objrec)
dim name,url,comment
name = objrec("fldname")
url = objrec("fldurl")
comment=objrec("fldcomment")
%>
其中网页上所显示的“功能”及“描述”选项都与系统数据库相连,点击“显示订单”按钮,