Your IP : 216.73.216.40


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

You can also perform boolean search here as<br>
<b>+property -allotment</b> searches for pages containing the word 
<b>property</b> but not <b>allotment</b>.<br>
<br>

<?php
$no = 10;
if ($q != "") {
	echo "<br><i>Search results for <u>$q</u></i>&nbsp";
	$lq = strtolower($q);
	if (!$pg) $pg = 1;
	$lstart = ($pg - 1) * $no;
	// len 3 words searched by conventional method
	if (strlen($q) == 3)
		$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from webpages 
		where lower(keywords) like '%$lq%' or lower(content) like '%$lq%' 
		or lower(title) like '%$lq%' LIMIT $lstart, $no");
	else
		$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from webpages 
		where match(keywords, title, content) against 
		('$lq' in boolean mode) LIMIT $lstart, $no");

	$tro = mysql_fetch_object(mysql_query("select FOUND_ROWS() as t"));
	$total = $tro->t;
	echo "<b>";
	if (!$total) echo "No result found.";
	else if ($total == 1) echo "1 page found.";
	else echo "$total pages found.";
	echo "</b><hr><ul>";
	while($so = mysql_fetch_object($rs)) {
		if ($so->content_type == 'static') {
			$link = "inner.php?conf=$so->id";
			$x1 = mysql_fetch_object(mysql_query("select parent_id from sublinks 
			where href='inner.php?conf=$so->id'"));
			$x2 = mysql_fetch_object(mysql_query("select * from mainlinks 
			where link_id='$x1->parent_id'"));
			echo "<li>";
			if (trim($x2->linktitle) != "") 
				echo "$x2->linktitle <img src='images/arrow.gif'> ";
			echo "<a href='$link&hilite=$q'>$so->title</a></li>";
		}
	}
	echo "</ul><hr>";
	if ($total > $no) {
		echo "<div class=notice>Pages: [ ";
		for($i=1; $i<=ceil($total/$no); $i++) {
			if ($i == $pg) echo "<b>$i</b>&nbsp;&nbsp;";
			else echo "<a href='inner.php?conf=search&q=$q&pg=$i'>$i</a>&nbsp";
		}
		echo "]</div>";
	}
}

?>