File size: 763B
<?php
include "config.php";
if ($pass==$user_pass)
{
$page=$_POST['page'];
$str=$_POST['str'];
$file=file("./msg/$id.dat");
$editstr=trim($file[$str]);
$ex=explode('||',$editstr);
$name_user=trim($ex[0]);
$browser=trim($ex[1]);
$ip=trim($ex[2]);
$time=trim($ex[3]);
$msg=$_POST['msg'];
$otvet=$_POST['otvet'];
$msg=str_replace("\r\n","<br/>",$msg);
$otvet=str_replace("\r\n","<br/>",$otvet);
$buff=file_get_contents("./msg/$id.dat");
$buff =str_replace("$editstr","$name_user||$browser||$ip||$time||$msg||$otvet||",$buff);
$fileed = fopen("./msg/$id.dat","w");
fputs($fileed,"$buff");
fclose($fileed);
}
$site='http://'.$_SERVER['HTTP_HOST'].''.str_replace('postedit.php','index.php',$_SERVER['PHP_SELF']).'?id='.$id.'&page='.$page;
header ("Location: $site");
?>