View file wapt_gall/wapt_gall/photo.php

File size: 5.71Kb
<?php
error_reporting(0);
if(!isset($_GET['ver']) || empty($_GET['ver'])) $ver='wml';
else $ver=$_GET['ver'];	
switch($ver)
{
// wml version	
case 'wml':
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.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">';
echo '<wml><card id="start" title="wapt"><p align="left">';
echo "<do type=\"prev\" label=\"Назад\"><prev/></do><br/>\n";
echo "эротика<br/>\n";//название раздела
///////////////////////////
//$scan_arr=scandir(".");
//$finish_arr=array(); 
//foreach($scan_arr as $key => $value){if($value == '.' || $value == '..' || $value == 'index.php' || $value == 'image.php' || $value == 'photo.php' || $value == 'adjustment.php')
//{continue;}array_push($finish_arr,$value);}
///////////////////////////
$dir_p=opendir(".");
$finish_arr=array(); 
while($value=readdir($dir_p)){
if($value == '.' || $value == '..' || $value == 'index.php' || $value == 'image.php' || $value == 'photo.php' || $value == 'adjustment.php'){continue;}	
array_push($finish_arr,$value);}
///////////////////////////
$w=$_GET['w'];
$h=$_GET['h'];
$new_size=($w+$h)/2;
$q=$_GET['q'];
$pp=$_GET['pp'];
$k_v=$_GET['k_v'];
$kolvo_f=count($finish_arr);
if($kolvo_f==0){echo "файлов нет...<br/>\n";echo '&#169; wapt';
echo '</p></card></wml>';die();}
$str=ceil($kolvo_f/$k_v);
if(isset($_GET['page'])) $page = $_GET['page'];
if(!isset($_GET['page']))$page=1;
if($page<1 || $page>$str){die('упссс...');}
echo "<small><a href=\"photo.php?page=$page&amp;ver=html&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">html</a> | wml</small><br/>\n";	
$start = (($page - 1)*$k_v);
$end = $page*$k_v;
for($i = $start; $i < $end; $i++){
if(empty($finish_arr[$i]))continue;
if ($pp <> 0){echo "<img src=\"image.php?file_name=$finish_arr[$i]&amp;new_size=$pp&amp;q=20\" alt=\"img\"/><br/>\n";}
echo 'pic_'.($i+1)."<br/>\n";
echo "<a href=\"image.php?new_size=$new_size&amp;q=$q&amp;file_name=$finish_arr[$i]\">скачать</a><br/>\n";
}
echo "страниц:".$str."<br/>\n";
echo "файлов:".$kolvo_f."<br/>\n";
if($page==1){
echo "1";
echo "<a href=\"photo.php?page=2&amp;ver=wml&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">&gt;2</a><br/>\n";}
elseif($page==$str){
$str-=1;
echo "<a href=\"photo.php?page=$str&amp;ver=wml&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">$str&lt;</a>";
echo $str+1 ."<br/>\n";}
else{
$page-=1;	
echo "<a href=\"photo.php?page=$page&amp;ver=wml&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">$page&lt;</a>";
echo $page+=1;
$page+=1;
echo "<a href=\"photo.php?page=$page&amp;ver=wml&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">&gt;$page</a><br/>\n";	
}
echo '&#169; wapt';
echo '</p></card></wml>';
break;
// html version
case 'html':
header("Content-Type: text/html; charset=utf-8");
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>wapt</title></head><body link="#000080" vlink="#FF0000" alink="#00FF00">';
echo '<table  width="100%" align="center" bgcolor="#00FFFF" border="1"><tr><td height="30">
</td></tr></table>';
echo "<big>эротика</big><br/>\n";//название раздела
///////////////////////////
//$scan_arr=scandir(".");
//$finish_arr=array(); 
//foreach($scan_arr as $key => $value){if($value == '.' || $value == '..' || $value == 'index.php' || $value == 'image.php' || $value == 'photo.php' || $value == 'adjustment.php')
//{continue;}array_push($finish_arr,$value);}
///////////////////////////
$dir_p=opendir(".");
$finish_arr=array(); 
while($value=readdir($dir_p)){
if($value == '.' || $value == '..' || $value == 'index.php' || $value == 'image.php' || $value == 'photo.php' || $value == 'adjustment.php'){continue;}	
array_push($finish_arr,$value);}
///////////////////////////
$w=$_GET['w'];
$h=$_GET['h'];
$new_size=($w+$h)/2;
$q=$_GET['q'];
$pp=$_GET['pp'];
$k_v=$_GET['k_v'];
$kolvo_f=count($finish_arr);
if($kolvo_f==0){echo "файлов нет...<br/>\n";echo '<table  width="100%" align="center" bgcolor="#00FFFF" border="1"><tr><td height="30">
&#169; wapt</td></tr></table>';
echo '</body></html>';die();}
$str=ceil($kolvo_f/$k_v);
if(isset($_GET['page'])) $page = $_GET['page'];
if(!isset($_GET['page']))$page=1;
if($page<1 || $page>$str){die('упссс...');}	
echo "<hr><a href=\"photo.php?page=$page&amp;ver=wml&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">wml</a> | html<br/><hr>\n";	
$start = (($page - 1)*$k_v);
$end = $page*$k_v;
for($i = $start; $i < $end; $i++){
if(empty($finish_arr[$i]))continue;
if ($pp <> 0){echo "<img src=\"image.php?file_name=$finish_arr[$i]&new_size=$pp&q=20\" alt=\"img\"/><br/>\n";}
echo 'pic_'.($i+1).'<br/>';
echo "<a href=\"image.php?new_size=$new_size&q=$q&file_name=$finish_arr[$i]\">скачать</a><br/><hr>\n";
}
echo "страниц:".ceil($str)."<br/>\n";
echo "файлов:".$kolvo_f."<br/>\n";
if($page==1){
echo "1";
echo "<a href=\"photo.php?page=2&amp;ver=html&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">&gt;2</a><br/>\n";}
elseif($page==$str){
$str-=1;
echo "<a href=\"photo.php?page=$str&amp;ver=html&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">$str&lt;</a>";
echo $str+1 ."<br/>\n";}
else{
$page-=1;	
echo "<a href=\"photo.php?page=$page&amp;ver=html&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">$page&lt;</a>";
echo $page+=1;
$page+=1;
echo "<a href=\"photo.php?page=$page&amp;ver=html&amp;w=$w&amp;h=$h&amp;q=$q&amp;pp=$pp&amp;k_v=$k_v\">&gt;$page</a><br/>\n";	
}
echo '<table  width="100%" align="center" bgcolor="#00FFFF" border="1"><tr><td height="30">
&#169; wapt</td></tr></table>';
echo '</body></html>';
break;
}
?>