日期:2014-05-17  浏览次数:20967 次

asp 简单!!!
session.abandon         什么意思啊???  


------解决方案--------------------
abandon是注销Session
------解决方案--------------------
就是使当前Session过期
------解决方案--------------------
check.asp
<%
'检测用户名和其密码是否匹配(正确则返回1,不正确则返回0)
Function CheckPWD(UserName, PWD)
Dim rs_PWD, sql_PWD
Set rs_PWD = Server.CreateObject( "Adodb.RecordSet ")
sql_PWD = "Select * From tabUser Where Email= ' "& UserName & " ' And PWD= ' "& PWD & " ' "
rs_PWD.Open sql_PWD, conn, 3, 1

if rs_PWD.eof then
CheckPWD = 0
else
CheckPWD = 1
end if

CloseRs rs_PWD
End Function

function checklogin() '这里把判断写入涵数
if Session( "UserID ")= " " then
UserName = Request( "name ")
Password = Request( "PWD ")


if UserName <> " " and Password <> " " then
if CheckPWD(UserName, Password) then
Dim rs_LogonInfo, sql_LogonInfo
sql_LogonInfo = "select * from tabUser where Email= ' " & UserName & " ' "
OpenRs rs_LogonInfo, sql_LogonInfo
Session( "Email ") = UserName
CloseRs rs_LogonInfo
response.redirect " " '这里加你要转向的主页面的地址
else
response.write " <script language= " "javascript " "> alert( 'Username or Password is wrong. ');location.href= 'index.asp '; </script> "
end if
end if
ene fucntion '结束
%>
调用时,直接在该页面加入
<!--#include file= "check.asp "-->
<%=checklogin(0%>