Search Function?

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
rikardos
-


Joined: 18 Jan 2007
Posts: 3

PostPosted: Thu Jan 18, 2007 8:50 pm    Post subject: Search Function? Reply with quote

Is there any way i can add a seach function for my server?
I want to be able to seach certain folders, on my server i got /index/Music
and /index/Movies and they got sevral subfolders and i want to be able to seach all subfolders in the certain folder

Like:

If you are in /index/music you can only seach that folder and subfolders
and if you are in /index/movies you can only seach that folder and subfolder

and i dont really want to change the style on my directory listing
Back to top View user's profile Send private message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Thu Jan 18, 2007 10:09 pm    Post subject: Reply with quote

You could use scandir() in PHP. It however requires some PHP skills.

Here's a simple example code:
(Should work, didn't test it tough)
Code:
<?php

$files = scandir("/var/www/index/music");
$search = "iron maiden";

foreach ($files as $n => $file) {
  if (eregi($search, $file)) {
    echo "$n. $file<br />";
  }
}

?>


You'll have to use is_dir() if you want to include subdirs.
Back to top View user's profile Send private message
rikardos
-


Joined: 18 Jan 2007
Posts: 3

PostPosted: Thu Jan 18, 2007 11:09 pm    Post subject: Reply with quote

well.. i got no PHP skill , maby i can ask my brother, hes a programer and might be able to help me.

And maby someone got an easier and understandable finished script or something.
I managed to modify my directory listing to my likeing , so if someone got something complete i migt be able to modify it.
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 18, 2007 11:50 pm    Post subject: Reply with quote

I suggest you do a google search and look for some basic PHP tutorials. Once you know the basics of PHP you can learn other functions etc as you go along, just as I am.

I have a fairly intermediate knowledge in PHP after using it for a few years. Some people will pick it up quicker then others however.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
rikardos
-


Joined: 18 Jan 2007
Posts: 3

PostPosted: Fri Jan 19, 2007 1:28 am    Post subject: Reply with quote

I just found out that my directory listing using javascript, can i use php with javascript?

Is there a way to add a seach to that?

Is there way to make a database of all the files that the directory listing using in the certain main folders and subfolders and make it seachable?
the Abyss config got all the directorys aliases listed and some script might be able to create a seachable database that can link it to the files place on the server or at least show were it is listed.

I really like the directory listing im using and javascrip seems easier than PHP, just looking at the javascrip code and i could cuztomize the directory listing to my likeing, and i dont really want to swith it to something else.
i can post the code if i will help.

And i really like the Abyss Web Server, its easy to use and i can run it on my everyday comp ,i even liked it so much i made a nicer picture of the "Powered By Abyss Web Server" pic, and i wonder what everyone thinks(wrong category maby).... Large..Small, Use em if you want
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group