Removed hostname option.
[reportero_perl.git] / reportero
blobbbdef3e9a0ac2dc04c1f6f508508940432734ba1
1 #!/bin/env perl
2 # Test reporting program
4 use warnings;
5 use DBI;
6 use CGI qw(:standart);
7 use CGI::Carp qw(fatalsToBrowser);
10 $db_name = "tarificador";
11 $db_user = "tarificador";
12 $db_passwd = "n3ur0d3s4rr0ll008";
14 sub
15 db_search
17   my $dbh = shift ;
18   my $sql = param('sql');
20   my $sth = $dbh->prepare("$sql");
21   $sth->execute();
23   print <<'  END'
24     <html>
25     <head></head>
26     <body>
27   END
28   ;
30   my $count;
31   while (my $hash = $sth->fetchrow_hashref)
32   {
33     print 
34       "$hash->{id},$hash->{fecha_hora},$hash-{origen},$hash->{destino}<br/>";
35     $count++;
36   }
38   print <<'  END'
39     </body>
40     </html>
41   END
42   ;
45 my $dbh = DBI->connect("dbi:mysql:dbname=$db_name"
46     , "$db_user", "$db_passwd")
47     or die "ERROR: Cannot connect to DB: $DBI::errstr!\n";
49 db_search($dbh);