|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
How to ad alphabetical sorting to indexer script
Hi,
being a newbie to php I maintain a small download section. I just wanna drop the files to a dir and an indexer script should generate an alphabetical listing of links. I found the following script verry usefull, because it let you define the path (most other scripts just run from where they are called) and has additional infos such as time, date, number of downloads. http://www.terraserver.de/index.php3?file=download-index-counter-0.2.zip So if anyone could show me how to sort the output alphabetical, the script would be perfect :-) Friedi (friedi99@yahoo.com) |
|
#2
|
|||
|
|||
|
RE: How to ad alphabetical sorting to indexer script
|
|
#3
|
|||
|
|||
|
RE: How to ad alphabetical sorting to indexer script
Thx, but I think this referrs to sorting a SQL DB and does not work here. Here is the relevant code (I think):
Code:
function echo_links($filelisting, $number, $download_dir, $counter_dir, $phrase1, $phrase2, $PHP_SELF) // echos the links to each file
{
$number=$number-1;
@sort($filelisting); // sorts the array $filelisting
while($number>="0")
{
$file=$filelisting[$number];
$linkfile=$file; // saves the correct path to the linkfile for future use.
$file=ereg_replace( "$download_dir", '', $file ); // Strips the $download_dir from $file
$counter_file = fopen("$counter_dir$file.txt","a+"); // open download counter
rewind($counter_file);
$count = fread($counter_file, 100);
$number=$number-1; // decrements the variable $number to make the while function to end in a reasonable amount of time
echo // echo link an additional infos
"<li><font size="2" face="Arial, Helvetica, sans-serif"><b><a href="iup.php?file=$file">$file</a><i> ".date("d/m/Y G:i:s",filemtime($linkfile))."</b></font></i>";
if($count>0)
{
Friedi |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > How to ad alphabetical sorting to indexer script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|