<?php
// ----------------------------------------- übergebene Variablen ablegen
if (PHP_VERSION < "4.1") // funktioniert nur, wenn register_globals auf on
{
if (isset($HTTP_POST_VARS['name']))
{ $name = $HTTP_POST_VARS['name']; } else $name = "";
if (isset($HTTP_POST_VARS['passwort']))
{ $passwort = $HTTP_POST_VARS['passwort']; } else $passwort = "";
if (isset($HTTP_POST_VARS['wtext']))
{ $wtext = $HTTP_POST_VARS['wtext']; } else $wtext = "";
}
else
{
if (isset($_POST['name']))
{ $name = $_POST['name']; } else $name = "";
if (isset($_POST['passwort']))
{ $passwort = $_POST['passwort']; } else $passwort = "";
if (isset($_POST['wtext']))
{ $wtext = $_POST['wtext']; } else $wtext = "";
};
$db = mysql_connect("localhost","hsg910","geheim");
if ($db == 0) die("<p>keine Verbindung zum Server!</p>");
$res = mysql_select_db("hsg910",$db);
if ($res == 0) echo ("<p>gewählte Datenbank nicht vorhanden!</p>");
$sqlBefehl = "select name from accounts where (('$name'=name) and ('$passwort'=passwort))";
$id = mysql_query($sqlBefehl,$db);
if (mysql_num_rows($id) > 0)
{
$sqlBefehl = "update wikitext set wtext='$wtext'";
$id = mysql_query($sqlBefehl,$db);
if ($id == 0) echo("<p>Update missglückt!</p>"); // DEBUG
}
else
echo "Für Änderungen müssen Sie sich authentifizieren!";
?>
<html>
<head>
<title>Mini-Wiki</title>
<meta name="author" content="mk">
<meta name="generator" content="Ulli Meybohms HTML EDITOR">
</head>
<body >
<h3>Mini-Wiki</h3>
<form name="f1" action="wikitest.php" method="POST">
<table>
<tr>
<td>Name</td>
<td><input type="text" name="name"></input></td>
</tr>
<tr>
<td>Passwort</td>
<td><input type="password" name="passwort"></input></td>
</tr>
<tr>
<td></td>
<td><textarea name="wtext" cols="60" rows="20">
<?php
$sqlBefehl = "select wtext from wikitext";
$id = mysql_query($sqlBefehl,$db);
$datensatz = mysql_fetch_row($id);
echo $datensatz[0];
?>
</textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Wiki ändern"></input></td>
</tr>
</table>
</form>
</body>
</html>
|