iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2007, 05:45 PM
WebProWorld Pro
 
Join Date: May 2004
Location: Austin, TX
Posts: 199
steve0 RepRank 0
Default looking for a search class for php

I have a basic search routine written in php I use on sites, but I was wondering if anyone
has a favorite php class or code snippett they use that can search a database,
AND employ logic operators (+, -, |) .. and maybe even quotes...
all while avoiding malicious injection :)

I can search hotscripts and the other myriad of script sites, but I would prefer
something that someone can recommend and has experience with.

Anything come to mind?
__________________
Hardcore Programming Solutions and Coffee Drinker
Reply With Quote
  #2 (permalink)  
Old 05-01-2007, 08:27 AM
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Cornwall, UK
Posts: 972
speed RepRank 1
Default

If you just want a class have a look at Zend framework which contains a port of Lucene http://framework.zend.com/manual/en/zend.search.html I've only played with it rather than using it for a real project.

MySQL 4+ has full text search capabilities which you might find satisfies your needs http://dev.mysql.com/doc/refman/5.0/...xt-search.html

If you're after a site search engine then have a look at http://cs.ioc.ee/~ando/sphider/ I did play with it a while ago but never used it in anger.

Which is best all depends on what you are trying to achieve.
Reply With Quote
  #3 (permalink)  
Old 05-04-2007, 06:27 PM
WebProWorld Member
 
Join Date: May 2006
Location: Sol System
Posts: 38
Grokodile RepRank 0
Default

Just a note to tell people to look for the use of something like...

$sql .= "and fieldname = '" . addslashes($fieldvalue) . "'";

Of course this can depend on whether or not slashes are added automatically... but if they are, then they mess up on page displays, perhaps doubling up on form redisplay, and may be stripped out anyway (if the feature isn't turned off entirely on your server).

A lot of amateur code contains almost zero protection against SQL shenanigans or field values not constrained by use of a browser form to generate GET/POST values.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:38 PM.



Search Engine Optimization by vBSEO 3.3.0