Hi,
habe ein nettes und nützliches PHP Prog geschreiben, leider funst es aber nicht, und ich habe keine Ahnung warum...
Hoffentlicht könnt ihr mir weiterhelfen!
Hier der Code:
Erst wird der Breich ausgewählt:
Code
<form action="auswahl.php" method="post">
<select name="bereich">
<option value="../db/ho.txt">Startseite</option>
<option value="../db/news.txt">News</option>
<option value="../db/epi.txt">Episodenguide</option>
<option value="../db/crew.txt">Crew</option>
<option value="../db/sif.txt">Schiff</option>
<option value="../db/dl.txt">Downloads</option>
<option value="../db/bd.txt">Bilder</option>
<option value="../db/anm.txt">Anmeldung</option>
<option value="../db/kon.txt">Kontakt</option>
<option value="../db/sc.txt">SiteConfig</option>
<option value="../db/imp.txt">Impressum</option>
<option value="../db/dc.txt">Disclaimer</option>
</select>
<input type="submit" value=" :enter: " />
</form>
Alles anzeigen
...dann wird die datei ausgelesen und überschrieben oder eben etwas angehängt
PHP
<?php
$path = $_POST["bereich"];
$datei = fopen("$path","r");
?>
<h1>Überschreiben</h1>
<form action="admin.php?i=w&p=<?php echo"$path"; ?>" method="post">
<textarea name="text" cols="100" rows="20">
<?php
if ($datei)
{
while (!feof($datei))
{
$inhalt = fgets($datei, 100);
echo"$inhalt";
}
fclose($datei);
}
?>
</textarea>
<input type="submit" value=" :enter: " />
</form>
<h1>Erweitern</h1>
<form action="admin.php?i=a&p=<?php echo"$path"; ?>" method="post">
<textarea name="text" cols="100" rows="20">
</textarea>
<input type="submit" value=" :enter: " />
</form>
Alles anzeigen
...und schlussendlich auch in die Datei eingetragen...
PHP
<?php
$i = $_POST["i"];
$p = $_POST["p"];
$text = $_POST["text"];
if ($i == "w")
{
$datei = fopen("$p","w");
fputs($datei,"$text");
fclose($datei);
}
if ($i == "a")
{
$datei = fopen("$p","a");
fputs($datei,"$text");
fclose($datei);
}
echo"<meta http-equiv=\"refresh\" content=\"0; URL=index.php\">
<script type=\"text/javascript\">
<!--
document.location.href = \"index.php\"
//-->
</script>
";
?>
Alles anzeigen
PS: Schreibrechte hat die Datei;-)