asp代码问题!!急!!求救!!

来源:百度知道 编辑:UC知道 时间:2024/06/28 04:30:44
小弟这个代码是进行用户登陆验证的,其中的提取IP功能什么的我不需要用到,能否帮我去掉。另外代码能否帮我注释一下!!

<%
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")

Function finddir(filepath)
finddir=""
for i=1 to len(filepath)
if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
abc=i
exit for
end if
next
if abc <> 1 then
finddir=left(filepath,len(filepath)-abc+1)
end if
end Function
xuasurl=finddir(request.servervariables("URL"))
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [config]",conn,1,3
if rs.recordcount=0 then
rs.addnew
end if
rs("path")=xuasurl
rs.update
rs.close
set rs=nothing
if request("user")="" or request("pass")="" t

<%
Function finddir(filepath)
finddir=""
for i=1 to len(filepath)
if left(right(filepath,i),1)="/" or left(right(filepath,i),1)="\" then
abc=i
exit for
end if
next
if abc <> 1 then
finddir=left(filepath,len(filepath)-abc+1)
end if
end Function
xuasurl=finddir(request.servervariables("URL"))
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [config]",conn,1,3
if rs.recordcount=0 then
rs.addnew
end if
rs("path")=xuasurl
rs.update
rs.close
set rs=nothing
if request("user")="" or request("pass")="" then
conn.close
set conn=nothing
Response.Redirect "login.asp?id=0"
else
user=LCase(chkhtm(request("user")))
pass=md5(chkhtm(trim(request("pass"))))