View file guest/smile.php

File size: 1.7Kb
<?php
header ("Content-type: text/html; charset=utf-8");
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css.txt\">
<title>Смайлы</title>
</head>
<body>";
print '<div class="in"><b>Смайлы</b></div>';
print '<div class="out"></div>';


$smile_arr=scandir('./smile');
$smile_arr[1]=natsort($smile_arr);
$fr=array();

foreach($smile_arr as $key => $value)
{
if(preg_match("/[gif]+$/",$value))array_push($fr,$value);
}

  if(empty($_GET['page']))$_GET['page']=1;$page=$_GET['page'];


$all=sizeof($fr);
$num_pages=ceil($all/5);
  if($page<1)$page=1;
  if($page>$num_pages)$page=$num_pages;
$start = (($page -1)*5);
$end = ($page*5);

  if($all){
  for($i = $start; $i < $end; $i++)
{
  if(empty($fr[$i]))continue;
  print '<div class="messin">';
  print ('<b>'.':'.($i+1).':'."</b><img src=\"smile/$fr[$i]\" alt=\"smile\">".'<br>');
  print '</div>';
}





  print '<div class="messin">';

  for($pr = '', $i =1; $i <= $num_pages; $i++)
    {
  echo $pr=(($i == 1 || $i == $num_pages || abs($i-$page) < 2) ? ($i == $page ? " [$i] " : ' <a href="'. $_SERVER['SCRIPT_NAME']
.'?page='.$i.'">'.$i.'</a> ') : (($pr == ' ... ' || $pr == '')? '' : ' ... '));
    }

   print '</div>';
}

 else
{
  print '<div class="messin">';
  echo 'смайлов нет';
    print '</div>';
}




print '<div class="messin">';
 print '<a href="./addmess.php">назад</a><br>';
print '</div>';



print '<div class="out"></div>';
print '<div class="in"><b>&#169; wapt</b></div>';
print '</body></html>';
?>