View file gb_dro/edit.php

File size: 0.98Kb
<?php
/* GB By Dro http://kywap.org.ru/ */
require ('inc/sets.php');
if (isset($_GET['nom'])) { $nom = $_GET['nom']; } else { $nom = ''; }
if (isset($_GET['pass'])) { $pass = $_GET['pass']; } else { $pass = ''; }
if ($pass != $adminpass) { die('Доступ запрещён.'); }
else {
$new_nick = $_POST['new_nick'];
$new_mail = $_POST['new_mail'];
$new_site = $_POST['new_site'];
$new_date = $_POST['new_date'];
$new_mess = $_POST['new_mess'];
$new_answ = $_POST['new_answ'];

$fl = 'messages.dat';
$line = $nom;
$rep = "$new_nick|$new_mail|$new_site|$new_date|$new_mess|$new_answ";
$file = file($fl);
$count = count($file);
$fp = fopen($fl,"w");
for($i=0;$i<$count;$i++)
{
if($i!=$line-1)
{
fwrite($fp,$file[$i]);
}
else
{
fwrite($fp,$rep."\r\n");
echo "Строка ".$line." заменена.";
}
}
fclose($fp);

if($fp) { Header('Location:index.php?pass='.$pass.''); }
else { echo 'Ошибка: Строка почему-то не заменена!'; }
}
?>