Tuesday, August 3, 2010

WapBuddy File dir script.

WapBuddy File dir script.

PHP Code:

$conf["items_per_page"] = 20header("Content-type: text/vnd.wap.wml");
echo 
"";
echo 
"." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
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 "*Best STUFF*
•Home•

"
?> 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 ("round(filesize($file_name)/1024,1) . "kb)
"
$total $total filesize($file_name);
}
}
if ((
$file_count 0) AND ($page != 0))
// previous button $prev_page $page -1;
echo 
"
.$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev
"
;
}
if ((
$file_count 0) AND ($last_record $file_count))
// next button $next_page $page 1;
echo 
"
.$_SERVER["PHP_SELF"]."?page=$next_page\">Next
"
;
}
echo 
"
Directory:
$file_count "
;
if (
$file_count == 1)
{echo 
"file";}
else
{echo 
"files";}
echo 
" (" round($total/1024,1) . "kb)";
echo 
"
•Home•"
;
echo 
"
?Downloads"
;
echo 
"
Pages"
;
closedir($dp); ?> 


 

No comments:

Post a Comment