Wapbuddy

Started on the old forum in October 2008 · view the original in the archive · old links redirect here

9 replies · 498 views · started 18 years ago · 1 min read

4 participants
spicysoul Newbie · 5 posts #1
<?
$conf["items_per_page"] = 20;
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"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);
?>
<wml>
<card id="card1" title="">
<p mode="nowrap">
<do type="option" label="Home"><go href="/index.php"/></do>
<? echo "<a href=\"/best.php\">*Best STUFF*</a>
<a href=\"/index.php\">•Home•</a>

"; ?>
<?
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 "<a href=\"$file_name\">$file_name</a> (". 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 "
<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 "
Directory:
$file_count ";
if ($file_count == 1)
{echo "file";}
else
{echo "files";}
echo " (" . round($total/1024,1) . "kb)";
echo "
<a href=\"/index.php\">•Home•</a>";
echo "
<a href=\"/downloads.php\">?Downloads</a>";
echo "
<a href=\"page.php\">Pages</a>";
}
closedir($dp);
?>

</p>
</card>
</wml>
looony Developer · 95 posts #3

its a next page error buy looking at the code

External image (may be gone)

if(isset($_SESSION['username'])) { print "everybody is a little loony inside"; } else { print"You should be shot"; }

Guest #4

You will have to turn on the register_globals to make that work. Or just add this

 $page = $_GET["page"];
<?
$page = $_GET["page"];
$conf["items_per_page"] = 20;
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"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);
?>
<wml>
<card id="card1" title="">
<p mode="nowrap">
<do type="option" label="Home"><go href="/index.php"/></do>
<? echo "<a href=\"/best.php\">*Best STUFF*</a>
<a href=\"/index.php\">•Home•</a>

"; ?>
<?
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 "<a href=\"$file_name\">$file_name</a> (". 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 "
<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 "
Directory:
$file_count ";
if ($file_count == 1)
{echo "file";}
else
{echo "files";}
echo " (" . round($total/1024,1) . "kb)";
echo "
<a href=\"/index.php\">•Home•</a>";
echo "
<a href=\"/downloads.php\">?Downloads</a>";
echo "
<a href=\"page.php\">Pages</a>";
}
closedir($dp);
?>

</p>
</card>
</wml>

Try it and tell me if it works.

looony Developer · 95 posts #5

not my error i was just helping i thought i put $_GET["page"]; in but apparently i didn't

External image (may be gone)

if(isset($_SESSION['username'])) { print "everybody is a little loony inside"; } else { print"You should be shot"; }

WhiteWarrior Principal · 1,419 posts #6

QUOTE (rukiya @ Oct 20 2008, 05:45 PM) <{POST_SNAPBACK}>

You have to mention the error that you are getting.

This script is ok

Thats what i said in PM's to him/her lol

Guest #7

yeah, now the error is fixed, so its time to use it. or close the topic 🙂

Guest #9

Oooh, what a silly mistake. you are right Rukiya.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close