Просмотр файла str/adm/del_str.php

Размер файла: 1.68Kb
<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен!!!');
if ($_POST[pokaz]!=1)
{

// Запуск  генератора
$fp = fopen ("str/adm/counter", "r");
$bytes = filesize("str/adm/counter");
$buffer = fread($fp, $bytes);
fclose ($fp);
$count = explode("|", $buffer);
echo "<form name='red' action='$_SERVER[self]' method='post'>";
echo "<input name='pokaz' type='hidden' value='1'>";
echo "<input name='id' type='hidden' value='del_str'>";
echo '<select size="1" name="id3">';
$i=0;
while ($count[$i] != "")
{
echo "<option value='$count[$i]'>$count[$i]</option>";
$i++;
}
echo '</select>&nbsp;&nbsp;';
echo '<input type="submit" value="Перейти">';
echo '</form>';

}
else
{
   if ("$_POST[id3].php" != "$glav")
   {

   include("str/$_POST[id3].php");

$fp = fopen ("str/adm/counter", "r");
$bytes = filesize("str/adm/counter");
$buffer = fread($fp, $bytes);
$buffer = str_replace("|$_POST[id3]","",$buffer);
fclose ($fp);
 $fp = fopen ("str/adm/counter", "w+");
fwrite($fp,$buffer);
fclose ($fp);

$fp = fopen ("str/adm/counter2","r");
$buffer2 = fread ($fp,filesize("str/adm/counter2"));
$buffer2 = $buffer2-1;
fclose ($fp);
$fp = fopen ("str/adm/counter2","w+");
fwrite($fp,$buffer2);
fclose($fp);


$fp = fopen ("sts/menu.php","r");
$buffer3 = fread ($fp,filesize("sts/menu.php"));
$buffer3 = str_replace("<li><a href=\"/?pg=$_POST[id3].php\">$title_s</a></li>","",$buffer3);
fclose ($fp);
$fp = fopen ("sts/menu.php","w+");
fwrite($fp,$buffer3);
fclose($fp);

unlink ("str/$_POST[id3].php");
echo 'Успешно<br/><a href="/admin.php?int=str/adm/ind.php">Далее</a>';

    }
    else
    {
    echo  'Главную страницу удалить нельзя!';
    	};

};





?>