Просмотр файла moduls/my_link/link_my.php

Размер файла: 1.28Kb
<?php
if (is_file('moduls/my_link/cgf.php'))
include('moduls/my_link/cgf.php');
elseif (is_file('cgf.php'))
include('cgf.php');
Defined('INDEX_S_S') or die ('Доступ запрещен!!!');
if (!is_file($link_base.$_SESSION['user_login'].'.txt') || filesize($link_base.$_SESSION['user_login'].'.txt') == 0)
{
 echo '<div class="error">У вас нет активных закладок.</div>';
}
else
{
$link_file = $link_base.$_SESSION['user_login'].'.txt';

if ($_POST['link_del'] != '')
 {
  $link_arr = @file($link_file);
  $fp = fopen ($link_file, "w+");
  $link_id = 0;
  while($link_id < count($link_arr))
  {
  if (trim($link_arr[$link_id]) != trim($_POST['link_del']) && trim($link_arr[$link_id]) != '')
   {
   fwrite ($fp, $link_arr[$link_id]);
   }
  $link_id+=1;}
  fclose ($fp);
 }

 $link_arr = @file($link_file);
 $link_id = 0;
  while($link_id < count($link_arr))
  {
  $link_link = explode('|',$link_arr[$link_id]);
  echo '<div>
  <table><tr><td>
  <form action="" method="post">
  <input name="link_del" type="hidden" value="'.trim($link_arr[$link_id]).'">
  <input class="knopka" type="submit" value="Х">
  </form>
  </td><td>
  <a href="'.$link_link[1].'">'.$link_link[0].'</a>
  </td></tr></table>
  </div>';


  $link_id+=1;}

}

?>