Leser: 1
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- TMPL_LOOP NAME=data -->
<tr>
<td><!-- TMPL_VAR NAME=Monat --></td>
<td><!--TMPL_VAR NAME=Tag --></td>
<td><!--TMPL_VAR NAME=Zeit --></td>
<td><!--TMPL_VAR NAME=Host --></td>
<td><!--TMPL_VAR NAME=Dienst --></td>
<td><!--TMPL_VAR NAME=Meldung --></td>
</tr>
<!-- /TMPL_LOOP -->
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- TMPL_LOOP NAME=data -->
<tr>
<td <!-- TMPL_IF NAME=IS_DEC -->style="background-color: red"<!-- /TMPL_IF -->><!-- TMPL_VAR NAME=Monat --></td>
<td><!--TMPL_VAR NAME=Tag --></td>
<td><!--TMPL_VAR NAME=Zeit --></td>
<td><!--TMPL_VAR NAME=Host --></td>
<td><!--TMPL_VAR NAME=Dienst --></td>
<td><!--TMPL_VAR NAME=Meldung --></td>
</tr>
<!-- /TMPL_LOOP -->
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
#!/usr/bin/perl -w
use strict;
#use CGI;
use DBI;
use HTML::Template;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Datenbankdaten und Verbindung zur DB herstellen
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Datenbank
my $datenbank = "info";
# Datenbankhost
my $datenbankhost = "127.0.0.1";
# Datenbankusername
my $datenbankuser = "root";
# Datenbankpasswort
my $datenbankpw = "";
my $dbh = DBI->connect("DBI:mysql:$datenbank:$datenbankhost","$datenbankuser","$datenbankpw")
or die "Fehler bei der Datenbankverbindung aufgetreten.";
#my $CGI = CGI->new();
my $sth = $dbh->prepare('select Monat, Tag, Zeit, Host, Dienst, Meldung
from infotable');
$sth->execute();
my $rows;
push @{$rows}, $_ while $_ = $sth->fetchrow_hashref();
my $template = HTML::Template->new(filename => 'template1.html');
$template->param(data => $rows);
#print $CGI->header();
print "Content-Type: text/html\n\n";
print $template->output();
$dbh->disconnect();
push @{$rows}, $_ while $_ = $sth->fetchrow_hashref();
push @{$rows}, {%$_, IS_DEC => $_->{Monat} eq 'Dec' ? 1 : 0} while $_ = $sth->fetchrow_hashref();
<td <!-- TMPL_SWITCH Monat --><!-- TMPL_CASE Dec -->style="background-color: red"<!-- /TMPL_SWITCH -->><!-- TMPL_VAR NAME=Monat --></td>
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/perl -w
use strict;
use CGI;
use DBI;
#use HTML::Template;
use HTML::Template::Compiled;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Datenbankdaten und Verbindung zur DB herstellen
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Datenbank
my $datenbank = "info";
# Datenbankhost
my $datenbankhost = "127.0.0.1";
# Datenbankusername
my $datenbankuser = "root";
# Datenbankpasswort
my $datenbankpw = "";
my $dbh = DBI->connect("DBI:mysql:$datenbank:$datenbankhost","$datenbankuser","$datenbankpw")
or die "Fehler bei der Datenbankverbindung aufgetreten.";
my $CGI = CGI->new();
my $sth = $dbh->prepare('select Monat, Tag, Zeit, Host, Dienst, Meldung
from infotable');
$sth->execute();
my $rows;
push @{$rows}, $_ while $_ = $sth->fetchrow_hashref();
#push @{$rows}, {%$_, IS_DEC => $_->{Monat} eq 'Dec' ? 1 : 0} while $_ = $sth->fetchrow_hashref();
my $template = HTML::Template->new(filename => 'template1.html');
$template->param(data => $rows);
print $CGI->header();
#print "Content-Type: text/html\n\n";
print $template->output();
$dbh->disconnect();
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title><"Ergebnis von auth.log"></title>
</head>
<body>
<h1>Tabelle für die Datei auth.log</h1>
<table border="1">
<caption>Assoziationen</caption>
<tr>
<th>Monat</th>
<th>Tag</th>
<th>Zeit</th>
<th>Host</th>
<th>Dienst</th>
<th>Meldung</th>
</tr>
<!-- TMPL_LOOP NAME=data -->
<tr>
<td <!-- TMPL_SWITCH Monat --><!-- TMPL_CASE Dec -->style="background-color: red"<!-- /TMPL_SWITCH -->><!-- TMPL_VAR NAME=Monat --></td>
<td><!-- TMPL_VAR NAME=Tag --></td>
<td><!-- TMPL_VAR NAME=Zeit --></td>
<td><!-- TMPL_VAR NAME=Host --></td>
<td><!-- TMPL_VAR NAME=Dienst --></td>
<td><!-- TMPL_VAR NAME=Meldung --></td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</body>
</html>
Quote[Sun Jan 14 22:12:47 2007] [error] [client 127.0.0.1] Can't locate object method "new" via package "HTML::Template" at /opt/lampp/htdocs/xampp/testperl.pl line 37.
[Sun Jan 14 22:12:47 2007] [error] [client 127.0.0.1] Premature end of script headers: testperl.pl
my $template = HTML::Template::Compiled->new(filename => 'template1.html');
10 Einträge, 1 Seite |