<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  vsem@pizdec.ru             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
                 
$text = file(BASEDIR."local/profil/$log.prof"); 
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);}                           
                                         
echo '<img src="../images/img/partners.gif" alt=""> <b>Вставка смайлов</b><br><br>';

$dir = opendir (BASEDIR."images/smiles");
while ($file = readdir ($dir)) 
{ if (ereg (".gif$", "$file"))
{$a[]=$file;}}  
closedir ($dir); 
sort($a);

$total = count($a); 
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $config_smilelist){ $end = $total; }
else {$end = $start + $config_smilelist; }
for ($i = $start; $i < $end; $i++){ 

$smkod=str_replace(".gif","",$a[$i]);

echo '<img src="'.BASEDIR.'images/smiles/'.$a[$i].'" alt="">'; 
echo '- :'.$smkod.'<br>';
}


echo'<hr>';
# постраничный вывод    
if ($start != 0) {echo '<a href="smiles.php?start='.($start - $config_smilelist).'&amp;'.SID.'">&lt;-Назад </a> ';}else{echo'&lt;-Назад ';}
echo'|'; 
if ($total > $start + $config_smilelist) {echo ' <a href="smiles.php?start='.($start + $config_smilelist).'&amp;'.SID.'"> Далее-&gt;</a>';}else{echo' Далее-&gt;';} 


$a=count($a);
$ba=ceil($a/$config_smilelist);
$ba2=floor(($a-1)/$config_smilelist)*$config_smilelist;

echo'<br><hr>Страницы:';
$asd=$start-($config_smilelist*4);
$asd2=$start+($config_smilelist*5);

if($asd<$a && $asd>0){echo ' <a href="smiles.php?start=0&amp;'.SID.'">1</a> ... ';}

for($i=$asd; $i<$asd2;)
{
if($i<$a && $i>=0){
$ii=floor(1+$i/$config_smilelist);

if ($start==$i) {
echo ' <b>'.$ii.'</b>';
               }
                else {
echo ' <a href="smiles.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
                     }}


$i=$i+$config_smilelist;}
if($asd2<$a){echo ' ... <a href="smiles.php?start='.$ba2.'&amp;'.SID.'">'.$ba.'</a>';}


echo '<br><br>Всего доступно cмайлов: '.(int)$total.'<br>';
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";
?>