PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old August 3rd, 2002, 05:33 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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)

Reply With Quote
  #2  
Old August 3rd, 2002, 05:57 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: How to ad alphabetical sorting to indexer script

php Code:
Original - php Code
  1.  
  2. select * FROM dbname ORDER BY fieldname ASC LIMIT 50"


add the ASC to the code for accending DSC for decending

Reply With Quote
  #3  
Old August 3rd, 2002, 07:36 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > How to ad alphabetical sorting to indexer script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway