ok, im having problerm putting the code 4 this. it always add +1 to the input number. if i put 5 in input box, i ended up to page 6. lolz.. eventhough i already put -1 to result, doesnt make any change. can ne1 lend me a help? look for
//Go to page
<?php
$conf["items_per_page"] = 8;
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head>";
echo "<title>Test</title>";
echo "<meta http-equiv=\"cache-Control\" content=\"no-cache\" />";
echo "<meta http-equiv=\"cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"content-type\" content=\"application/vnd.wap.xhtml+xml\" />";
echo "<link rel=\"shortcut icon\" href=\"/images/favicon.ico\" type=\"image/x-icon\" />";
echo "<style type=\"text/css\">";
include ('../../../test.php');
if (!isset($page)) {$page = 0;}
$total = 0;
if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
echo "</style></head><body>";
echo "<div class=\"dir\">";
include("../../../test.php");
echo "</div>";
echo "<div>Test
";
echo '
'.($page+1).'/'.ceil($file_count/$conf["items_per_page"]).')
</div>';
echo "<div>";
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))
{
echo "$file_name
";
echo "<a href=\"$file_name\">Download (". round(filesize($file_name)/1024,1) . "kb)</a>
";
$total = $total + filesize($file_name);
}
}
{echo '</div>';
echo '<div>
';
include("../../../test.php");
echo '
';
}
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\"><<Prev</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\">Next>></a>";
}
echo "
$file_count ";
if ($file_count == 1)
{echo "File";}
else
{echo "Files";}
// Go to page
{ $page = $page - 1;
echo "
<form action=\"".$_SERVER["PHP_SELF"]."?page=$page\" method=\"get\">";
echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
echo "<input type=\"submit\" value=\"Go\"/>";
echo "</form>";
}
echo "</small /></div>";
echo '<div class="dir"><small>';
include("../../../test.php");
echo "</div>";
echo '<div class="foot">';
echo "<a href=\"/symbian/s60v1/index.php\">Test</a>";
echo "
<a href=\"../../../index.php\"><img alt=\"\" src=\"../../../images/home.gif\" />Home</a>";
echo "";
echo "</div>";
echo "</body>";
}
closedir($dp);
echo "</xhtml>";
?>
//Go to page
<?php
$conf["items_per_page"] = 8;
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head>";
echo "<title>Test</title>";
echo "<meta http-equiv=\"cache-Control\" content=\"no-cache\" />";
echo "<meta http-equiv=\"cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"content-type\" content=\"application/vnd.wap.xhtml+xml\" />";
echo "<link rel=\"shortcut icon\" href=\"/images/favicon.ico\" type=\"image/x-icon\" />";
echo "<style type=\"text/css\">";
include ('../../../test.php');
if (!isset($page)) {$page = 0;}
$total = 0;
if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
echo "</style></head><body>";
echo "<div class=\"dir\">";
include("../../../test.php");
echo "</div>";
echo "<div>Test
";
echo '
'.($page+1).'/'.ceil($file_count/$conf["items_per_page"]).')</div>';
echo "<div>";
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))
{
echo "$file_name
";
echo "<a href=\"$file_name\">Download (". round(filesize($file_name)/1024,1) . "kb)</a>
";
$total = $total + filesize($file_name);
}
}
{echo '</div>';
echo '<div>
';
include("../../../test.php");
echo '
';
}
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\"><<Prev</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\">Next>></a>";
}
echo "
$file_count ";
if ($file_count == 1)
{echo "File";}
else
{echo "Files";}
// Go to page
{ $page = $page - 1;
echo "
<form action=\"".$_SERVER["PHP_SELF"]."?page=$page\" method=\"get\">";
echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
echo "<input type=\"submit\" value=\"Go\"/>";
echo "</form>";
}
echo "</small /></div>";
echo '<div class="dir"><small>';
include("../../../test.php");
echo "</div>";
echo '<div class="foot">';
echo "<a href=\"/symbian/s60v1/index.php\">Test</a>";
echo "
<a href=\"../../../index.php\"><img alt=\"\" src=\"../../../images/home.gif\" />Home</a>";
echo "";
echo "</div>";
echo "</body>";
}
closedir($dp);
echo "</xhtml>";
?>


Comment