View Single Post
Old 02-10-2004, 06:53 AM   #5
renehaentjens
Orange Mole
 
Join Date: Nov 2003
Posts: 69
Bear with me, Charter, I'm doing this with honorable intentions.

(I had to look up "TMTOWTDI", I'm not a Perl fan...)

Thanks for explaining CONTENT_TEXT. Now I wonder why anyone would want to set it on. Isn't using the DB *always* better than using a directory?

Concerning the backslash, I took a piece of the search_function code, added a line in front to simulate user input, and a line at the end to see the result of the code.

Here's the code:
<?php
$query_to_parse = addslashes('w5+6w*56[_ww5]:ww6°!w55(w66)w5w5\w6w6');


$query_to_parse = str_replace('_','\_',$query_to_parse); // avoid '_' in the query
$query_to_parse = str_replace('%','\%',$query_to_parse); // avoid '%' in the query
$query_to_parse = str_replace('\"',' ',$query_to_parse); // avoid '"' in the query
$query_to_parse = strtolower($query_to_parse); //made all lowercase

$what_query_chars = "[^w56 \'.\_~@#$:&\%/;,=-]+"; // epure chars \'._~@#$:&%/;,=-

$query_to_parse = eregi_replace($what_query_chars," ",$query_to_parse);
$query_to_parse = trim(ereg_replace(" +"," ",$query_to_parse)); // no more than 1 blank

echo htmlspecialchars($query_to_parse);
?>

Here's the output, scraped from my screen:
w5 6w 56 \_ww5 :ww6 w55 w66 w5w5\\w6w6

The backslash hasn't gone away... Shouldn't it have by now?
__________________
René Haentjens, Ghent University
renehaentjens is offline   Reply With Quote