分享

写回答

发帖

[提问] 关于cookies问题

GoDaddy GoDaddy 1347 人阅读 | 4 人回复

发表于 2010-9-10 17:10:58 | 显示全部楼层 |阅读模式

http://www.ep0750.com/ep0750/qinggan/index.asp 用这样的绝对路径登录是没有问题的
而用 http://qinggan.ep0750.com/ 这样的子目录 却登陆不了。
小的技术不够 看了论坛关于cookies的很多方法都不会弄 望高手指点下 以下是chklogin.asp的代码
请问我要怎么改才 可以让http://qinggan.ep0750.com/ 可以登陆呢

<%
        call head()
        dim cookies_path_s,cookies_path_d,cookies_path
        LastIP=Request.ServerVariables("REMOTE_ADDR")
        if request("username")="" then
                errmsg=errmsg+"<br>"+"<li>请输入您的用户名。"
                founderr=true
        else
                username=trim(checkStr(request("username")))
        end if
        if request("password")="" then
                errmsg=errmsg+"<br>"+"<li>请输入您的密码。"
                founderr=true
        else
                password=md5(trim(checkStr(request("password"))))
        end if
        '判断更新cookies目录
        cookies_path_s=split(Request.ServerVariables("PATH_INFO"),"/")
        cookies_path_d=ubound(cookies_path_s)
        cookies_path="/"
        for i=1 to cookies_path_d-1
                if not (cookies_path_s(i)="upload" or cookies_path_s(i)="admin") then        

cookies_path=cookies_path&cookies_path_s(i)&"/"
        next
        if cookiepath<>cookies_path then
                cookiepath=replace(cookies_path,"'","")
                conn.execute("update config set cookiepath='"&cookiepath&"'")
        end if

        if founderr=true then
                call txl_error()
                response.end
                call foot()
        else
                set rs=server.createobject("adodb.recordset")
                sql="select * from [user] where username='"&username&"'"
                rs.open sql,conn,1,3
                if rs.bof and rs.eof then
                        errmsg=errmsg+"<br>"+"<li>对不起,找不到该用户!"
                        call txl_error()
                        call foot()
                        response.end
                else
                        if rs("password")<>password then
                                errmsg=errmsg+"<br>"+"<li>您输入的密码不正确。"
                                call txl_error()
                                call foot()
                                response.end
                        elseif rs("lockuser")>=2 then
                                errmsg=errmsg+"<br>"+"<li>对不起呀,你的帐号被管理员锁定了!"
                                call txl_error()
                                call foot()
                                response.end                       
                                else
                                rs("usermoney")=rs("usermoney")+txl_user(1)
                                rs("logins")=rs("logins")+1
                                        rs("lastIp")=Request.ServerVariables("REMOTE_ADDR")
                                rs("lasttime")=Now()
                                Rs.update
                                Response.Cookies("huncent")("realname") = rs("realname")
                                Response.Cookies("huncent")("userid") = rs("userid")
                                Response.Cookies("huncent")("password") = rs("password")       
                                Response.Cookies("huncent")("skinid") = rs("skinid")
                                Response.Cookies("huncent").path=cookiepath
                        end if
                end if
                  rs.Close
                set rs=nothing
        end if
        response.redirect"index.asp"
        call foot()
%>

回答|共 4 个

7181047

发表于 2010-9-10 17:22:32 | 显示全部楼层

谁能帮帮忙呀.....

add.c

发表于 2010-9-10 17:45:37 | 显示全部楼层

我不懂程序..
RAKSmart

7181047

发表于 2010-9-10 17:47:14 | 显示全部楼层

  闹心啊~~~~~~~~~~~ 子目录的cookies 好麻烦!

7181047

发表于 2010-9-10 18:01:33 | 显示全部楼层

唉.........................
您需要登录后才可以回帖 登录 | 注册

本版积分规则