Activity Stream
48,167 MEMBERS
61021 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3
  1.     
    #1
    Member

    Lightbulb [php] list_files() function

    i'm noob and sorry if this is a noob question. i wanna recode this so they'll only result one link and the latest one.

    can't any hero wanna help me bout this? i'll very appreciate and sorry for my english. this code from leechviet.

    PHP Code: 
        function datecmp($a$b)
        {
            return (
    $a[1] < $b[1]) ? 0;
        }
        function 
    list_files()
        {
            
    $files = array();
            foreach (
    $this->jobs as $job)
            {
                if (
    $job['owner']!=$this->owner && !$this->bypass)
                {
                    continue;
                }
                
    $files[] = array($job['hash'], $job['mtime'], $job['filename'], $job['msize'], $job['speed']/1024, empty($job['size']) ? 'N/A' sprintf('%.1f%%'$job['msize']/$job['size']*100), $job['size'], $job['type']);
            }
            
    usort($files, array($this'datecmp')); //sorting the newest to oldest links
            
    $scheme "<center><b><a href='?d=%s'>%s</a></b></center>";
                    
    $this->CheckMBIP();
            
    $data "";
                    
    $data .= "<center><b>Your downloads: </b></center>";            
            foreach (
    $files as $file)
            {
                if (
    $file[7] == 'remote')
                {
                    
    $data .= sprintf($scheme$file[0], $file[2]);
                }
            }
            
    $data .= "";
            echo 
    $data;
        } 
    natsu90 Reviewed by natsu90 on . [php] list_files() function i'm noob and sorry if this is a noob question. i wanna recode this so they'll only result one link and the latest one. can't any hero wanna help me bout this? i'll very appreciate and sorry for my english. this code from leechviet. function datecmp($a, $b) { return ($a < $b) ? 1 : 0; } function list_files() { Rating: 5
    gomu gomu no..

    ..flying fuck!

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    Pirateview.org Gfxs.org StarkWood.org
    PHP Code: 
    function datecmp($a$b)
        {
            return (
    $a[1] < $b[1]) ? 0;
        }
        function 
    list_files()
        {
            
    $files = array();
            foreach (
    $this->jobs as $job)
            {
                if (
    $job['owner']!=$this->owner && !$this->bypass)
                {
                    continue;
                }
                
    $files[] = array($job['hash'], $job['mtime'], $job['filename'], $job['msize'], $job['speed']/1024, empty($job['size']) ? 'N/A' sprintf('%.1f%%'$job['msize']/$job['size']*100), $job['size'], $job['type']);
            }
            
    usort($files, array($this'datecmp')); //sorting the newest to oldest links
            
    $scheme "<center><b><a href='?d=%s'>%s</a></b></center>";
                    
    $this->CheckMBIP();
            
    $data "";
                    
    $data .= "<center><b>Your downloads: </b></center>";            
            
    $count count($files);
            
    $count--;
            
            foreach (
    $files[$count] as $file)
            {
                if (
    $file[7] == 'remote')
                {
                    
    $data .= sprintf($scheme$file[0], $file[2]);
                }
            }
            
    $data .= "";
            echo 
    $data;
        } 

  4.     
    #3
    Member
    @nuclea
    that didnt work either but thanks for your reply. really appreaciate that. somehow i've got it work. using current() function.

    PHP Code: 
        function datecmp($a$b)
        {
            return (
    $a[1] < $b[1]) ? 0;
        }
        function 
    list_files()
        {
            
    $files = array();
            foreach (
    $this->jobs as $job)
            {
                if (
    $job['owner']!=$this->owner && !$this->bypass)
                {
                    continue;
                }
                
    $files[] = array($job['hash'], $job['mtime'], $job['filename'], $job['msize'], $job['speed']/1024, empty($job['size']) ? 'N/A' sprintf('%.1f%%'$job['msize']/$job['size']*100), $job['size'], $job['type']);
            }
            
    usort($files, array($this'datecmp')); //sorting the newest to oldest links
            
    $scheme "<center><b><a href='?d=%s'>%s</a></b></center>";
                    
    $this->CheckMBIP();
            
    $data "";
                    
    $data .= "<center><b>Your downloads: </b></center>";            
            
    $files=array(current($files)); //return current value
            
    foreach ($files as $file)
            {
                if (
    $file[7] == 'remote')
                {
                    
    $data .= sprintf($scheme$file[0], $file[2]);
                }
            }
            
    $data .= "";
            echo 
    $data;
        } 
    thanks again. solved.
    gomu gomu no..

    ..flying fuck!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. function backlink help
    By Chris2k in forum Web Development Area
    Replies: 13
    Last Post: 26th Apr 2012, 09:43 PM
  2. time ago function
    By Chris2k in forum Web Development Area
    Replies: 2
    Last Post: 21st Jan 2012, 05:58 AM
  3. [PHP] }else{ Function 3 parts
    By viruz99 in forum Web Application/Script Support
    Replies: 4
    Last Post: 17th Jan 2012, 01:33 AM
  4. [Help] Fix PHP function
    By m1rr0z in forum Web Development Area
    Replies: 0
    Last Post: 15th Apr 2011, 09:40 AM
  5. PHP Function (Link_Maker)
    By litewarez in forum Webmaster Resources
    Replies: 0
    Last Post: 2nd Dec 2008, 01:28 AM

Tags for this Thread

BE SOCIAL