/home/kkco/www/pascasarjana__2939f42/page/search.php
<?php
if (isset($_REQUEST['cari'])||$_REQUEST['page']=='search')
{

$strQuery1='';
$query='';
$text=ucwords(removechar(get_param('cari')));
ms_ew($text);
/*
if ($text!=""&&$text!="Informasi Terbaru")
{
	$sqlCountKey=mysql_query("SELECT COUNT(id) FROM search where keyword='".$text."'");
	$countKey=mysql_result($sqlCountKey, 0);
	if ($countKey<=0)
	{
	$sqlInsert=mysql_query("insert into search (date,keyword,total) values ('".time()."','".$text."','1') ");
	}
	else
	{
	$sqlInsert=mysql_query("update search set date='".time()."',total=total+1 where keyword='".$text."' ");
	}
}
*/
if ($text!='Informasi Terbaru'){
$textexplode=explode(" ",$text);
for ($i=0;$i<count($textexplode);$i++)
{

$query.=" concat(title,' ',html) like '%".$textexplode[$i]."%' and";

}

$strQuery1.=str_replace("and123","",$query."123");
}
else{
$strQuery1.="";
}


$baris=10;
$hal = isset($_REQUEST['num']) ? get_param("num") : 1;
ms_i($hal);
$mulai	= $baris * ($hal-1); 

if (isset($_REQUEST['num'])&&get_param("num")!="")
{
$strQuery="order by id desc LIMIT ".$mulai.",".$baris."";	
}
else
{
$strQuery="order by id desc LIMIT ".$baris."";	
}


$sqlCount=mysql_query("SELECT COUNT(id) FROM artikel where active='1' ".($strQuery1!=""?"and ".$strQuery1:"")."");
$count=mysql_result($sqlCount, 0);


?>


<div class="panel panel-default no_radius">
<div class="panel-heading no_radius">
<?php
if ($count<=0&&$text!='Informasi Terbaru')
{
	echo "<h1>".$text."</h1>";
	echo $text.": Informasi lengkap mengenai <a href=\"\">".$text."</a> seperti Biaya Kuliah ".$text.", Waktu Kuliah ".$text.", Biaya Pendidikan ".$text.", Pendaftaran ".$text." dan informasi lainnya ".$text." tidak kami temukan. Alternatif lain anda bisa memilih yang dibawah ini:";
	
}
else if ($text=='Informasi Terbaru')
{
echo  "<h1>Program Kelas Karyawan D3 S1 S2</h1>";
echo "Berikut ini beberapa Program Kelas Karyawan untuk Program d3, S1 dan S2";
}
else
{
	echo "<h1>".($text!=""&&$count>0?$text:"Informasi Terbaru")."</h3>";
	echo $text.": Informasi lengkap mengenai <a href=\"\">".$text."</a> seperti Biaya Kuliah ".$text.", Waktu Kuliah ".$text.", Biaya Pendidikan ".$text.", Pendaftaran ".$text." dan informasi lainnya ".$text." tidak kami temukan. Alternatif lain anda bisa memilih yang dibawah ini:";
}
?>
</div>
<div class="panel-body">


    <div class="well no_radius">
<center>
<font style="font-size:20px;" class="main_category_link">UNTUK ANDA YANG SIBUK BEKERJA TAPI INGIN KULIAH D3 S1 S2 S3</font><br>
<font style="font-size:20px;" class="main_category_link">Ayo Bergabung Dengan Program Kelas Karyawan Terbaik Di Daerah Anda </font><br>
<font style="margin-bottom:5px;">Pilih Daerah Anda:</font>
</center>

<div class="row">
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/index.php?page=html&id=17" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Jakarta</a></div>
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/index.php?page=html&id=21" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Bekasi</a></div>
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/kelaskaryawan/program-kelas-karyawan-8" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Bandung</a></div>
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/kelaskaryawan/program-kelas-karyawan-9" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Yogyakarta</a></div>
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/kelaskaryawan/program-kelas-karyawan-7" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Medan</a></div>
<div class="col-sm-2" style="padding:5px;"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/kelaskaryawan/program-kelas-karyawan-31" class="btn btn-success btn-block no_radius" style="margin-bottom:5px;">Surabaya</a></div>
</div>

    
    </div>


<?php


$sql=mysql_query("select * from artikel  where active='1' ".$strQuery." ");

while($data=mysql_fetch_array($sql))
{
echo "<a class=\"results-job-title-link\" href=\"".$M_LINK_ARTIKEL."".format_str($data['title'])."-".$data['id']."\"><div class=\"well\"><img src=\"http://".$DOMAIN."/".($data['logo']!="0"&&file_exists("thumbnails/".$data['logo'].".jpg")?"thumbnails/".$data['logo']:"images/no_pic").".jpg\" width=\"170\" style=\"margin-right:10px;margin-bottom:10px; \" align=\"left\" >";
echo "<h2 class=\"main_category_link\">".$data["title"]."</h2>";
echo limit_words(strip_tags($data['html']), 20)."...";
echo "<button class=\"btn btn-see no_radius pull-right\">Lihat Selengkapnya</button>";
echo "<div class=\"clearfix\"></div></div></a>";

$idAkhir=$data['id'];
}


echo "<div>Demikianlah informasi tentang ".$text.". Semoga informasi tentang ".$text." bermanfaat.</div>";


$sqlCountPage=mysql_query("SELECT COUNT(id) FROM artikel where active='1' ".($strQuery1!=""?"and ".$strQuery1:"")." ");
$countPage=mysql_result($sqlCountPage, 0);




$page=ceil($countPage/$baris);


if ($hal<=2)
{ $awalPage=1; }
else if ($hal>2&&$page-$hal>=1)
{
$awalPage=$hal-1;
}
else if ($hal>2&&$page-$hal<1)
{
$awalPage=$page-2;
}




if ($awalPage+2<=$page)
{
$akhirPage=	$awalPage+2;
}
else if ($awalPage+2>$page)
{
$akhirPage=	$page;	
}


$getsearch="&cari=".$text;

echo "<ul class=\"pagination\">";
if ($hal>1)
{
    echo "<li><a href=\"index.php?page=search".$getsearch."&num=1\"><<</a></li>";
    echo "<li><a href=\"index.php?page=search".$getsearch."&num=".($hal-1)."\"><</a></li>";
}
for ($i=$awalPage;$i<=$akhirPage;$i++)
{
	
    echo "<li ".($i==$hal?"class=\"active\"":"")." ><a href=\"index.php?page=search".$getsearch."&num=".$i."\">".$i."</a></li>";

}
if ($hal<$page)
{

    echo "<li><a href=\"index.php?page=search".$getsearch."&num=".($hal+1)."\">></a></li>";
    echo "<li><a href=\"index.php?page=search".$getsearch."&num=".$page."\">>></a></li>";
}
echo "</ul>";

?>



</div>
</div>

<?php
}
?>