[rochester-pm-list] I held out!!
Shawn Porter
sporter at rit.net
Tue Jan 4 13:06:42 CST 2000
That is because you're printing the header twice. Combine the two
headers.
-> http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#header
It will look something like this:
--
#!/usr/bin/perl
use CGI;
$id = '8675309';
$q = new CGI;
$cookie = $q->cookie(-name=>'STOREID',
-value=>$id,
-domain=>'.domain.com'
-path=>'www.domain.com/');
$url = 'http://www.domain.com/other.html';
print $q->redirect(-cookie=>$cookie,
-location=>$url);
--
I didn't test this code... but I think the concept of it is there.
--
Shawn Porter
http://www.rit.net/sporter
work - 716-223-3610 x116
home - 716-242-8742
sporter at rit.net
--
On Tue, 4 Jan 2000, Fred Edmister wrote:
> This time I've done everything I can... Read, debugged... This is the
> problem.. I have the cookie script that writes a cookie, and then redirects
> to another URL... Here's the problem... It writes the cookie, then puts the
> code for redirecting in the page view... If it redirects first, it doesn't
> write the cookie... (so it does everything it's supposed to do, just not
> all together.. ) Below is the code... (and yes, that's all of it, all it's
> supposed to do is write the cookie and dump them back to the main page...
> ) Thanks in advance to any suggestions.. Also, I've tried placing the
> calls for each sub all over... I'm still having no luck! :)
>
> Fred
>
>
> {clip}
> #!/usr/bin/perl
>
> ## Call Location from within the place cookie sub
> &place_cookie();
> &relocate();
>
> sub relocate {
>
> $url = "http://www.website.com/index.html\n\n";
> print "Location: $url\n\n";
> }
>
>
>
>
> sub place_cookie {
>
>
>
> # Place cookie code-stuff in here./...
>
>
> use CGI qw/:standard/;
> use CGI::Cookie;
>
> $store_id = param (storeid);
>
> # Create new cookies and send them
> $cookie1 = new CGI::Cookie(-name=>'STOREID',-value=>$id,
> -domain=>'.domain.com' -path=>'www.domain.com/');
>
>
> print header(-cookie=>[$cookie1]);
> # fetch existing cookies
> %cookies = fetch CGI::Cookie;
> $id = $cookies{'STOREID'};
>
> # create cookies returned from an external source
> %cookies = parse CGI::Cookie($ENV{COOKIE});
>
>
>
> ## At end of place_cookie call the relocate sub and we should be clear of
> ##the header we used....
>
> }
>
> {end clip}
>
More information about the Rochester-pm
mailing list