Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/
Upload File :
Current File : /var/www/html/mmishra/mm/search.php

<?php
if (!$query) $query = 'contact';

$str = "<img src='images/search.jpg' width='30' height='20' />
Search <input type='text' id='query' name='query' size='14' value='$query' onfocus=\"clearText(this)\" onblur=\"putText(this)\">
<input type='submit' name='submit' value='SUBMIT'>
<p><b>Top 5 searches - </b> ";
$tbl = 'searches';
if (mysql_num_rows(mysql_query("select * from $tbl where webid='$webid' and keyword='$query'")))
        mysql_query("update $tbl set hits=hits+1,dateaccess=now() where webid='$webid' and keyword='$query'");
else
        mysql_query("insert into $tbl(webid,keyword,datecreation,dateaccess) values('$webid','$query',now(),now())");

$id = innerconf('search');
$rs = mysql_query("select * from $tbl where webid='$webid' order by hits desc limit 0,5");  
while ($o = mysql_fetch_object($rs)) {
        $str .= "[<a href='inner.php?conf=$id&query=$o->keyword'>$o->keyword</a>: $o->hits times]";
} 

$str .= '</p><ol>';

$tbl = 'webpages';
$rs = mysql_query("select * from $tbl where webid='$webid' and status='online' and pagecontent like '%$query%'");
while ($o = mysql_fetch_object($rs)) {
	$familytree = familytree($webid, $o->rowid);
	$content = strip_tags(htmlunsafe($o->pagecontent));
	$i = stripos($content, $query);
	$j = strripos(substr($content, 0, $i),'. ', $i);//start of line
        $content = str_replace($query, "<b>$query</b>", $content);
        $str .= "<li>$familytree<br>".str_ireplace($query, strtoupper("<b>$query</b>"), substr($content, $j, $i))."...
        <div align='right' style='font-size:x-small'>[ dated $o->datecreation, $o->hits hits ]</div></li>";
}
$str .= '</ol>';        

echo $str;

?>