I am trying to make a cgi that set two cookies and return to the original page.

Almost everything works fine, but only the second cookie is stored, not the first one. If I ask for their values before using header, they have the correct values.

In the other hand, if you see, I am using a -location inside the header. I don't know if it is correct, or how to redirect to a page if using redirect with header gives me some problems (note commented line).

I will appreciate any clue (maybe a little mistake).


------


use CGI;
use MIME::Base64;

$cgi_this = new CGI;
$str_somedata = $cgi_this->param('password');
$value1 = encode_base64("some stuff : $str_somedata");
$value2 = encode_base64("more data");
$returnpage = $ENV{HTTP_REFERER};

$cook_admin = $cgi_this->cookie(-name=>'admin', -value=>$value1);
$cook_session = $cgi_this->cookie(-name=>'session', -value=>$value2);

# print $cgi_this->redirect(-uri=>$returnpage);
# print $cgi_this->header(-cookie =>[$cook_admin,$cook_session]);
print $cgi_this->header(-cookie =>[$cook_admin,$cook_session], -location=>$returnpage);


--


Saludos,



J. Alejandro Ceballos Z. | ---------------------------+--------------------------- http://alejandro.ceballos.info | [EMAIL PROTECTED] | "El pasado siempre termina -------------------------------+ por darnos alcance, Tel: (33) 3647-7809 | por mucho que corramos." Cel: (33) 1076-4705 | | -- El enigma de Cambises, Paul S.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to