<?php
include("../common.php");
include("common.php");
include("../include/security.php");
//============
$menu_blog = "<img src='/images/menu_this.jpg' border='0'>";
$titleHeader = $this_section;
//============
$memberID = $sys["memberID"];
if($mID){//from user proifle
	$memberID = $mID;
	$who = $user."'s ".$this_section;
}	
else
	$who = "My ".$this_section;
$nav = "<a  href='/'>$site_name home &gt;&gt;</a>  <a  href='".BLOG_PATH."'>".$this_section." &gt;&gt; </a> <a   href='".BLOG_PATH."home'>$who</a>";	
$titleHeader = $this_section;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Pragma" content="no-cache" />
<META name="description" content="<?=$_meta_des?>">
<META name="keywords" content="<?=$_meta_keyword?>">
<meta name="robots" content="follow,index">
<title><?=$titleHeader?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="<?=BLOG_PATH?>include/style.css" type="text/css">
<? include($tps."elements/meta.inc")?>
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
<script language="javascript">
var max_len = 300;
function resize(elem) {
  if (elem == undefined || elem == null) return false;
  if (elem.width > max_len) elem.width = max_len;  
}
</script>
</HEAD>
<BODY>
	<div id="wrapper"> 
    <? include($tps."elements/header.php")?>		
	 <div id="main_body2">       
      		<div id="col_l">
         	<? include("panel_more.htm")?>
	  		</div>		  
            <div id="col_r">
               <table width="100%" border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    
                    <td valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr> 
                          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr> 
                                <td height="18"> 
                                  <?=$nav?>
                                </td>
                              </tr>
                            </table></td>
                        </tr>
                        <tr> 
                          <td align="center"> 
                            <?=$msg1?>
                          </td>
                        </tr>
                        <tr> 
                          <td valign="top"> 
                            <!------- search result start ------>
                            <table width="100%" height="50"  border="0" cellpadding= "cellspacing=0">
                              <tr> 
                                <td height="30" align="middle" valign="middle"> 
                                  <?
$condStr = " where parentID='0'";
if($catID)
  $condStr .= "and catID='$catID'";
if($keyword){
	$ccc = " and (";
	$count = 0;
	$arr = split(" ",$keyword);
	for($i=0;$i<count($arr);$i++){
		$cc = $arr[$i];
		$cc = trim($cc);
		if($cc){
			if($count==0)
				$ccc .= " subject like '%$cc%' || content like '%$cc%'";
			else	
				$ccc .= " || subject like '%$cc%'  || content like '%$cc%'";
			$count++;
		}	
	}
	$ccc .= ")";
	$condStr .= $ccc;	
}
if($userID){
	$condStr .= " and userID='$userID' ";
}
if($postDate){
	$condStr .= " and postDate='$postDate' ";
}
$sortStr = "";
If($sortBy) $sortStr = " order by $sortBy"; else  $sortStr = " order by ID desc"; 	
if (!isset($step)) $step = 20;
if (!isset($from)) $from = 0;
//===========================================================================
$goto = $_REQUEST["goto"];
$count = $_REQUEST["count"];	
if($goto!=""){
	if($goto<=0) $from = 0;
	else if($goto>$count/$step)  $from = (int)(($count - 1) / $step) * $step;	
	else $from = ($step*$goto)-$step;		
}
//===========================================================================
$sql="SELECT * FROM $table_details $condStr $sortStr limit ".$from.",".$step;
$tsql = "SELECT count(ID) as total from $table_details $condStr";
$result = mysql_query($sql) or die(mysql_error());
$tquery = mysql_query($tsql) or die(mysql_error());
$trows = mysql_fetch_array($tquery);
$count = $trows['total'];
if($count == "0") echo "Your search yielded no result.<br>";
$param="count=$count&st=s&sortBy=$sortBy";	
$pageStr = pages($from,$step,$count,$param);
?>
                                  <div class="head"><?php echo $msg?> </div>
                                  <? if($count>0){?>
                                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr> 
                                      <td> 
                                        <?=search_results($from,$step,$count);?>
                                      </td>
                                      <td> <?php echo $pageStr;?> </td>
                                    </tr>
                                  </table>
                                  <? }?>
                                  <table width="100%" cellspacing="0" cellpadding="5">
                                    <?php
$str=$color='';
$swapC = "";
$c1 = 0;
 $bgcolorC = 0;
while ($i = mysql_fetch_array($result)) {
if($c1 % 2 ==0) $swapC = "";else $swapC="";
$c1++;
$ID = $i["ID"];
$subject = $i["subject"];
$user = $i["user"];$user = "Author: <a target='_blank' href='".BLOG_PATH."".urlencode($user)."'>$user</a>";
$pDate = "<font class=small>".$i["postDate"]."</font>, ";  
$hotnet = BLOG_PATH.hotnet_url($ID,$subject);
$subject = "<a class='link_title' href='$hotnet'>$subject</a>";
if($bgcolorC % 2 == 0) $bgcolor=""; else  $bgcolor=""; 	
	echo "<tr $bgcolor><td class='listing_div'>$subject <br>$user $pDate </td></tr>";
$bgcolorC++;   
}

?>
                                  </table>
                                  <? if($count>0){?>
                                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr> 
                                      <td> 
                                        <?=search_results($from,$step,$count);?>
                                      </td>
                                      <td> <?php echo $pageStr;?> </td>
                                    </tr>
                                  </table>
                                  <? }?>
                                </td>
                              </tr>
                            </table>
                            <!------- search result end ------>
                          </td>
                        </tr>
                      </table></td>
                  </tr>
                </table>
      </div>		
      <!--col_r end-->
	  <div style="clear: both;">&nbsp;</div>	
    </div>
	</div>
	 <? include($tps."elements/footer.php")?>
</body>
</html>