<?php
Header("Cache-control: private, no-cache");
Header("Expires: Mon, 10 Jul 2004 05:00:00 GMT");
Header("Pragma: no-cache");
include("funktionen.php");
include("variablen.php");
include("verbindung.php");
head();
?>
<form action="<?php echo basename($PHP_SELF);?>" method="POST" name="auswahl">
<table align="center" border="0">
<tr><td><select name="auswahlx">
<option>Brot</option>
<option>Wasser</option>
<option>Wein</option>
</select></td>
<td><input type="submit" name="auswahlxy" value="GO!"></td></tr></table>
<?php
/* Auswahlkriterien */
$sqlsa = "SELECT * FROM $tbname WHERE sterben='$auswwahlx' ORDER BY name";
/* dbabfrage */
$result = mysql_query($sqlsa);
if (!$result) {
die($ftab);
}
/* tabelle komplett */
$rows = mysql_num_rows($result);
if ($rows == 0) {
echo ("<center><b><i>Kein Ergebnis zu " . $auswahlx . "</i></b></center>");
} else {
?>
<table border="0" align="center"><tr><th><h1>~<?php echo $auswahlx ?>~</h1></th></tr></table>
<table border="0" align="center">
<tr><th><h2>Essen</h2></th><th><h2>Trinken</h2></th></tr>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<tr><td><h3>;<?php echo $row["essen"]; ?></h3></td><td><h3>;<?php echo $row["trinken"]; ?></h3></td></tr>
<?php
} //ende while
?>
</table>
<?php
} // ende if
?>
<h2>Eingabe:</h2>
<form action="<?php echo basename($PHP_SELF);?>" method="POST" name="Eingabeformular" onSubmit="return chkloginform()">
<table align="center">
<tr><td>Essen:</td><td><input type="text" name="iss" size="45" maxlength="25"></td></tr>
<tr><td>Trinken:</td><td><input type="text" name="trink" size="45" maxlength="100"></td></tr>
<tr><td>IssOStirb:</td><td><select name="stirb">
<option>Brot</option>
<option>Wasser</option>
<option>Wein</option>
</select></td></tr>
<tr><td> <input type="hidden" name="hiddenval" value="1"></td></tr>
<tr><td>Passwort:</td><td><input name="pass" type="password" size="15" maxlength="7"><input type="submit" name="esseneingabe" value="Eintragen"></td></tr>
</table></form>
<?php
/* pw abfrage */
if (!empty($pass)) {
$sqlpass = "SELECT * FROM passw ";
$sqlpass .= "WHERE passwt = '$pass' ";
$sqlpass .= "AND id = '$hiddenval'";
$admin = mysql_query($sqlpass) or die($fadmin);
$valadmin = mysql_num_rows($admin);
/* bei nonvalidierung */
if ((!empty($pass)) and ($valadmin == 0)) {
echo ("<center><i><b>Falsches Passwort!</b></i></center>");
exit; }
/* bei validieung Eintrag in db*/
if ($valadmin == 1) {
if ($esseneingabe == "Eintragen") {
$sqlia = "INSERT INTO $tbname (essen,trinken,sterben,)
VALUES ('$iss' , '$trink' , '$stirb')" ;
if (mysql_query($sqlia)) {
echo ("<h4>IOS eingetragen :)</h4>") ;
} else {
echo ("<center><i>irgendwas war falsch :-)" . mysql_error() . "</i></center>");
}
}
}
}
?>
<?php
foot();
?>