phpbar.de logo

Mailinglisten-Archive

Perl für Cron-Job (Wir bauen keinen Loop)
Archiv Mailingliste mysql-de

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Perl für Cron-Job (Wir bauen keinen Loop)



Gut, ich bin so frei:
---

#!/usr/local/bin/perl

# Es wird eine HTML-Seite generiert,
# die die Links auf alle Dokumente innerhalb von MDPS enthält.
# Diese Seite kann dann von Robots / HT:DIG gescannt werden.

use DBI;
open (STDOUT,">/somepath/robot.html") or die "wrong path: no file created";
my $dbh = DBI->connect('DBI:mysql:dbname','user','pswd') or die "no db-
connection: no file created";
my $sth = $dbh->prepare('select docnr, inhalt from myteable where tagnr=80 
order by docnr') or die "bad sql: no file created";
   $sth->execute() or die "no data in db: no file created";
my _(at)_data;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon = $mon+1;
$year = 1900+$year;

print "<html>\n<head>\n<title>Documentlist for robots</title>\n";
print " <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-
1\">\n";
print " <meta name=\"author\" content=\"LYNET Kommunikation\">\n";
print " <meta name=\"creator\" content=\"LYNET Kommunikation\">\n";
printf" <meta name=\"date\" content=\"%4d-%02d-%02d\">\n",$year,$mon,$mday;
print " <meta name=\"description\" content=\"Documentlist for robots\">\n";
print " <meta name=\"expire\" content=\"86400\">\n";
print " <meta name=\"language\" content=\"de\">\n";
print " <meta name=\"organization\" content=\"PIUS-INFO\">\n";
print " <meta name=\"owner\" content=\"PIUS-INFO\">\n";
print " <meta name=\"revisit-after\" content=\"1 days\">\n";
print " <meta name=\"robots\" content=\"follow\">\n";
print " <meta name=\"robots\" content=\"index\">\n";
print "</head>\n<body>\n<h1>Documentlist for robots</h1>\n";
print "<!--This document is generated daily by a cronjob so do not modify this 
file, changes would get lost.-->\n";
while (_(at)_data=$sth->fetchrow_array())
{ print "<a href=\"$data[1]\"> Document No. ".$data[0]."</a><br>\n";
}
print "</body>\n</html>\n";
close(STDOUT);
$sth->finish;
$dbh->disconnect;

---

P. Bierans
--
Patrick Bierans / LYNET Kommunikation / pbierans_(at)_lynet.de
-----------------------------------------------------------------------
Das Internet-Systemhaus fuer Multimedia- und Netzwerkloesungen 
 Zentrale: St.-Juergen-Ring 66, 23564 Luebeck, 
 Tel: +49-451-6131-0, Fax: -333 
 Niederlassung: Wendenstr. 379, 20537 Hamburg, 
 Tel: +49-40-65738-0, Fax: -333

---
*** Weitere Infos zur Mailingliste und MySQL unter www.4t2.com/mysql 


Home | Main Index | Thread Index

php::bar PHP Wiki   -   Listenarchive