page_title= $gbl->domain . ' Search Results';
//$gbl->meta_key='';
//$gbl->meta_desc='';
//$gbl->show_ads='top';
$gbl->getHeader();
//$db->debug = 1;
//test for email injection (this is stripped down, see ns tellafriend for full)
foreach($_REQUEST as $x) {
if (preg_match("/Content-Type/i",$x)) {
exit;
}
}
$orig = $temp = $_REQUEST['dl_search'];
$temp = trim(preg_replace("/\s+/", " ", $temp));
$temp = $db->real_escape_string($temp);
$error='';
if (strlen($orig) > 50 ) {
$error .= 'Please try a shorter search phrase.
';
}
if (empty($orig) or strlen($orig) < 2 ) {
$error .= 'Your search must be at least 2 characters long.
';
}
if ( !$error ) {
// search the dictionary
$query = "select phrase,sort_by from dictionary where (phrase like '%$temp%' or definition like '%$temp%' or comments like '%$temp%') and cool>=0 order by sort_by;";
$phrase_result = $db->query($query);
$phrase_count = $db->num_rows($phrase_result);
//insert to search_log
$now = $gbl->INtime();
$query = "INSERT INTO search_log (
timestamp,
phrase,
match_count
) VALUES (
'$now',
'$temp',
'$phrase_count'
)";
$db->query($query);
}
?>
|
= $error ? "Search Results" : "Search results for: “$orig”" ?>
= '' . $error . ' ' ?> } else { ?>if ($phrase_count) { ?> = ($phrase_count==1) ? 'One Match:' : "($phrase_count) Matches:" ?>
fetch_assoc($phrase_result)) { ?>
- = $a['phrase'] ?>} else { ?> Sorry, no matches. } //endif ?> } //end if error ?> |
|