View Single Post
Old 02-16-2004, 12:41 PM   #10
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
>> ...may be a beginner with 1.8.0 and only recently promoted junior to member in this forum, I am not a novice on string literals...

Hi. It seems you have taken offense where none was intended. Please keep in mind that, if I provide code or answer questions, I do so free of charge, on my own time, to be helpful.

>> The fact remains that, when looking at the mysql_query around line 217 in search_function...

Like I said, perhaps add a line in search_function.php that removes backslashes, but only if not followed by a character that should be escaped.

<?php

$query_to_parse = "I\'m_wearing_a%white%shirt\with\sleeves!";
$query_to_parse = addslashes($query_to_parse);

$query_to_parse = str_replace('_','\_',$query_to_parse);
$query_to_parse = str_replace('%','\%',$query_to_parse);
$query_to_parse = str_replace('\"',' ',$query_to_parse);

$what_query_chars = "[^ a-z0-9\\'.\_~@#$:&\%/;,=-]+";

$query_to_parse = eregi_replace("[\][^_%'\"]"," ",preg_replace('/[\0]/is',' ',$query_to_parse));
// TMTOWTDI $query_to_parse = eregi_replace("[\]{2}"," ",$query_to_parse);

if (eregi($what_query_chars,$query_to_parse)) {
$query_to_parse = eregi_replace($what_query_chars," ",$query_to_parse);
}

echo $query_to_parse; // I\\'m\_wearing\_a\%white\%shirt with sleeves

?>

If this method does not suit your fancy, then just rework the code to something that would be a palatable solution for you.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote