Thread CGI: Cookie-Problem (2 answers)
Opened by Nexo at 2014-12-24 15:12

GwenDragon
 2014-12-24 15:28
#178899 #178899
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Was für ein Coookie-Pfad?
Domain und URL auf der Cookies gültig bleiben, musst du setzen.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use strict; 
use warnings;

my $meinWert1 = '04711';
my $meinWert2 = '42 THE VALUE OF THE WEB!';

use CGI;
my $cgi = CGI->new();
my $cookie1 = $cgi->cookie(-name=>              'autoname',
                          -value=>              $meinWert1,
                          -expires =>   '+1y',                                                            
                          );

my $cookie2 = $cgi->cookie(-name=>              'autopin',
                          -value=>              $meinWert2,
                          -expires =>   '+1y',                                                            
                          );
print $cgi->header(-cookie => [$cookie1, $cookie2]);



Code: (dl )
1
2
3
4
Set-Cookie: autoname=04711; path=/; expires=Thu, 24-Dec-2015 14:27:25 GMT
Set-Cookie: autopin=42%20THE%20VALUE%20OF%20THE%20WEB%21; path=/; expires=Thu, 24-Dec-2015 14:27:25 GMT
Date: Wed, 24 Dec 2014 14:27:25 GMT
Content-Type: text/html; charset=ISO-8859-1


Wieso ist das Modul alt? CGI::Cookie ist vom Dez. 2014 und CGI auch.
Last edited: 2014-12-24 15:30:14 +0100 (CET)

View full thread CGI: Cookie-Problem