\n";
echo "\n";
echo "
\n";
echo "".$this->title."\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "".$this->title."
\n";
}
private function pageFooter() {
echo "\n";
echo "\n";
echo "";
}
private function createFile() {
if (!file_exists($this->filename)) {
touch($this->filename);
}
}
public function showTextFile() {
$this->createFile();
$this->pageHeader();
echo "\n";
echo "Letzte Änderung: ".date ("Y-m-d H:i", filemtime($this->filename))."
\n";
echo "Dateigröße: ".filesize($this->filename)." Byte
\n";
echo "scriptFile."?action=edit\">Bearbeiten\n";
echo "
\n";
if (filesize($this->filename) > 0)
{
$fp = @fopen($this->filename, "r") or die ("Kann Datei nicht lesen.");
while($line = fgets($fp, 1024)){
echo ($line)."
";
}
fclose($fp);
}
$this->pageFooter();
}
public function showForm() {
$this->createFile();
$this->pageHeader();
echo "scriptFile."\">Anzeigen\n";
echo "";
$this->pageFooter();
}
public function saveToFile() {
file_put_contents($this->filename, $this->text);
Header("Location: $this->scriptFile");
}
}
$tef = new textFileEdit();
$tef->filename = str_replace("php", "txt", basename($_SERVER['PHP_SELF']));;
$tef->scriptFile = basename($_SERVER['PHP_SELF']);
$tef->title = str_replace(".php", "", basename($_SERVER['PHP_SELF']));
$tef->backLinkHREF = ".";
$tef->backLinkCaption = "Zurück";
$tef->cols = "150";
$tef->rows = "35";
$tef->action = $_GET['action'];
$tef->text = $_POST['text'];
switch($tef->action) {
case "":
$tef->showTextFile();
break;
case "edit":
$tef->showForm();
break;
case "save":
$tef->saveToFile();
break;
}
?>