Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: (nrd) cookies/redirect problem

by newrisedesigns (Curate)
on Feb 25, 2003 at 22:43 UTC ( #238595=note: print w/replies, xml ) Need Help??


in reply to cookies/redirect problem

I just tested your program on Apache/Win2000. Worked fine for me, so you're on the right track.

Your test could use some detail; instead of redirecting, print a standard header with cookie along with a page with a self-referencing link. That way you aren't throwing it in a loop. Also, if you're using Mozilla, I suggest installing Livehttpheaders. It's great for debugging CGI scripts.

Good luck to you.

Untested.
use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); # New CGI object my $q = CGI->new(); my $test = $q->cookie("test"); if (defined $test) { print $q->header; print $q->start_html('Test stuff'); print "<BR><BR>\n"; print "I got cookie value: $test<BR>\n"; print $q->end_html; } else { my $cookie = $q->cookie(-name => 'test', -value => 'test value'); print $q->header(-cookie => $cookie); print $q->start_html("Test page"); print $q->p(q[<a href="] . $q->self_url . q[">check cookie</a>]); print $q->end_html; }

John J Reiser
newrisedesigns.com

Replies are listed 'Best First'.
Re: Re: (nrd) cookies/redirect problem
by ibanix (Hermit) on Feb 25, 2003 at 23:48 UTC
    Thanks John.

    I tried your code and it worked as expected. I got the page with the self-refrencing link; on click it shows that it found the cookie. I guess my server (IIS5.0 on Win2K) is to blame.

    dws' mentioned a thread above, and in it he stated:
    " banged my head into a wall on this one with IIS4.0 a year ago, and finally fell back on using a 0 second refresh.

    <meta http-equiv=refresh content="0;url=http://www.example.com/overhe +re.html">
    "
    Does this work for other people? Or is there a better solution?

    Thanks!

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://238595]
help
Chatterbox?
[choroba]: yeah, sounds like one of the strings is not flagged as UTF-8
[choroba]: which usually means its input wasn't handled correctly
[Corion]: choroba: Yeah, I think that would be the good solution
[LanX]: I suspect the first string which comes from the DB ...
[LanX]: ... but this part is already in production for a year now
[Corion]: LanX: The "good" approach here would be to use the appropriate DBI parameters to make the driver decode strings properly. But that will have a ripple-on effect of messing up all the places where manual decoding happens ;)
[LanX]: which means albeit being broken UTF8 it'll be handled correctly
[LanX]: and the problem only occurs since we changed the emails to base64
[LanX]: my main problem will be to cnvince my colleagues that our productive code is broken oO ... so in the end I will just make a workaround :-/
LanX hates UTF8 for causing knots in his brain and stomach

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-01-16 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (150 votes). Check out past polls.