<?
if($_POST['submit'])
{
$me=_pre2($_POST['mess']);
$mess=$me[1];
if(!$mess) $err .= "Введите текст сообщения<br>";

if(!$err)
	{
	mysql_query("UPDATE mess SET mess='".$mess."' WHERE ".$lok);
	echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$perr."'></HEAD></HTML>";
	exit();
	}
}


if($err) echo '<p><font color=red>'.$err.'</font></p>'; 

if($pr)
	{
	$r=mysql_query("SELECT * FROM mess WHERE ".$lok);
	$nr=mysql_num_rows($r);
	if($nr)
		{
		$rr=mysql_fetch_array($r);
		$mess=str_replace("<br>", "\n", $rr['mess']);
		?>
		<form method="post" action="<?=$per?>" >
		<textarea rows="20" cols="80" name="mess" ><?=stripslashes(htmlspecialchars_decode($mess))?></textarea>
		<br>
		<input type="submit" name="submit" class="submit" value="Изменить">
		</form>
		<?
		}
	}
?>