Размер файла: 1.72Kb
<?php
require('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('smiles.ini.php');
$arr=file('book.dat');
$sa=explode('|:|',$arr[$n]);
if(isset($_POST['nick']) && isset($_POST['text'])){
$nick=safe_var($_POST['nick']);
$text=safe_var($_POST['text'],true);
if($nick=='' || $text=='') die('Ошибка. <i>Не заполнено поле</i></div></body></html>');
$text=str_replace($sstr,$simg,$text);
$text=preg_replace('!(http://[\S]+)([\s]|$)!i','<small><a href="go.php?\\1">\\1</a></small>\\2',$text);
$sa[0]=$nick;
$sa[1]=$text;
$arr[$n]=implode('|:|',$sa);
$f=fopen('book.dat','w');
$d=implode('',$arr);
fputs($f,$d);
fclose($f);
echo('Изменено.<hr />');
}else{
$sa[1]=str_replace($simg,$sstr,$sa[1]);
echo '<form action="edit.php?n='.$n.'&'.SID.'" method="post"><div>
<div class="b">Имя:</div>
<input type="text" name="nick" value="'.$sa[0].'" maxlength="20" size="8" /><br />
<div class="b">Сообщение:</div>
<textarea name="text" rows="3" cols="20">'.strip_tags($sa[1]).'</textarea><br />
<input type="submit" value="Изменить" />
</div></form><hr />';
}
print('[<a href="index.php'.psid().'">Вернуться</a>]</div></body></html>');
?>