Просмотр файла chat_smiles.php

Размер файла: 2.39Kb
<?php
if (!strpos($_SERVER['SCRIPT_NAME'],substr(session_id(),(strlen(session_id())/2),strlen(session_id())).session_id().substr(session_id(),0,(strlen(session_id())/2)).'/index.php'))
    {
     header('location: http://'.$_SERVER['SERVER_NAME'].'/'); exit();
    }
if (empty($target['2'])){$from = 0;}
if (!is_numeric($target['2'])){$from = 0;}
if ($target['2'] >= 0 && $target['2'] <= $_SESSION['t_pages']){$from = intval($target['2']);}
if ($target['2'] < 0 || $target['2'] > $_SESSION['t_pages']){$from = 0;}
$from = trim(addslashes(htmlspecialchars($from)));
require_once(rootpath.'smile.php');
$total_links = count($smiles)-1;
$total_pages = ceil($total_links / 10); $_SESSION['t_pages'] = $total_pages; session_register('t_pages');
$cls->a_header('Список смайлов');
if ($total_links == '0') {$cls->write('<div class="d0">Смайлов нет</div>');}
else{
$cls->write('<div class="d1">Смайлы<br/>'.$total_links.' шт.</div>');
for ($i = $from*10; $i <= ($from*10+10)-1; $i++)
     {
      if (!empty($smiles[$i]) || !empty($replaces[$i]))
          {$cls->write('<div class="d0">'.++$a.')'.$smiles[$i].' - '.$replaces[$i].'</div>');}
     }
if ($total_pages > 3 && $from > 1)
    {
     $cls->write('<a href="?'.$_SESSION['re'].'/'.$_SESSION['re16'].'/0&amp;'.SID.'">&lt;-0</a>,');
    }
     if ($from != '0' && $total_pages != '0')
         {
          $cls->write('<a href="?'.$_SESSION['re'].'/'.$_SESSION['re16'].'/'.($from-1).'&amp;'.SID.'">&lt;'.($from-1).'</a>,');
         }
          if ($total_links > $num_msgs)
              {
               echo $from;
              }
               if (($from+1) != $total_pages && $total_pages != '0')
                   {
                    $cls->write(',<a href="?'.$_SESSION['re'].'/'.$_SESSION['re16'].'/'.($from+1).'&amp;'.SID.'">'.($from+1).'&gt;</a>');
                   }
               if ($total_pages > 3 && $from < $total_pages-2)
                   {
                   	$cls->write(',<a href="?'.$_SESSION['re'].'/'.$_SESSION['re16'].'/'.($total_pages-1).'&amp;'.SID.'">'.($total_pages-1).'-&gt;</a>');
                   }
}
$pagesize = round((ob_get_length()+500)/1024,1);
require_once(rootpath.'trafic.php');
$end = gettime();
$cls->write('<div class="foot"><a href="?'.SID.'">В прихожую</a>['.round(($end - $mystart), 5).']</div>');
$cls->a_footer();
ob_end_flush();
@mysql_close();
?>