ASP多用户登陆

来源:百度知道 编辑:UC知道 时间:2024/06/03 18:36:34
<!-- #include file="conn/conn.asp" -->
<% '读取数据库
exec="select * from login"
set rb=server.createobject("adodb.recordset")
rb.open exec,conn,1,1
%>
<% usename=request.form("usename")
usepass=request.form("usepass")
if usename=""then
response.write"<script>alert('登录失败,用户名为空');location.href='login.asp'</script>"
Response.end
end if
if usepass="" then
response.write"<script>alert('登录失败,密码为空');location.href='login.asp'</script>"
Response.end
end if
if usename=rb("usename") and usepass=rb("usepass") then
response.write"<script>alert('恭喜,登录成功');location.href='tongxin.asp'</script>"
else
response.write"<script>alert('登录失败,帐号或密码不正确');location.href='

<!-- #include file="conn/conn.asp" -->
<%
usename=request.form("usename")
usepass=request.form("usepass")
if usename=""then
response.write"<script>alert('登录失败,用户名为空');location.href='login.asp'</script>"
Response.end
end if
if usepass="" then
response.write"<script>alert('登录失败,密码为空');location.href='login.asp'</script>"
Response.end
end if
'读取数据库
exec="select * from login where usename='"&usename&"' and usepass='"&usepass&"'"
set rb=server.createobject("adodb.recordset")
rb.open exec,conn,1,1
if not (rs.eof and rs.bof) then
Session("usename")=usename
response.write"<script>alert('恭喜,登录成功');location.href='tongxin.asp'</script>"
else