Results 1 to 3 of 3
-
28th Sep 2010, 07:34 AM #1OPMember
[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]) ? 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: 5gomu gomu no..
..flying fuck!
-
29th Sep 2010, 04:38 AM #2MemberWebsite's:
Pirateview.org Gfxs.org StarkWood.orgPHP Code:function datecmp($a, $b)
{
return ($a[1] < $b[1]) ? 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;
}
-
29th Sep 2010, 08:23 AM #3OPMember
@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]) ? 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;
}
gomu gomu no..
..flying fuck!
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
function backlink help
By Chris2k in forum Web Development AreaReplies: 13Last Post: 26th Apr 2012, 09:43 PM -
time ago function
By Chris2k in forum Web Development AreaReplies: 2Last Post: 21st Jan 2012, 05:58 AM -
[PHP] }else{ Function 3 parts
By viruz99 in forum Web Application/Script SupportReplies: 4Last Post: 17th Jan 2012, 01:33 AM -
[Help] Fix PHP function
By m1rr0z in forum Web Development AreaReplies: 0Last Post: 15th Apr 2011, 09:40 AM -
PHP Function (Link_Maker)
By litewarez in forum Webmaster ResourcesReplies: 0Last Post: 2nd Dec 2008, 01:28 AM
themaLeecher - leech and manage...
Version 4.94 released. Open older version (or...