Размер файла: 2.07Kb
<?php
require('incs/ini.php');
$n=intval(@$_GET['n']);
Header('Content-Type: application/xhtml+xml;charset=utf-8');
Header('Cache-Control: no-cache, must-revalidate');
print('<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>Edit</title>
<link rel="stylesheet" type="text/css" href="style.css" /></head><body><div>');
if(!isset($_SESSION['sgb_admp'])) die('Дocтуп зaпpeщён.<hr /></div></body></html>');
require('incs/smiles.php');
$arr=file('incs/book.dat');
$post=unserialize($arr[$n]);
if(isset($_POST['nick']) && isset($_POST['text'])){
$nick=safe_var($_POST['nick']);
$text=safe_var($_POST['text'],true);
if(empty($nick) || empty($text)) die('Ошибка. <i>Не заполнено поле</i></div></body></html>');
if(isset($_POST['answ'])){
if(!empty($_POST['answ'])) $post['answ']=safe_var($_POST['answ']);
elseif(isset($post['answ'])) unset($post['answ']);
}
$text=str_replace($sstr,$simg,$text);
$text=preg_replace('!(http://[\S]+)([\s]|$)!i','<small><a href="go.php?\\1">\\1</a></small>\\2',$text);
$post['nick']=$nick;
$post['text']=$text;
$arr[$n]=serialize($post)."\n";
$f=fopen('incs/book.dat','w');
fputs($f,implode('',$arr));
fclose($f);
echo('Изменено.<hr />');
}else{
$post['text']=str_replace($simg,$sstr,$post['text']);
if(!isset($post['answ'])) $post['answ']=null;
echo('<form action="edit.php?n='.$n.'&'.SID.'" method="post"><div>
<div class="b">*Имя:</div>
<input type="text" name="nick" value="'.$post['nick'].'" maxlength="20" size="8" /><br />
<div class="b">*Сообщение:</div>
<textarea name="text" rows="3" cols="20">'.strip_tags($post['text']).'</textarea><br />
Oтвeт aдминa:<br />
<input type="text" name="answ" value="'.$post['answ'].'" /><br />
<input type="submit" value="Изменить" />
</div></form><hr />');
}
print('[<a href="index.php'.psid().'">Вернуться</a>]</div></body></html>');
?>