4. auslesen kannst du den cookie folgendermaszen:
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
use CGI;
use DBI;
my $cgi = CGI->new();
my $db = DBI->connect(....) or die $DBI::errstr;
....
&checksession($cgi, $db);
sub checksession {
my ($cgi, $db) = @_;
my $sessionId = $cgi->cookie('sessionid');
if ($sessionId) {
my $sessionIdSecure = $db->quote($sessionId);
my $statement = qq~SELECT * FROM user, access WHERE sesionId = $sessionIdSecure AND ....~;
my $sth = $db->prepare($statement);
unless ($sth) { # fehlerabfrage
die "Error in preparing statement: ", $db->errstr;
}
unless ($sth->execute) {
die "Error in executing statement: ", $db->errstr;
}
# ..... usw.
} # checksesssion
\n\n
<!--EDIT|Strat|1071051421-->