<?php
Error_Reporting(E_ALL & ~E_NOTICE);
header("Cache-Control: no-cache");
header("Content-type:text/vnd.wap.wml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="loads" title="Видео">
<p>
<?
function trans($s)
{
$search = array ("'A'","'B'","'V'","'G'","'D'","'E'","'J'","'Z'","'I'","'Y'","'K'","'L'","'M'","'N'","'O'","'P'","'R'","'S'","'T'","'U'","'F'","'H'","'C'","'Цх'","'W'","'Сх'","'СЦХ'","'Q'","'X'","'QQ'","'Йe'","'Йу'","'Йa'","'a'","'b'","'v'","'g'","'d'","'e'","'j'","'z'","'i'","'y'","'k'","'l'","'m'","'n'","'o'","'p'","'r'","'s'","'t'","'u'","'f'","'h'","'c'","'цх'","'w'","'сх'","'сцх'","'q'","'x'","'q'","'йe'","'йу'","'йa'","'.тыт'","'.дaт'","'_'","'.гиф'","'.жпг'","'.пнг'","'.мид'","'.ммф'","'.шaв'","'.aмр'","'Mиди'","'Mмф'","'Mп3'","'Шaв'");
$replace = array ("A","Б","В","Г","Д","E","Ж","3","И","Й","K","Л","M","Н","O","П","Р","С","T","У","Ф","Х","Ц","Ч","Ш","Ш","Щ","ь","Ы","ь","Э","Ю","Я","a","б","в","г","д","e","ж","з","и","й","к","л","м","н","o","п","р","с","т","у","ф","х","ц","ч","ш","ш","щ","ь","ы","ь","э","ю","я","",""," ","","","","","","","","Midi","Mmf","Mp3","Wav");
$s = preg_replace ($search, $replace, $s);
return $s;
}
//Ниже расширения файлов которые нужно скрывать. Можешь менять на свои.
$ras1 = ".gif";
$ras2 = ".jpg";
$ras3 = ".mp3";
$ras4 = ".mid";
$ras5 = ".mmf";
$ras6 = ".wav";
$ras7 = ".3gp";
$ras8 = ".jar";
$ras9 = ".zip";
$ras10 = ".rar";
$ras11 = ".sis";
$ras11 = ".php";
/////////////////////////////////////////////////////////////////
$conf["items_per_page"] = 6; //////СКОЛЬКО ЭЛЕМЕНТОВ НА СТРАНИЦУ!
if (!isset($page)) {$page = 0;}
if (isset($p)) {$page = $p-1;}
$total = 0;
if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "..")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
?>
<?
if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];
while (list($fileIndexValue, $file_name) = each ($file_array))
{
if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{
////////////////////////////////////////
//Тут происходит удаление расширений.
$file1 = $file_name;
$file1 = str_replace("$ras1","",$file1);
$file1 = str_replace("$ras2","",$file1);
$file1 = str_replace("$ras3","",$file1);
$file1 = str_replace("$ras4","",$file1);
$file1 = str_replace("$ras5","",$file1);
$file1 = str_replace("$ras6","",$file1);
$file1 = str_replace("$ras7","",$file1);
$file1 = str_replace("$ras8","",$file1);
$file1 = str_replace("$ras9","",$file1);
$file1 = str_replace("$ras10","",$file1);
$file1 = str_replace("$ras11","",$file1);
$file1 = str_replace("$ras12","",$file1);
$file1 = trans($file1);//ретранслит
/////////////////////////////////////////
echo "• <a href=\"$file_name\">$file1</a> (". round(filesize($file_name)/1024,1) . "kb)<br/>";
$total = $total + filesize($file_name);
}
}
echo"________<br/>";
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\"><<<</a>||";
}
if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">>>></a><br/>";
}
$pages1 = ($file_count/$conf["items_per_page"])+1;
$pages=strtok($pages1,'.');
$pg=$page+1;
echo "<br/>Страница: $pg/$pages<br/>
Всего фалов: $file_count<br/>";
echo "Страница:<br/>";
print "<input name=\"p\" format=\"*N\" size=\"3\"/>";
echo "<br/><a href=\"index.php?page=$(p)&p=$(p)\">Перейти</a>
<br/><br/><a href=\"../\">Назад</a>";
}
closedir($dp);
?>
</p></card></wml>