Просмотр файла settings.php

Размер файла: 1.51Kb
<?
switch (@$_POST['action']) {
  case "":
form ();
    break;
  case "addlink":
$handle = fopen ("linkbase.txt","a+");
fwrite ($handle,$_POST['nlink']);
fclose($handle);
form ();
    break;

  case "savesetting":
  $code =
  '
  <?php
  $SETTING["refreshtime"]="'.$_POST['rt'].'";
  $SETTING["numframes"]="'.$_POST['nf'].'";
  ?>
  ';
  $handle = fopen("config.php","w");
  $r=fwrite ($handle,$code);
  fclose($handle);
form ();
    break;
}
    
function form()
{
echo
'
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="ru">
<title>Настройки</title>
</head>

<body>

<form method="POST" action="settings.php">
	<table border="1" width="100%">
		<tr>
			<td width="406"><input type="text" name="nlink" size="57"></td>
			<td>Добавление ссылки в базу (без последнего "/")</td>
		</tr>
	</table>
	<input type = "hidden" name = "action" value = "addlink">
<input type="submit" value="Добавить" name="go">
</form>
<hr>
<form method="POST" action="settings.php">
	<table border="1" width="100%" id="table2">
		<tr>
			<td width="407"><input type="text" name="rt" size="57"></td>
			<td>Частота обновления (в секундах)</td>
		</tr>
		<tr>
			<td width="407"><input type="text" name="nf" size="57"></td>
			<td>Количество фреймов</td>
		</tr>
	</table>
		<input type = "hidden" name = "action" value = "savesetting">
<input type="submit" value="Сохранить" name="go">
</form>
</body>
</html>
';
}
?>