当前位置: 代码迷 >> ASP >> []用asp做个验证
  详细解决方案

[]用asp做个验证

热度:94   发布时间:2012-03-05 11:54:01.0
在线等[求助]用asp做个验证
我的想法是在每一页的最开头做一个对比,把传来的a,b这2个值和数据库里的a,b做对比如果2个都相等就继续后面的操作,如果某一个不对就自动转到a1这个页.应该怎么写.
请各位大侠赐教.
a,b     2个值还有自动转页为a1页   对比都对的就继续后面的操作用 "内容 "2个字来代替
请帮我写一下这段小程序

------解决方案--------------------
un=request( "a ")
pwd=request( "b ")
opensql '以conn为对像名打开数据库
set rs=server.CreateObject( "adodb.recordset ")
sql= "select Password from Administrator where LoginName like ' "&un& " ' " rs.open sql,conn,1,1
if not rs.eof then
if trim(rs( "password "))=pwd then
session( "adminlogin ")=trim(un)
response.Write( " <script type= " "text/javascript " "> window.location.href= 'manager.asp '; </script> ")
else
response.Write( " <script type= " "text/javascript " "> window.location.href= 'index.asp?err= "&server.URLEncode( "您的用户名或密码错误! ")& " '; </script> ")
end if
else
response.Write( " <script type= " "text/javascript " "> window.location.href= 'index.asp?err= "&server.URLEncode( "您的用户名或密码错误! ")& " '; </script> ")
end if
rs.close
set rs=nothing
closesql '关闭数据库
------解决方案--------------------
dim a,b
a=request( "a ")
b=reuqest( "b ")
if conn.execute( "select count(id) from 表 where a= ' "&a& " ', ' "&b& " ' ")(0) <0 then
response.Redirect( "a1.asp?a&= "&a& "&b= "&b)
end if
------解决方案--------------------
dim a,b
a=request( "a ")
b=reuqest( "b ")
if conn.execute( "select count(*) from 表 where a= ' "&a& " ' and b= ' "&b& " ' ")(0) <0 then
response.Redirect "a1.asp "
end if

内容

------解决方案--------------------
dim a,b
a=request( "a ")
b=reuqest( "b ")
if conn.execute( "select count(id) from 表 where a= ' "&a& " ', ' "&b& " ' ")(0) <0 then
response.Redirect( "a1.asp?a&= "&a& "&b= "&b)
end if
  相关解决方案