⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 products.php

📁 通达OA部分源代码
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?
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"];
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"];
}
$strpass="";
$cid=0;
$keyword="";
$searchkeyword="";
$gdate="";
$gdate1="";
$radio=1;
$sblabel="All Product Catalogs";

if(isset($_REQUEST["cid"])&&($_REQUEST["cid"]<>""))
{
$cid=$_REQUEST["cid"];
}
$strpass.="&cid=".$cid;

/////////---------rec per page is set
if( isset($_REQUEST["recperpage"]) && is_numeric($_REQUEST["recperpage"]) && ($_REQUEST["recperpage"] > 0) )
{
	$recperpage=$_REQUEST["recperpage"];
	$strpass.="&recperpage=".$recperpage;
}
////////////-------------------------


/////----------if user id comes
$sb_uid=0;
$sb_user_str="";


if( isset($_REQUEST["sb_uid"]) && ($_REQUEST["sb_uid"]<>"") && ($_REQUEST["sb_uid"]<>0) )
{
	$sb_uid=$_REQUEST["sb_uid"];
	$sb_user_str=" and sb_uid=$sb_uid";

	$sbq_mem='select * from sbbleads_members where sb_id='.$sb_uid;
	$sbrow_mem=mysql_fetch_array(mysql_query($sbq_mem));

	$sblabel="Search results for username <font color='#FFCC00'>".$sbrow_mem['sb_username']."</font>";
}
$strpass.="&sb_uid=".$sb_uid;

////////////-----if expiry comes
$sbexpiry=1;
$sb_expiry_str="";
if( isset($_REQUEST["sbexpiry"]) && ($_REQUEST["sbexpiry"]<>"") && ($_REQUEST["sbexpiry"]<>0) )
{
	$sbexpiry=$_REQUEST["sbexpiry"];
	switch($sbexpiry)
	{
		case 2:
			$sb_expiry_str=" and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_sell"]." MONTH) > NOW()";
			$sblabel="Search results for <font color='#FFCC00'>"."Active "."</font>";
			break;
		case 3:
			$sb_expiry_str=" and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_sell"]." MONTH) < NOW()";
			$sblabel="Search results for <font color='#FFCC00'>"."Expired "."</font>";

			break;
	}
}
$strpass.="&sbexpiry=".$sbexpiry;

////////////-----if approval comes
$sbapproval=1;
$sb_approval_str="";
if( isset($_REQUEST["sbapproval"]) && ($_REQUEST["sbapproval"]<>"") && ($_REQUEST["sbapproval"]<>0) )
{
	$sbapproval=$_REQUEST["sbapproval"];
	switch($sbapproval)
	{
		case 2:
			$sb_approval_str=" and sb_approved='no'";
			if( ($sbexpiry == 2) ||  ($sbexpiry == 3) )
				$sblabel.=" and <font color='#FFCC00'>"."Unapproved Product Catalogs"."</font>";
			else
				$sblabel="Search results for <font color='#FFCC00'>"."Unapproved Product Catalogs"."</font>";
			break;
		case 3:
			$sb_approval_str=" and sb_approved='yes'";
			if( ($sbexpiry == 2) ||  ($sbexpiry == 3) )
				$sblabel.=" and <font color='#FFCC00'>"."Approved Product Catalogs"."</font>";
			else
				$sblabel="Search results for <font color='#FFCC00'>"."Approved Product Catalogs"."</font>";
			break;
		case 4:
			$sb_approval_str=" and sb_new='yes'";
			if( ($sbexpiry == 2) ||  ($sbexpiry == 3) )
				$sblabel.=" and <font color='#FFCC00'>"."New Product Catalogs"."</font>";
			else
				$sblabel="Search results for <font color='#FFCC00'>"."New Product Catalogs"."</font>";
			break;
	}
}
if($sbapproval==1)	//just for printing label otherwise just wastefull luxury
{
	if( ($sbexpiry == 2) ||  ($sbexpiry == 3) )
		$sblabel.="<font color='#FFCC00'>"." Product Catalogs"."</font>";
}
$strpass.="&sbapproval=".$sbapproval;

////////////////--------------------------mera code isse Uoper hai

	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"]);
		}
	/////---------just the label	
		$sblabel="Search results for keyword <font color='#FFCC00'>".$keyword."</font>";
		if($sbexpiry==2)
		{
			$sblabel.=" in <font color='#FFCC00'>Active</font>";
			if($sbapproval==2)
				$sblabel.=" and <font color='#FFCC00'>Unapproved Product Catalogs</font>";
			elseif($sbapproval==3)
				$sblabel.=" and <font color='#FFCC00'>Approved Product Catalogs</font>";
			else
				$sblabel.="<font color='#FFCC00'> Product Catalogs</font>";
		}
		elseif($sbexpiry==3)
		{
			$sblabel.=" in <font color='#FFCC00'>Expired</font>";
			if($sbapproval==2)
				$sblabel.=" and <font color='#FFCC00'>Unapproved Product Catalogs</font>";
			elseif($sbapproval==3)
				$sblabel.=" and <font color='#FFCC00'>Approved Product Catalogs</font>";
			else
				$sblabel.="<font color='#FFCC00'> Product Catalogs</font>";
		}
		else ///expiry is 1
		{
			if($sbapproval==2)
				$sblabel.=" in <font color='#FFCC00'>Unapproved Product Catalogs</font>";
			elseif($sbapproval==3)
				$sblabel.=" in <font color='#FFCC00'>Approved Product Catalogs</font>";
		}
	/////////---------------				
		$searchkeyword=trim($searchkeyword);
	}
	
if($cid<>0)
{
$sbq1_cat="select * from sbbleads_categories where sb_id=$cid";
$sbrow1_cat=mysql_fetch_array(mysql_query($sbq1_cat));
$sblabel.=" in category <font color='#FFCC00'>".$sbrow1_cat["sb_cat_name"]."</font>";
}
	
	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_sell.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 1 $sb_approval_str $sb_user_str $sb_expiry_str";
	
	//==============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)";
	}	
	//============================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -