Initial Commit
This commit is contained in:
BIN
database/contrib/BabelSans-B.fdb
Normal file
BIN
database/contrib/BabelSans-B.fdb
Normal file
Binary file not shown.
2
database/contrib/cds.xml
Normal file
2
database/contrib/cds.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<root><result><row><titel>Beauty</titel><interpret>Ryuichi Sakamoto</interpret><jahr>1990</jahr><id>1</id></row><row><titel>Goodbye Country (Hello Nightclub)</titel><interpret>Groove Armada</interpret><jahr>2001</jahr><id>4</id></row><row><titel>Glee</titel><interpret>Bran Van 3000</interpret><jahr>1997</jahr><id>5</id></row></result></root>
|
||||
41
database/contrib/dom.php
Normal file
41
database/contrib/dom.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
$dom = new DOMDocument('1.0', 'iso-8859-1');
|
||||
|
||||
$root = $dom->createElement('cds');
|
||||
$dom->appendChild($root);
|
||||
|
||||
mysql_connect("localhost","root","");
|
||||
mysql_select_db("cdcol");
|
||||
|
||||
$result=mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;");
|
||||
|
||||
while( $row=mysql_fetch_array($result) )
|
||||
{
|
||||
$cd = $dom->createElement('cd');
|
||||
$cd->setAttribute('id', $row['id']);
|
||||
|
||||
$titel = $dom->createElement('titel');
|
||||
$titel->appendChild($dom->createTextNode($row['titel']));
|
||||
$cd->appendChild($titel);
|
||||
|
||||
$interpret = $dom->createElement('interpret');
|
||||
$interpret->appendChild($dom->createTextNode($row['interpret']));
|
||||
$cd->appendChild($interpret);
|
||||
|
||||
$jahr = $dom->createElement('jahr');
|
||||
$jahr->appendChild($dom->createTextNode($row['jahr']));
|
||||
$cd->appendChild($jahr);
|
||||
|
||||
$root->appendChild($cd);
|
||||
}
|
||||
|
||||
header("Content-Type: text/xml;");
|
||||
$xml="<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
|
||||
<rss version=\"2.0\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\" xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">
|
||||
<channel>
|
||||
";
|
||||
echo $xml;
|
||||
print $dom->saveXML();
|
||||
echo "</channel></rss>";
|
||||
?>
|
||||
7
database/contrib/ftp-mit-perl.pl
Normal file
7
database/contrib/ftp-mit-perl.pl
Normal file
@@ -0,0 +1,7 @@
|
||||
use Net::FTP;
|
||||
print "Content-Type: text/html\n\n";
|
||||
$ftp = Net::FTP->new("localhost"); # Unser Host
|
||||
die "Konnte keine Verbindung aufbauen $!" unless $ftp;
|
||||
$ftp->login("newuser", "wampp"); # Hier Benutzername und Password eingeben
|
||||
$ftp->get("index.php");
|
||||
$ftp->quit;
|
||||
50
database/contrib/ftp-mit-php.php
Normal file
50
database/contrib/ftp-mit-php.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
$host="localhost";
|
||||
$user="zaphod";
|
||||
$password="blabla";
|
||||
|
||||
// Herstellen der Basis-Verbindung
|
||||
$conn_id = ftp_connect($host);
|
||||
|
||||
// Einloggen mit Benutzername und Kennwort
|
||||
$login_result = ftp_login($conn_id, $user, $password);
|
||||
|
||||
// Verbindung <20>berpr<70>fen
|
||||
if ((!$conn_id) || (!$login_result)) {
|
||||
echo "Ftp-Verbindung nicht hergestellt!";
|
||||
echo "Verbindung mit $host als Benutzer $user nicht m<>glich";
|
||||
die;
|
||||
} else {
|
||||
echo "Verbunden mit $host als Benutzer $user";
|
||||
}
|
||||
|
||||
print "<br>";
|
||||
$path="/";
|
||||
$dir = "";
|
||||
///// List
|
||||
$files=ftp_nlist($conn_id, "$path");
|
||||
foreach ($files as $file) {
|
||||
$isfile = ftp_size($conn_id, $file);
|
||||
if($isfile == "-1") { // Ist ein Verzeichnis
|
||||
print $file."/ [DIR]<br>";
|
||||
}
|
||||
else {
|
||||
$filelist[(count($filelist)+1)] = $file; // Ist eine Verzeichnis
|
||||
print $file."<br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///// Upload
|
||||
// ftp_put($conn_id, $remote_file_path, $local_file_path, FTP_BINARY);
|
||||
|
||||
///// Download
|
||||
// ftp_get($conn_id, $local_file_path, $remote_file_path, FTP_BINARY);
|
||||
|
||||
///// L<>schen einer Datei
|
||||
// ftp_delete ($conn_id, $remote_file_path);
|
||||
|
||||
|
||||
// Schlie<69>en des FTP-Streams
|
||||
ftp_quit($conn_id);
|
||||
?>
|
||||
36
database/contrib/interbase.php
Normal file
36
database/contrib/interbase.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und InterBase</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und InterBase/Firebird</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Interpret</th>
|
||||
<th>Titel</th>
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
<?php
|
||||
$db = ibase_pconnect("/opt/lampp/var/firebird/cdcol.gdb", "oswald", "geheim");
|
||||
|
||||
$query = "SELECT * FROM cds";
|
||||
$result = ibase_query($query);
|
||||
if ($result) {
|
||||
while ($row = ibase_fetch_assoc ($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['INTERPRET']."</td>";
|
||||
echo "<td>".$row['TITEL']."</td>";
|
||||
echo "<td>".$row['JAHR']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ibase_errmsg();
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
42
database/contrib/interbase.pl
Normal file
42
database/contrib/interbase.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
||||
my $dsn="DBI:InterBase:db=localhost:/opt/lampp/var/firebird/cdcol.gdb";
|
||||
my $dbh=DBI->connect("$dsn","oswald","geheim") or
|
||||
die "Kann Datenbank nicht erreichen!";
|
||||
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print "<title>Perl und InterBase/Firebird</title>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print "<h1>Perl und InterBase/Firebird</h1>";
|
||||
print "<table border=\"1\">";
|
||||
print "<tr>";
|
||||
print "<th>Interpret</th>";
|
||||
print "<th>Titel</th>";
|
||||
print "<th>Jahr</th>";
|
||||
print "</tr>";
|
||||
|
||||
my $query="SELECT * FROM cds";
|
||||
|
||||
my $prep_sql=$dbh->prepare($query) or die print "Can't prepare";
|
||||
$prep_sql->execute() or die print "Can't execute";
|
||||
|
||||
while (my @row = $prep_sql->fetchrow_array())
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td>".$row[2]."</td>";
|
||||
print "<td>".$row[1]."</td>";
|
||||
print "<td>".$row[3]."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$prep_sql->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
print "</table>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
24
database/contrib/mingstats.html
Normal file
24
database/contrib/mingstats.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Ming und PHP</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: verdana,helvetica;
|
||||
color: #000000;
|
||||
background-color: #f8e8a0;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
||||
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0"
|
||||
width=520 height=320>
|
||||
<PARAM name="Movie" value="mingstats_swf.php">
|
||||
<PARAM name="loop" value="false">
|
||||
<EMBED src="mingstats_swf.php" width=520 height=320
|
||||
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" loop="false">
|
||||
</EMBED>
|
||||
</OBJECT>
|
||||
</body>
|
||||
</html>
|
||||
112
database/contrib/mingstats_swf.php
Normal file
112
database/contrib/mingstats_swf.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2005 Kai Seidler, oswald@apachefriends.org
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
$values["A"]=rand(20,230);
|
||||
$values["B"]=rand(20,230);
|
||||
$values["C"]=rand(20,230);
|
||||
$values["D"]=rand(20,230);
|
||||
$values["E"]=rand(20,230);
|
||||
$values["F"]=rand(20,270);
|
||||
$values["G"]=rand(20,270);
|
||||
$values["H"]=rand(20,270);
|
||||
|
||||
$max=270;
|
||||
|
||||
$width=540;
|
||||
$height=320;
|
||||
|
||||
$m = new SWFMovie();
|
||||
$m->setDimension($width, $height);
|
||||
$m->setBackground(251, 121, 34);
|
||||
$m->setRate(30.0);
|
||||
|
||||
$font = new SWFFont("BabelSans-B.fdb");
|
||||
|
||||
$g = new SWFGradient();
|
||||
$g->addEntry(0.0, 0, 0, 0);
|
||||
$g->addEntry(1.0, 0xff, 0xff, 0xff);
|
||||
|
||||
function box($w,$h)
|
||||
{
|
||||
global $g;
|
||||
|
||||
$s = new SWFShape();
|
||||
$f=$s->addFill($g, SWFFILL_LINEAR_GRADIENT);
|
||||
$f->scaleTo(0.05);
|
||||
$s->setRightFill($f);
|
||||
//$s->setRightFill($s->addFill(255,255,255));
|
||||
$s->movePenTo(0, 0);
|
||||
$s->drawLineTo($w, 0);
|
||||
$s->drawLineTo($w, -$h);
|
||||
$s->drawLineTo(0, -$h);
|
||||
$s->drawLineTo(0, 0);
|
||||
return $s;
|
||||
}
|
||||
|
||||
function text($string)
|
||||
{
|
||||
global $font;
|
||||
|
||||
$t = new SWFText();
|
||||
$t->setFont($font);
|
||||
$t->setColor(255, 255, 255);
|
||||
$t->setHeight(20);
|
||||
$t->addString($string);
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
$t=$m->add(text("Balkendiagramm mit PHP und Ming"));
|
||||
$t->moveTo(30,40);
|
||||
|
||||
$i=0;
|
||||
reset($values);
|
||||
while(list($key,$value) = each($values))
|
||||
{
|
||||
$text[$i]=$m->add(text($key));
|
||||
$text[$i]->moveTo(50+$i*60,50);
|
||||
$box[$i]=$m->add(box(50,1));
|
||||
$box[$i]->moveTo(30+$i*60,$height-20);
|
||||
$box[$i]->setName("box".$i);
|
||||
$i++;
|
||||
}
|
||||
|
||||
for($f=0;$f<=$max;$f+=5)
|
||||
{
|
||||
$i=0;
|
||||
reset($values);
|
||||
while(list($key,$value) = each($values))
|
||||
{
|
||||
$h=$value;
|
||||
if($h>$f)
|
||||
{
|
||||
$box[$i]->scaleTo(1,$f);
|
||||
$text[$i]->moveTo(50+$i*60,$height-$f-25);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$m->nextFrame();
|
||||
}
|
||||
|
||||
$m->add(new SWFAction("stop();"));
|
||||
$m->nextFrame();
|
||||
|
||||
header('Content-type: application/x-shockwave-flash');
|
||||
$m->output();
|
||||
?>
|
||||
31
database/contrib/mysql.php
Normal file
31
database/contrib/mysql.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und MySQL</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und MySQL</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Vorname</th>
|
||||
<th>Nachname</th>
|
||||
<th>Telefonnummer</th>
|
||||
</tr>
|
||||
<?php
|
||||
mysql_connect("localhost", "oswald", "geheim");
|
||||
mysql_select_db("phonebook");
|
||||
|
||||
$query = "SELECT * FROM users";
|
||||
$result = mysql_query($query);
|
||||
while ($row = mysql_fetch_array ($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['firstname']."</td>";
|
||||
echo "<td>".$row['lastname']."</td>";
|
||||
echo "<td>".$row['phone']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
42
database/contrib/mysql.pl
Normal file
42
database/contrib/mysql.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
||||
my $dsn="dbi:mysql:phonebook:localhost";
|
||||
my $dbh=DBI->connect("$dsn","oswald","geheim") or
|
||||
die "Kann Datenbank nicht erreichen!";
|
||||
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print "<title>Perl und MySQL</title>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print "<h1>Perl und MySQL</h1>";
|
||||
print "<table border=\"1\">";
|
||||
print "<tr>";
|
||||
print "<th>Vorname</th>";
|
||||
print "<th>Nachname</th>";
|
||||
print "<th>Telefonnummer</th>";
|
||||
print "</tr>";
|
||||
|
||||
my $query="SELECT * FROM users";
|
||||
|
||||
my $prep_sql=$dbh->prepare($query) or die print "Can't prepare";
|
||||
$prep_sql->execute() or die print "Can't execute";
|
||||
|
||||
while (my @row = $prep_sql->fetchrow_array())
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td>".$row[1]."</td>";
|
||||
print "<td>".$row[2]."</td>";
|
||||
print "<td>".$row[3]."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$prep_sql->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
print "</table>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
45
database/contrib/oracle.php
Normal file
45
database/contrib/oracle.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und Oracle</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und Oracle</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Interpret</th>
|
||||
<th>Titel</th>
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
<?php
|
||||
$db="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
|
||||
(HOST=localhost) (PORT=1521)))
|
||||
(CONNECT_DATA=(SERVICE_NAME=xe)))";
|
||||
|
||||
// Oracle 10g
|
||||
//$db="//localhost/xe";
|
||||
|
||||
$c=ocilogon("hr", "geheim", $db);
|
||||
|
||||
$s = ociparse($c, "SELECT * FROM cds");
|
||||
|
||||
if(ociexecute($s))
|
||||
{
|
||||
while (ocifetch($s))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".ociresult($s, "INTERPRET")."</td>";
|
||||
echo "<td>".ociresult($s, "TITEL")."</td>";
|
||||
echo "<td>".ociresult($s, "JAHR")."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$e = oci_error($s);
|
||||
echo htmlentities($e['message']);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
42
database/contrib/oracle.pl
Normal file
42
database/contrib/oracle.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
||||
my $dsn="dbi:Oracle:host=localhost;sid=xe";
|
||||
my $dbh=DBI->connect("$dsn","hr","geheim") or
|
||||
die "Kann Datenbank nicht erreichen!";
|
||||
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print "<title>Perl und Oracle</title>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print "<h1>Perl und Oracle</h1>";
|
||||
print "<table border=\"1\">";
|
||||
print "<tr>";
|
||||
print "<th>Interpret</th>";
|
||||
print "<th>Titel</th>";
|
||||
print "<th>Jahr</th>";
|
||||
print "</tr>";
|
||||
|
||||
my $query="SELECT * FROM cds";
|
||||
|
||||
my $prep_sql=$dbh->prepare($query) or die print "Can't prepare";
|
||||
$prep_sql->execute() or die print "Can't execute";
|
||||
|
||||
while (my @row = $prep_sql->fetchrow_array())
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td>".$row[2]."</td>";
|
||||
print "<td>".$row[1]."</td>";
|
||||
print "<td>".$row[3]."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$prep_sql->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
print "</table>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
45
database/contrib/postgresql.php
Normal file
45
database/contrib/postgresql.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und PostgreSQL</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und PostgreSQL</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Interpret</th>
|
||||
<th>Titel</th>
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$conn_string = "host=localhost port=5432 dbname=cdcol
|
||||
user=oswald password=geheim";
|
||||
|
||||
$db_handle = pg_connect($conn_string);
|
||||
if(!$db_handle)
|
||||
die("Kann Datenbank nicht erreichen!");
|
||||
|
||||
$query = "SELECT * FROM cds";
|
||||
|
||||
$result = pg_exec($db_handle, $query);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
echo pg_errormessage($db_handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($row = 0; $row < pg_numrows($result); $row++)
|
||||
{
|
||||
$values = pg_fetch_array($result, $row, PGSQL_ASSOC);
|
||||
echo "<tr>";
|
||||
echo "<td>".$values['interpret']."</td>";
|
||||
echo "<td>".$values['titel']."</td>";
|
||||
echo "<td>".$values['jahr']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
42
database/contrib/postgresql.pl
Normal file
42
database/contrib/postgresql.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
||||
my $dsn="dbi:PgPP:dbname=cdcol;host=localhost;port=5432";
|
||||
my $dbh=DBI->connect("$dsn","oswald","geheim") or
|
||||
die "Kann Datenbank nicht erreichen!";
|
||||
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print "<title>Perl und PostgreSQL</title>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print "<h1>Perl und PostgreSQL</h1>";
|
||||
print "<table border=\"1\">";
|
||||
print "<tr>";
|
||||
print "<th>Interpret</th>";
|
||||
print "<th>Titel</th>";
|
||||
print "<th>Jahr</th>";
|
||||
print "</tr>";
|
||||
|
||||
my $query="SELECT * FROM cds";
|
||||
|
||||
my $prep_sql=$dbh->prepare($query) or die print "Can't prepare";
|
||||
$prep_sql->execute() or die print "Can't execute";
|
||||
|
||||
while (my @row = $prep_sql->fetchrow_array())
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td>".$row[2]."</td>";
|
||||
print "<td>".$row[1]."</td>";
|
||||
print "<td>".$row[3]."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$prep_sql->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
print "</table>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
56
database/contrib/sax.php
Normal file
56
database/contrib/sax.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und SAX</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und SAX</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Titel</th>
|
||||
<th>Interpret</th>
|
||||
<th>Jahr</th>
|
||||
<th>ID</th>
|
||||
</tr>
|
||||
<?php
|
||||
$parser = xml_parser_create();
|
||||
xml_set_element_handler($parser, 'startE','endE');
|
||||
xml_set_character_data_handler($parser, 'characterD');
|
||||
$fp = fopen('cds.xml', 'r');
|
||||
while ($data = fread($fp, 1024))
|
||||
{
|
||||
$result = xml_parse($parser, $data);
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
function startE($parser, $name, $attribs)
|
||||
{
|
||||
if($name=="ROW")
|
||||
{
|
||||
echo "<tr>";
|
||||
}
|
||||
else if($name=="TITEL" || $name=="INTERPRET" || $name=="JAHR" || $name=="ID")
|
||||
{
|
||||
echo "<td>";
|
||||
}
|
||||
}
|
||||
|
||||
function endE($parser, $name)
|
||||
{
|
||||
if($name=="ROW")
|
||||
{
|
||||
echo "</tr>";
|
||||
}
|
||||
else if($name=="TITEL" || $name=="INTERPRET" || $name=="JAHR" || $name=="ID")
|
||||
{
|
||||
echo "</td>";
|
||||
}
|
||||
}
|
||||
|
||||
function characterD($parser, $data)
|
||||
{
|
||||
print $data;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
29
database/contrib/soap.php
Normal file
29
database/contrib/soap.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header("Content-Type: text/html; charset=utf-8;");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und SOAP</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$client = new SoapClient('http://api.google.com/GoogleSearch.wsdl');
|
||||
|
||||
$apikey="apikey hier einsetzen";
|
||||
$searchfor="xampp";
|
||||
|
||||
$result = $client->doGoogleSearch($apikey, $searchfor, 0, 10, false, '', true, '', '', '');
|
||||
|
||||
echo "Gefundene Seiten: ".$result->estimatedTotalResultsCount;
|
||||
|
||||
echo "<ol>";
|
||||
foreach ($result->resultElements as $hit)
|
||||
{
|
||||
echo "<li><a href=\"".$hit->URL."\">".$hit->title."</a>";
|
||||
echo "<br>".$hit->snippet;
|
||||
}
|
||||
echo "</ol>";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
9
database/contrib/sql2xml.php
Normal file
9
database/contrib/sql2xml.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
include_once("XML/sql2xml.php");
|
||||
|
||||
$sql2xml = new xml_sql2xml("mysql://root@localhost/cdcol");
|
||||
$xml = $sql2xml->getxml("select * from cds");
|
||||
|
||||
header("Content-Type: text/xml;");
|
||||
echo $xml;
|
||||
?>
|
||||
37
database/contrib/sqlite.php
Normal file
37
database/contrib/sqlite.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und SQLite</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>PHP und SQLite</h1>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Interpret</th>
|
||||
<th>Titel</th>
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
<?php
|
||||
$db = sqlite_open('../sqlite/cdcol', '0666');
|
||||
|
||||
$query = "SELECT * FROM cds";
|
||||
$result = sqlite_query($db,$query);
|
||||
if ($result)
|
||||
{
|
||||
while ($row = sqlite_fetch_array($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row['interpret']."</td>";
|
||||
echo "<td>".$row['titel']."</td>";
|
||||
echo "<td>".$row['jahr']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo sqlite_error_string(sqlite_last_error($db));
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
42
database/contrib/sqlite.pl
Normal file
42
database/contrib/sqlite.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
||||
my $dsn="dbi:SQLite2:dbname=../sqlite/cdcol";
|
||||
my $dbh=DBI->connect("$dsn","","") or
|
||||
die "Kann Datenbank nicht erreichen!";
|
||||
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print "<title>Perl und PostgreSQL</title>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print "<h1>Perl und PostgreSQL</h1>";
|
||||
print "<table border=\"1\">";
|
||||
print "<tr>";
|
||||
print "<th>Interpret</th>";
|
||||
print "<th>Titel</th>";
|
||||
print "<th>Jahr</th>";
|
||||
print "</tr>";
|
||||
|
||||
my $query="SELECT * FROM cds";
|
||||
|
||||
my $prep_sql=$dbh->prepare($query) or die print "Can't prepare";
|
||||
$prep_sql->execute() or die print "Can't execute";
|
||||
|
||||
while (my @row = $prep_sql->fetchrow_array())
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td>".$row[2]."</td>";
|
||||
print "<td>".$row[1]."</td>";
|
||||
print "<td>".$row[3]."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$prep_sql->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
print "</table>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
21
database/contrib/testperldbi.pl
Normal file
21
database/contrib/testperldbi.pl
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/opt/lampp/bin/perl
|
||||
use DBI;
|
||||
|
||||
my $dsn = 'DBI:mysql:cdcol:localhost';
|
||||
my $db_user_name = 'root';
|
||||
my $db_password = '';
|
||||
my ($id, $password);
|
||||
my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
|
||||
|
||||
my $sth = $dbh->prepare(qq{
|
||||
SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;
|
||||
});
|
||||
$sth->execute();
|
||||
|
||||
while (my ($id, $title, $interpret, $jahr ) =
|
||||
$sth->fetchrow_array())
|
||||
{
|
||||
print "$title, $interpret\n";
|
||||
}
|
||||
$sth->finish();
|
||||
|
||||
31
database/contrib/xmlrss.php
Normal file
31
database/contrib/xmlrss.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
header("Content-Type: text/html; charset=utf-8;");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>PHP und XML_RSS</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include_once("XML/RSS.php");
|
||||
|
||||
$rss =& new XML_RSS('http://www.heise.de/newsticker/heise.rdf');
|
||||
|
||||
$rss->parse();
|
||||
|
||||
$meta=$rss->getChannelInfo();
|
||||
|
||||
echo "<h1>{$meta['title']}</h1>";
|
||||
echo $meta['description'];
|
||||
echo "<br>";
|
||||
echo "<a href=\"{$meta['link']}\">mehr...</a>";
|
||||
echo "<p>";
|
||||
|
||||
foreach ($rss->getItems() as $item)
|
||||
{
|
||||
echo "<a href=\"{$item['link']}\">{$item['title']}</a><br>";
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user