View file admin.php

File size: 1.5Kb
<?php
$wap = 'html'; // fatal
include ('ini.php');
echo '<div>Админка<br/><form action="admin.php" method="post">';
if($pass != $admin)
exit ('Пароль:<input name="pass"><br/>
<input type="submit"></form>'.$px);
echo "<input name='pass' value='$admin' type='hidden'>";
if($add)
{	mysql_qw ('INSERT INTO news SET time=?,news=?',time(),$cmd);
echo "Новость Добавленна<br/>";
fputs(fopen('last.dat','w'),rudate("d m",time()));
}
if($edit)
{	$q = mysql_qw ('SELECT * FROM news WHERE id=?',intval($edit));
$q = mysql_fetch_array ($q);
$q = $q['news'];
$text = htmlspecialchars($q);
}

if($del)
{	mysql_qw ('DELETE FROM news WHERE id=?',intval($del));
mysql_qw ('DELETE FROM comm WHERE id_news=?',intval($del));
echo 'Новость удалена<br/>';}

if($save)
{	mysql_qw ('UPDATE news SET news=? WHERE id=?',$cmd,$save);
echo 'Новость изменена<br/>';
}
if($clear)
{	mysql_qw ('TRUNCATE TABLE news');
mysql_qw ('TRUNCATE TABLE comm');
echo 'Новости очищенны<br/>';}

echo '- <a href="deliteallnews.php?pass='.$pass.'">Очистить новости</a><br/>
- <a href="index.php?pass='.$pass.'">Смотреть/Редактировать новости</a><br/>
Новость:<input name="cmd" value="'.$text.'"><br/>';
if($edit) echo "<input type='hidden' name='save' value='$edit'>";
if($edit=='' and $save=='')  echo "<input type='hidden' name='add' value='true'>";
echo '<input type="submit"></form></div>';

exit ($px);



?>