jaysonh77 Posted October 5, 2012 Share Posted October 5, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/269129-search-within-directory-index-page/ Share on other sites More sharing options...
Christian F. Posted October 5, 2012 Share Posted October 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269129-search-within-directory-index-page/#findComment-1383089 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.