在登录页面中输入用户名密码怎样进行判断是一般用户还是管理员,然后跳转到不同页面

我的登陆页面如图所示,输入用户名、密码后,要怎样进行判断是一般用户还是管理员,数据库里面的admin表字段是admin_id,admin_name(用户名),admin_pwd(密码),admin_style(用户类别,一般用户显示为0,管理员显示为1),图中对应的文本域名称为txt_name,txt_pwd;列表名为shf,如果是一般用户,跳转到页面user.asp;管理员用户跳转到页面admin.asp

如果能够解决我的难题的,我到时候会加分的
我不知道这个思路的代码要怎么写

<!--#include file="conn.asp"-->
<!--自己修改下数据库连接
--><% dim admin_name,admin_pwd,admin_style,admin_id
admin_name=Replace(request.Form("txt_name"), "'", "''")
admin_pwd=Request.Form("txt_pwd")
admin_style=request.Form("shf")
if admin_name="" then
response.Write("<script language=javascript>alert('请输入登陆帐号!');history.go(-1)</script>")
response.end
end if
if Request("txt_pwd")="" then
response.Write("<script language=javascript>alert('请输入登陆密码!');history.go(-1)</script>")
response.end
end if
sql="select * from admin where admin_name='"&admin_name&"' and admin_pwd='"&admin_pwd&"'"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
response.Write("<script language=javascript>alert('帐号密码错误!');history.go(-1)</script>")
response.End
end if
if admin_style=0 then
Response.Write("<script language=""JavaScript"">window.location.href='user.asp';</script>")
response.End()
end if
if admin_style=1 then
response.Write("<script language=""javascript"">window.location.href='admin.asp';</script>")
response.End()
end if
%>
温馨提示:答案为网友推荐,仅供参考
相似回答