Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: Help reading cookies

by skx (Parson)
on Nov 23, 2008 at 15:05 UTC ( #725426=note: print w/replies, xml ) Need Help??

in reply to Re^2: Help reading cookies
in thread Help reading cookies

Is there any way for me to tell the script which domain to look at? Like the one that makes the call?


If it is the "wrong" domain then the script won't even receive the cookie.

The client's browser won't send it. This is out of your control.


Replies are listed 'Best First'.
Re^4: Help reading cookies
by htmanning (Pilgrim) on Nov 23, 2008 at 21:14 UTC
    Well, what about having a script called at every domain? The user clicks a link to go to www.mymaindomain/cgi-bin/ and that somehow passes off to myfirstdomain/cgi-bin/ which would include this:

    local(@getcookies) = split (/; /,$ENV{'HTTP_COOKIE'}); local(%cookies); foreach(@getcookies){ ($ckey, $cval) = split (/=/,$_); $cookies{$ckey} = $cval; } #end foreach(@getcookies) $user_sid = $cookies{'phpbb2mysql_sid'}; $user_logged = $cookies{'phpbb2mysql_data'}; $user_lang = $cookies{'lang'}; if ($user_logged !~ /autologin/) { print "$user_logged"; &error(not_logged); }

    That would check the local cookie on that domain before passing back to the www.mymaindomain/cgi-bin/ script again. Shouldn't that work?

    My only problem now is, how do I pass it off? I have a require line in the that takes it to the script at, but it doesn't read the cookie.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://725426]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2018-11-15 15:19 GMT
Find Nodes?
    Voting Booth?
    My code is most likely broken because:

    Results (186 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!