Closed Thread
Results 1 to 5 of 5

Thread: how to check if there are any more files

  1. #1
    mlowe.space12 is offline x10Hosting Member mlowe.space12 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    4

    how to check if there are any more files

    in php how do you check if there are anymore files? i got the pagination to work but if the number of files is not a multiple of 4 then 1, 2 or 3 of the files will come up blank at the end because there are no files left. here is my code so far:

    PHP Code:
    <?php 
    if(!$_GET['start']) { 
    $start 0
    } else { 
    $start $_GET['start']; 

    $exclude_files = array(""); 
    $ifiles = Array(); 
    $handle opendir('upload/'); 
    $number_to_display '4'
    while (
    false !== ($file readdir($handle))) { 
       if (
    $file != "." && $file != ".." && !in_array($file$exclude_files)) {    
           
    $ifiles[] = $file
       } 

    closedir($handle); 

    $total_files count($ifiles); 
    $req_pages ceil($total_files/$number_to_display); 

    echo 
    "Total Ideas = "$total_files."<br><br>"


       for(
    $z=0$z<$number_to_display$z++) { 
          
    $vf $z+$start

           
    $ifiles_display explode("."$ifiles[$vf]); 
     
          echo 
    "<a href =upload/"$ifiles[$vf] . "> "
          echo 
    "$ifiles[$vf]"
          echo 
    "</a>";


    echo 
    "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br>"
    ;

    echo 
    "<a href=\"?start=0\">First</a> |"
       for(
    $x=2$x<$req_pages$x++) { ?>  
    <a href="?start=<?php echo ($x-1)*$number_to_display?>"><?php echo ($x-1); ?></a> |

    <?php ?> 
    <a href="?start=<?php echo ($x-1)*$number_to_display?>">Last</a>
    and if you want to see for your self: http://knexideas.x10.mx/ideas.php and click last
    Last edited by mlowe.space12; 10-15-2010 at 11:07 AM.

  2. #2
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: how to check if there are any more files

    I've just suspended you - image hosting scripts are against the ToS.

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  3. #3
    mlowe.space12 is offline x10Hosting Member mlowe.space12 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    4

    Re: how to check if there are any more files

    but it's for files aswell it doesn't have to be images

  4. #4
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: how to check if there are any more files

    Quote Originally Posted by mlowe.space12 View Post
    but it's for files aswell it doesn't have to be images
    Does not matter. x10 does not allow file hosting.
    * File Hosting Every file on your site must have to do with the website you put up, we are not a file storage service and we strictly prohibit scripts such as torrentflux or rapidleech.
    http://x10hosting.com/terms

  5. #5
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: how to check if there are any more files

    Quote Originally Posted by mlowe.space12 View Post
    but it's for files aswell it doesn't have to be images
    You need to reread to ToS ;)

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

Closed Thread

Similar Threads

  1. Just to check o_o
    By sparkzms in forum Free Hosting
    Replies: 1
    Last Post: 09-17-2010, 03:53 AM
  2. Check this out...
    By Scott B in forum Off Topic
    Replies: 3
    Last Post: 03-23-2008, 09:42 AM
  3. Replies: 1
    Last Post: 10-03-2007, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers