LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2004, 11:43 PM   #1
javamdk
Member
 
Registered: Jul 2004
Location: Indiana
Distribution: Slackware 10.1, Debian
Posts: 64

Rep: Reputation: 15
Question Search page (filenames only)


Hey guys... here is my scenero so far.

I have a PHP script that has a login page -- once loged in... it connects to an FTP directory which runs in the background. This allows uploads for files... only .doc and .pdf files. I do have a delete fuction, download function, logoff, and view function. Some don't work yet lol but that's something later to work on.

ANYWAYS... these uploaded files are stored into a directory called /store. What I want is to have another PHP script 'search' in the /store dirctory. I don't think it's that hard, but then again I'm kind of new to PHP so who knows.

The search would be rather basic actually... one part could be a string search for the filename (NOT any of the body) and another search part with a drop down menu for selected searches (like look for a filename with the letters BA).

Any help on how to do this? Will this be easy, hard? Helllp

Thanks -JoeY

PS: lol if someone like wants to do this for me, i'll pay (that's pretty sad but probably would if I get tired of trying this)
 
Old 08-01-2004, 01:51 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Here is a little example for search (it is a way, it exists probably others to do the same thing)

PHP Code:
<?php
$search_string 
".pdf";
$search_dir "/store";

$dir opendir$search_dir );
while ( (
$file readdir($dir)) != false ) {
        
/*
                preg_match("/.../", ...) : search case sensitive
                preg_match("/.../i", ...) : search case insensitive
         */
        
if (preg_match("/$search_string/i"$file) ) {
            echo 
"$file matches <BR>\n";
        }
}
closedir($dir);
?>
 
Old 08-01-2004, 02:26 AM   #3
javamdk
Member
 
Registered: Jul 2004
Location: Indiana
Distribution: Slackware 10.1, Debian
Posts: 64

Original Poster
Rep: Reputation: 15
Yeah, that does work... but it's generic in a sense. I need some kind of form that will have a drop down menue that will say, "Do you wish to find", Business Administration, Math and Science, etc.

When you click on for example Business Admin... it would look for BA in the text; just defined things. Then it will hunt out all the filenames with BA and echo them out. Then when it's echoed out... I want it to have the link to the files so they can open them up.

Any ideas?

Thanks
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
search box on first index page macewan LQ Suggestions & Feedback 7 09-30-2006 01:39 AM
Next - Previous Page Buttons / Search this Thread Button JZL240I-U LQ Suggestions & Feedback 5 11-09-2005 07:40 AM
Include search criteria in results title page slackist LQ Suggestions & Feedback 3 12-10-2004 07:13 PM
Search results page header lhoff LQ Suggestions & Feedback 4 09-14-2004 09:09 AM
The new Search Results page is not as good as the old one ? qwijibow General 2 07-25-2004 03:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration