Datei erste.phtml:
<html>
<head>
<title>Testdatei mit PHP</title>
</head>
<body bgcolor="yellow" >
<h2>Testdatei mit PHP</h2>
<form action="kredel.phtml" method="post">
<p>Hallo wie ist dein Name?
<input type="text" name="benutzer" size="30"
<?php print "value='$benutzer'" ?>
/>
<p>Kennwort:
<input type="password" name="kwort" size="20" />
</p>
<p>
<input type="submit" value="ab die Post" />
</p>
<form>
<?php
$benutzer = $_REQUEST['benutzer'];
$kwort = $_POST['kwort'];
print "<h3>Hallo $benutzer !</h3>\n";
for ($i=0; $i < 10; $i = $i + 1 ) {
print "<p>Halli hallo zum $i-ten mal.</p>\n";
if ( $i == 3 ) {
print "<p style='color: red;' >Hurra sie haben Gewonnen!<p>\n";
}
}
print "<p>" . 70 . 80 . "</p>\n";
print "<p>" . ("70"+"80") . "</p>\n";
print "<p>" . ( "5aa" + "b5b") . "</p>\n";
?>
print "<p>" . 70 . 80 . "</p>\n";
print "<p>" . ("70"+"80") . "</p>\n";
print "<p>" . ( "5aa" + "b5b") . "</p>\n";
?>
<?php if ( $benutzer == 'Bond' && $kwort == 4711 ): ?>
<p> eine geheime Nachricht für James Bond </p>
<?php endif ?>
</body>
</html>
Datei zweite.phtml:
<?php
$filename=$SCRIPT_FILENAME;
$counter_start="1";
function mycounter() {
global $filename, $counter_start;
$counter_dir="/tmp/";
$counter_db=$counter_dir . "zaehler.dbm";
if (file_exists("$counter_db")) {
$db=dba_open($counter_db,"w","gdbm");
if ( dba_exists($filename,$db) ) {
$cnt = dba_fetch($filename,$db);
if ($counter_start=="1") { $cnt++; }
else { $cnt=$counter_start; }
dba_replace($filename,$cnt,$db);
}
else {
$cnt=$counter_start;
dba_insert($filename,$cnt,$db);
}
dba_close($db);
return "$cnt";
}
else {
echo "Attempt to create file: " . $counter_db;
$cnt=$counter_start;
$db=dba_open($counter_db,"n","gdbm");
dba_insert($filename,$cnt,$db);
dba_close($db);
return "$cnt";
}
}
?>
<html>
<head>
<title>zweite Testdatei mit PHP</title>
</head>
<body bgcolor="yellow" >
<h2>Testdatei mit PHP</h2>
<html>
<head>
<title>Testdatei mit PHP</title>
</head>
<body bgcolor="yellow" >
<h2>Testdatei mit PHP</h2>
<form action="kredel.phtml" method="get">
<p>Hallo wie ist dein Name?
<input type="text" name="benutzer" size="30"
<?php print "value='$benutzer'" ?>
/>
<p>Kennwort:
<input type="password" name="kwort" size="20" />
</p>
<p>
<input type="submit" value="ab die Post" />
</p>
<form>
<?php
$benutzer = $_REQUEST['benutzer'];
$kwort = $_POST['kwort'];
print "<h3>Hallo $benutzer zum " . mycounter() ."-ten!</h3>\n";
?>
© Universität Mannheim, Rechenzentrum, 1998-2006.
Heinz Kredel Last modified: Tue Mar 14 17:00:50 CET 2006