Jump to content

Search Within Directory Index Page?


jaysonh77

Recommended Posts

Hello,

 

I am running Apache2 on MAC OSX 10.5 Server. I am using a directory index page to list all this folders and pdf's that I have. How can I create a search field so people can search for pdf's, documents..etc..instead of having to go through every folder, subfolders... on the directory listing page?

 

Someone mentioned using PHP but I really have no clue on how to do that or if this is even possible.

 

Hope someone can help me out.

 

Thank you,

Jay

Link to comment
https://forums.phpfreaks.com/topic/269129-search-within-directory-index-page/
Share on other sites

This isn't really an Apache question, but more of an "Application Design" question.

 

Anyway, a very simple way of making this work is by using exec () and the Linux find or locate command. Though, using either of these it is imperative that you both:

  • Validate the input, to make sure that the input strings conform to what is legal for filenames.
  • Escape the output, via escapeshellarg (), so that you ensure that no accidental (or malicious) commands are executed on the server.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.