Просмотр файла adm/rewrite.php

Размер файла: 1.36Kb
<?php
// coding by Felis

Error_Reporting(E_ALL & ~E_NOTICE);
require ("../system/core.php");
require ("../templates/header.php");
?>
<?
$password = htmlspecialchars(stripslashes($_POST[name]));
?>
<div class="head">Результат</div>
<div class="cont">
<?
// если пароль неверен
if ($_POST[password] != $passwd)
{ echo "<b>Ошибка</b>. Доступ запрещен!<br>[<a href=index.php>Повторить</a>]<br>"; }
// если пароль верный
else
// пишем выражения в базу данных
{ echo "<b>Rewrite</b>-выражение было успешно добавлено!<br><form action=\"add_exp.php\" method=\"post\"><input name=\"password\" type=\"hidden\" value=\"$_POST[password]\"><br><input type=\"submit\" value=\"Добавить еще\"></form>";
$file="../includes/exp.php";
$line="2";
$data="\$msg = str_replace('$_POST[write]','$_POST[rewrite]',\$msg);";
$array=file($file);
$open=fopen($file,"w");
while(list($num,$string)=each($array))
{ if(($num+1)==$line) fwrite($open,$data."\r\n");
fwrite($open,$string); }
fclose($open);
}
?>
<hr>
[<a href="../index.php">На главную</a>]<br>
<hr>
В базе: <i><b>
<?
$file=file("../includes/exp.php");
$count=count($file);
echo $count - 2;
?>
</b> выражений</i>
</div>
<?php require ("../templates/footer.php"); ?>