10 Einträge, 1 Seite |
$session->param(-name => "${user}_login", -value => 0);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use CGI::Cookie;
use Data::Dumper;
my $cgi = CGI->new();
my $cookie = CGI::Cookie->new(
-name => 'Prefs',
-value => { Name => 'foo', Value => 'lala', Login => 1 }
);
my $foo = get_values("Prefs");
if ( $foo->{Login} ) {
print $cgi->header( -cookie => $cookie ), $cgi->start_html();
print $cgi->b( "Hello " . $foo->{Name} );
print $cgi->b( $cgi->br(), $cookie->name() );
$cookie->value( [ 'bla', 'foo' ] );
}
else {
print $cgi->header( -cookie => $cookie ), $cgi->start_html(),
$cgi->b("New Login!");
}
print $cgi->pre( Dumper($foo) );
print $cgi->end_html();
sub get_values {
my $name = shift;
my $bla = {};
my $foo = CGI::Cookie->fetch();
my $counter = 0;
for ( 0 .. @{ $foo->{$name}->{value} } ) {
unless ( $counter % 2 ) {
if ( $foo->{$name}->{value}->[$_] ) {
$bla->{ $foo->{$name}->{value}->[$_] } =
$foo->{$name}->{value}->[ $_ + 1 ];
}
}
$counter++;
}
return $bla;
}
# code siehe oben
10 Einträge, 1 Seite |