View file new/admin/add.php

File size: 1.63Kb
<?
include'../conf.php';
include'../../style/head.php';
$par=$_GET['par'];

$id=$_GET['id'];
if($id=='add')
{ $novost=$_POST['new'];
$name=$_POST['head'];
$name = str_replace("/","",$name);

$name = str_replace("`","",$name);
$name = str_replace("<","",$name);
$name = str_replace(">","",$name);
$name = str_replace("=","",$name);
$name = str_replace("
","<br>",$name);
$novost = str_replace("/","",$novost);

$novost = str_replace("`","",$novost);
$novost = str_replace("<","",$novost);
$novost = str_replace(">","",$novost);

$novost = str_replace("=","",$novost);
$novost = str_replace("
","<br>",$novost);
$countfiles=count(glob("../zap/*.dat"));
$f_name=$countfiles++;
mkdir("../komments/data/$f_name", 0777);
$date=date("d.m.y",time());
$open=fopen("../zap/$f_name.dat","w");
fwrite($open,"$date:::::$name:::::$novost");
fclose($open);
$opn=fopen("../komments/data/$f_name/0.dat","w");
fwrite($opn,"$date:::::Admin:::::$novost");
fclose($opn);
$o=fopen("../date.dat", "w");
fwrite($o,"$date");
fclose($o);
echo'<div class="f1">Новость успешно добавлена.</div>';
}
else
{
if ($pass ==$par){
echo'Добавление новости<br>
Введите заголовок: <form action="?id=add" method="post"><textarea cols=20 rows=2 name="head"></textarea><br>Введите новость: <form action="?id=add" method="post"><textarea cols=20 rows=5 name="new"></textarea><br><input type="submit" value="Сохранить"></form>';
}};
echo'
<br><a href="../index.php">К новостям</a><br/>
<a href="../../">На главную</a><br/>
'; include"../../style/foot.php"; ?>