View file SNELS_News/add.php

File size: 758B
<?
include'conf.php'; 
include'head.php';
$par=$_GET['par'];

$id=$_GET['id'];

if($id=='add')
{ $novost=$_POST['new'];
$countfiles=count(glob("zap/*.dat"));
$f_name=$countfiles++;
$date=date("H:i d.m.y",time());
$open=fopen("zap/$f_name.dat","w");
fwrite($open,"$date:::::$novost");
fclose($open);
echo'<div class=news>Новость успешно добавлена.</div>';
}
else
{
if ($pass ==$par){
echo'Добавление новости:<br>
<form action="?id=add" method="post"><textarea cols=300 rows=30 name="new"></textarea><br><input type="submit" value="Сохранить"></form>';
}}; 
echo'

<div class=foot><a href="index.php">К новостям</a><br/>


<a href="../">На главную</a><br/>
'; ?>