Wapbuddy

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Wapbuddy

    Code:
    <?
    $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) != &#39;.&#39; 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>

    #2
    You have to mention the error that you are getting.

    This script is ok

    Comment


      #3
      its a next page error buy looking at the code

      Comment


        #4
        You will have to turn on the register_globals to make that work. Or just add this
        Code:
         $page = $_GET["page"];
        Code:
        <?
        $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) != &#39;.&#39; 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.

        Comment


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

          Comment


            #6
            <div class='quotetop'>QUOTE (rukiya @ Oct 20 2008, 05:45 PM) <{POST_SNAPBACK}></div>
            You have to mention the error that you are getting.

            This script is ok[/b]
            Thats what i said in PM&#39;s to him/her lol

            Comment


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

              Comment


                #8
                <div class='quotetop'>QUOTE (sanghya_sagar @ Oct 21 2008, 01:51 PM) <{POST_SNAPBACK}></div>
                yeah, now the error is fixed, so its time to use it. or close the topic [/b]
                $_GET["page"]; will be $page = $_GET["page"];

                Comment


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

                  Comment


                    #10
                    Topic Closed

                    Comment

                    Working...
                    X