Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use strict; use DBI; use CGI qw(:all); my $query = new CGI; my $name="Joe X"; my $buddy = "more Numbers XY"; my $cookie1 = $query->cookie(-name=>'name', -value=>"$name", -expires=>'+4h', -path=>'/'); my $cookie2 = $query->cookie(-name=>'buddy', -value=>"$buddy", -expires=>'+4h', -path=>'/'); print $query->header(-cookie=>[$cookie1,$cookie2]); my $got_cookie1 = $query->cookie('name'); my $got_cookie2 = $query->cookie('buddy'); if($f_name eq ""){$name = $got_cookie1;} if($buddy eq ""){$buddy = $got_cookie2;} print "<meta http-equiv=\"refresh\" content=\"2\";\ url=http://www.myp +age.com/cgi-bin/per.pl?buddy=$buddy&name=$name\">"; print $query->redirect('http://www.mypage.com/cgi-bin/per.pl?buddy=$bu +ddy&name=$name'); my $url = "http://www.mypage.com/cgi-bin/per.pl?buddy=$buddy&name=$nam +e"; print "Location: $url\n\n"; print $query->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting Cookies First and Redirecting Page
by chargrill (Parson) on Sep 15, 2006 at 18:24 UTC | |
by Anonymous Monk on Sep 15, 2006 at 18:41 UTC | |
|
Re: Setting Cookies First and Redirecting Page
by robartes (Priest) on Sep 15, 2006 at 21:19 UTC | |
|
Re: Setting Cookies First and Redirecting Page
by ptum (Priest) on Sep 15, 2006 at 18:24 UTC | |
by Anonymous Monk on Sep 15, 2006 at 18:42 UTC | |
by ptum (Priest) on Sep 15, 2006 at 18:52 UTC | |
by Anonymous Monk on Sep 15, 2006 at 19:14 UTC | |
by derby (Abbot) on Sep 15, 2006 at 20:09 UTC | |
by ptum (Priest) on Sep 15, 2006 at 19:52 UTC |