📄 products.php
字号:
<?
include_once "myconnect.php";
include_once "date_time_format.php";
function main()
{
$config=mysql_fetch_array(mysql_query("select * from sbbleads_config"));
$recperpage=$config["sb_recperpage"];
$strpass="";
if(($config["sb_image_magik"]=="enable"))
{
$img_path="thumbs1/";
$img_pmt="";
}
else
{
$img_path="uploadedimages/";
$img_pmt="width=".$config["sb_th_width"]." height=".$config["sb_th_width"];
}
$cid=0;
$keyword="";
$searchkeyword="";
$gdate="";
$gdate1="";
if(isset($_REQUEST["show_save"]) && ($_REQUEST["show_save"]=='yes') )
$strpass.="&show_save=".$_REQUEST["show_save"];
if(isset($_REQUEST["cid"])&&($_REQUEST["cid"]<>""))
{
$cid=$_REQUEST["cid"];
$sbqu_off="update sbbleads_categories set sb_visit_product=sb_visit_product+1 where sb_id=$cid";
mysql_query($sbqu_off);
}
$strpass.="&cid=".$cid;
if(isset($_REQUEST["keyword"])&&($_REQUEST["keyword"]<>""))
{
$keyword=$_REQUEST["keyword"];
$strpass.="&keyword=".$_REQUEST["keyword"];
if (!get_magic_quotes_gpc())
{
$searchkeyword=str_replace('$', '\$',addslashes($_REQUEST["keyword"]));
}
else
{
$searchkeyword=str_replace('$', '\$',$_REQUEST["keyword"]);
}
$searchkeyword=trim($searchkeyword);
}
if(isset($_REQUEST["country"])&&($_REQUEST["country"]<>""))
{
$strpass.="&country=".$_REQUEST["country"];
}
if(isset($_REQUEST["month"]) && isset($_REQUEST["day"])&& isset($_REQUEST["year"]) &&($_REQUEST["month"]<>0)&&($_REQUEST["day"]<>0)&&($_REQUEST["year"]<>0))
{
$strpass=$strpass . "&month=" . $_REQUEST["month"];
$strpass=$strpass . "&day=" . $_REQUEST["day"];
$strpass=$strpass . "&year=" . $_REQUEST["year"];
$month=$_REQUEST["month"];
$day=$_REQUEST["day"];
if($_REQUEST["month"]<10)
{
$month="0".$_REQUEST["month"];
}
if($_REQUEST["day"]<10)
{
$day="0".$_REQUEST["day"];
}
$gdate=$_REQUEST["year"].$month.$day."235959";
}
if(isset($_REQUEST["month1"]) && isset($_REQUEST["day1"])&& isset($_REQUEST["year1"]) && ($_REQUEST["month1"]<>0)&&($_REQUEST["day1"]<>0)&&($_REQUEST["year1"]<>0))
{
$strpass=$strpass . "&month1=" . $_REQUEST["month1"];
$strpass=$strpass . "&day1=" . $_REQUEST["day1"];
$strpass=$strpass . "&year1=" . $_REQUEST["year1"];
$month1=$_REQUEST["month1"];
$day1=$_REQUEST["day1"];
if($_REQUEST["month1"]<10)
{
$month1="0".$_REQUEST["month1"];
}
if($_REQUEST["day1"]<10)
{
$day1="0".$_REQUEST["day1"];
}
$gdate1=$_REQUEST["year1"].$month1.$day1."000000";
}
$catname="";
$category=0;
$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $cid );
if ($cat=mysql_fetch_array($cat_query))
{
$catname=$cat["sb_cat_name"];
$category=$cat["sb_id"];
}
$catpath="";
$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $cid );
while ($rs=mysql_fetch_array($cat_query))
{
$catpath =" > <a href=\"cat_products.php?cid=" . $rs["sb_id"] . "\">" .$rs["sb_cat_name"]."</a>".$catpath;
$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $rs["sb_pid"] );
}
$sql="select *,UNIX_TIMESTAMP(sb_postedon) as ondate from sbbleads_products where sb_approved='yes' ";
//==============multicat code===============================
$rst1_query=mysql_query("Select * from sbbleads_categories where sb_pid=" . $cid );
$clist=$cid;
while ( $rst1=mysql_fetch_array($rst1_query) )
{
$clist.="," . $rst1["sb_id"];
while ( $rst1=mysql_fetch_array($rst1_query) )
{
$clist.="," . $rst1["sb_id"];
}
$rst1_query=mysql_query("Select * from sbbleads_categories where
sb_pid IN (" . $clist . ") and sb_id not in ( ". $clist . ")") ;
}
$id_list=-1;
$cat_offers_query=mysql_query("select * from sbbleads_product_cats where sb_cid in ($clist)");
while($cat_offers=mysql_fetch_array($cat_offers_query))
{ $id_list.=",".$cat_offers["sb_offer_id"];}
$sql.=" and sb_id in ($id_list)";
//============================================================
//===================keyword search===========================
if($searchkeyword<>"")
{
if(isset($_REQUEST["search_method"])&&(($_REQUEST["search_method"]==2)||($_REQUEST["search_method"]==3)))
{
$log_operator="OR";
if($_REQUEST["search_method"]==2)
$log_operator="AND";
$search_str="";
$keyword_arr=explode(" ",$searchkeyword);
foreach($keyword_arr as $key)
{
if($search_str=="")
{
$search_str="(sb_title like '%$key%' or sb_description like '%$key%' or sb_keywords like '%$key%') ";
}
else
{
$search_str.=" $log_operator (sb_title like '%$key%' or sb_description like '%$key%' or sb_keywords like '%$key%') ";
}
}
$sql.=" and ($search_str)";
}// end if AND/ OR keywords
else
{
$sql.=" and (sb_title like '%$searchkeyword%' or sb_description like '%$searchkeyword%' or sb_keywords like '%$searchkeyword%') ";
}
}
//============================================================
//==============================country Search================
if(isset($_REQUEST["country"])&&($_REQUEST["country"]<>""))
{
$mem_list=-1;
$mem_query=mysql_query("select * from sbbleads_members where sb_country=".$_REQUEST["country"]);
while($mem=mysql_fetch_array($mem_query))
{ $mem_list.=",".$mem["sb_id"];}
$sql.=" and sb_uid in ($mem_list)";
}
//============================================================
if(isset($_REQUEST["mem_id"])&&($_REQUEST["mem_id"]<>""))
{
$strpass.="&mem_id=".$_REQUEST["mem_id"];
$sql.=" and sb_uid=".$_REQUEST["mem_id"];
}
//=================================date search================
if($gdate<>"")
{
$sql.=" and sb_postedon > $gdate";
}
if($gdate1<>"")
{
$sql.=" and sb_postedon < $gdate1";
}
//============================================================
$sql.=" order by sb_id desc";
//echo $sql;
$offer_query=mysql_query($sql);
///////////////////////////////////PAGINATION /////////
if(!isset($_REQUEST["pg"]))
{
$pg=1;
}
else
{
$pg=$_REQUEST["pg"];
}
$rcount=mysql_num_rows($offer_query);
if ($rcount==0 )
{
$pages=0;
}
else
{
$pages=floor($rcount / $recperpage);
if (($rcount%$recperpage) > 0 )
{
$pages=$pages+1;
}
}
$jmpcnt=1;
while ( $jmpcnt<=($pg-1)*$recperpage && $row = mysql_fetch_array($offer_query) )
{
$jmpcnt = $jmpcnt + 1;
}
////////////////////////////////////////////////////////////////////////
?> <script language="JavaScript">
function submit_form()
{
document.save_search.action="save_search_popup.php";
window.open("","win","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=530,height=220,location=no,directories=no,scrollbars=no");
document.save_search.method="post";
document.save_search.target="win";
document.save_search.submit();
}
</script>
<table width="100%" border="0" cellspacing="10" cellpadding="2" class="maintablestyle">
<tr>
<td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
<tr>
<form name="form1" method="post" action="search.php">
<td align="center" valign="middle" class="innertablestyle"><br>
<input name="keyword" type="text" value="<? echo $keyword;?>" size="40">
<select name="type">
<option value="1">Sell Offers</option>
<option value="2">Buy Offers</option>
<option value="3" selected>Products Catalogs</option>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -