View file blackgbs/smiles.php

File size: 2.73Kb
<?php
$title='Смайлы';
include "config.php";
include "head.php";
echo '<h4><center>
'.$title.'<br/></center></h4>';
if (!empty($id))
{
$p=$_GET['p'];
if (empty($_GET['page']))
{
$page=1;
}
else
{
$page=$_GET['page'];
}
if (empty($msg))
{
$vsego=10;
}
else
{
$vsego=$msg;
$msg='';
}
if (is_dir("./smiles") && $handle=opendir("./smiles"))
{
while (false !==($file=readdir($handle)))
{
if ($file!="." && $file!=".." && $file!="index.php")
{
$mas[]=$file;
}
}
}
$file='';
sort($mas);
$count=count($mas);
$obsum=$page*$vsego;
$nasum=$obsum-$vsego;
echo '<center>';
for ($i=$nasum; $i<$obsum; $i++)
{
if (!empty($mas[$i]))
{
$file=$mas[$i];
$ex=explode(".",$file);
$smile=$ex[0];
$trans1=array("TS","ts","JO","ZH","CH","SH","SCH","YE","JU","JA","jo","zh","ch","sh","sch","ye","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","'","y","X","x","1","2","3","4","5","6","7");
$trans2=array("Ц","ц","Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ь","ы","КС","кс",":-)",":-(",":-|",":-0",";-)","8-)",":-D");
$podpis=str_replace($trans1,$trans2,$smile); 
if ($smile==1 || $smile==2 || $smile==3 || $smile==4 || $smile==5 || $smile==6 || $smile==7)
{
echo '<img src="./smiles/'.$file.'" alt="'.$podpis.'"/><br/>';
echo $podpis.'<br/>';
}
else
{
echo '<img src="./smiles/'.$file.'" alt="'.$podpis.'"/><br/>';
echo ':'.$podpis.':<br/>';
}
}//При наличии файла
}//Цикл
echo '</center>';
$page_nav=ceil($count/$vsego);
echo '<center>Страница '.$page.' из '.$page_nav.'<br/></center>';
if ($page_nav>1)
{
echo '<center>';
if ($page==1)
{
echo '';
}
else
{
echo '<a href="?page='.($page-1).'&id='.$id.'&p='.$p.'">&lt;- Назад</a>';
}
if ($page==1 or $page_nav==$page)
{
}
else
{
echo ' | ';
}
if ($page==$page_nav)
{
echo '';
}
else
{
echo '<a href="?page='.($page+1).'&id='.$id.'&p='.$p.'">Далее -&gt;</a>';
}
echo '<br/>';
if ($page_nav>3)
{
echo '<form action="" method="get">
<input type="hidden" name="id" value="'.$id.'"/>
<input type="hidden" name="p" value="'.$p.'"/>
<select name="page">';
for($i=1;$i<$page_nav+1;$i++)
{
echo '<option value="'.$i.'"';
if ($page==$i)
{
echo ' selected="selected"';
}
echo '>'.$i.'</option>';
}
echo '</select><br/>
<input type="submit" value="Выбрать"/>
</form>';
}
echo '</center>';
}
}//Показ при наличии ид
echo '<center>
<a href="index.php?page='.$p.'&id='.$id.'">В гостевую</a></center>';
echo $end;
?>