当前位置: 代码迷 >> ASP >> 哪位高手能帮小弟我解决这有关问题
  详细解决方案

哪位高手能帮小弟我解决这有关问题

热度:212   发布时间:2012-03-03 15:33:02.0
谁能帮我解决这问题?
请看代码:

<%
dim   a,b
a=request.form( "admin ")   '用户名
b=request.form( "pwd ")       "密码

if   a= "admin "   and   b= "853111 "   then
response.redirect   "input.asp?grade=7&class=1 "
elseif   a= "admin "   and   b= "454612 "   then
response.redirect   "input.asp?grade=7&class=2 "
elseif   a= "admin "   and   b= "365313 "   then
response.redirect   "input.asp?grade=7&class=3 "
elseif   a= "admin "   and   b= "789314 "   then
response.redirect   "input.asp?grade=7&class=4 "

else
response.redirect   "bjlogincheck2-1.htm "
end   if
%>
如果我想把变量a与b的内容与ACEESS连接上,以后通过修改数据库里的用户名与密码就可以修改此页面里的用户名与密码,我想这样便于以后维护,(如:修改admin与853111),该怎么办?
各位高手,请把上面的代码帮我改一下好吗?谢!!!!!!!!!!1

------解决方案--------------------
表结构[table]
name pwd gotourl
admin 853111 input.asp?grade=7&class=1
admin 544612 input.asp?grade=7&class=2
..................

set rs = server.createobject( "adodb.recordset ")
rs.open "select * from [table] where name = ' " & a & " ' and pwd = ' " & b & " ' ",conn,1,1
if not (rs.bof and rs.eof) then response.redirect rs( "gotourl ")

提示,最好不要用同用户名~
name = ' " & a & " ' and pwd = ' " & b & " '
这样写也不安全~
  相关解决方案