Файл: posteditmes.php
Строк: 39
<?php
include 'config.php';
include 'functions.php';
$page=$_POST['page'];
$mes=$_POST['mes'];
$mes_id=mes_gaga($mes);
if (empty($mes_id)) {
echo 'Такого сообщения не существует!<br/>'; exit($end); }
if (!empty($_SESSION['rand']))
{
$_SESSION['rand']='';
$_SESSION['text']='';
$newname=stripslashes($_POST['newname']);
$newname=substr($newname,0,1500);
$newname=str_replace("rn","<br/>",$newname);
$newname=str_replace("
","<br/>",$newname);
$var='';
$file=file ('msg.dat');
$count=count($file);
for($i=0;$i<$count;$i++)
{
$ex=explode('#/#/#',$file[$i]);
if ($ex[1]==$mes)
{
$var=str_replace($ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$ex[5].'#/#/#'.$ex[6].'',$ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$ex[5].'#/#/#'.$newname,file_get_contents("msg.dat"));
$fopen=fopen("msg.dat","w");
fputs($fopen,$var);
fclose($fopen);
}
}
if (!empty($var)) {
$_SESSION['text'].='Сообщение успешно переименовано!<br/>'; } else {
$_SESSION['text'].='Сообщение не переименовано!<br/>'; }
}
header("location:index.php?page=$page");
?>