Jump to content

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.