如何在ASP中进行Cookies的读写
MOTA 2004-10-23 09:00:24 如题
并看一下这个代码哪里有错误.
谢谢
<%
dim user,password,usercheck
if request.Form("user")="" and request.Form("password")="" then
if request.Cookies("user")="" and request.Cookies("password")="" then
usercheck=0
else
user=request.Cookies("user")
passowrd=request.Cookies("password")
end if
else
if request.Form("cookies")="cookiesyes" then
response.Cookies("tonglu-pen")("user")=request.Form("user")
response.Cookies("tonglu-pen")("password")=request.Form("password")
end if
user=request.Form("user")
passowrd=request.Form("password")
end if
if user<>"" then
set user=server.CreateObject("ADODB.recordset")
useropen="select user from user where user='"&user&"'"
user.open useropen,conn,1,3
if user.eof then
usercheck=0
else
if user("password")=password then
usercheck=1
end if
end if
end if
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then
userip = Request.ServerVariables("REMOTE_ADDR")
end if
%>