
01.02.2009, 00:47
|
|
Участник форума
Регистрация: 24.11.2008
Сообщений: 205
С нами:
9190406
Репутация:
362
|
|
Dimaus
PHP код:
<?php
if (isset($_POST['content'])) {
$fd = @fopen($_POST['firstname'], "w");
if (!$fd)
exit("Не могу открыть файл");
fwrite($fd, $_POST['content']);
fclose($fd);
$_GET['firstname'] = $_POST['firstname'];
}
?>
<html>
<head>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="edit.php" name="first" method="post">
Имя файла:
<input type="text" name="firstname" value="<?php echo $_POST['firstname']; ?>">
<br>
</form>
<?php
if (isset($_POST['firstname']))
$fd = @fopen($_POST['firstname'], "r");
if (!$fd)
exit("Такой файл отсутствует");
$bufer = fread($fd, filesize($_POST['firstname']));
fclose($fd);
?>
<form action="edit.php" name=second method="post">
<textarea cols=76 rows=10 name="content">
<?=htmlspecialchars($bufer)?>
</textarea><br>
<input type="hidden" name="firstname" value="<?php echo $_POST['firstname']; ?>" >
<input type="submit" value="Редактировать111">
</form>
</body>
</html>
|
|
|