<?php
/**
 * powered by b2bbuilder
 * copyright http://www.b2b-builder.com
 * Auther:brad zhang;
 * Des:abouts us
 */

if(!empty($_GET['oid']))
{
	$va=explode(",",$_COOKIE['offer_inquery']);
	$ar=explode(",",$_GET['oid']);
	foreach($va as $key=>$v)
	{
		if(!$v) unset($va[$key]);
		if(in_array($v,$ar))
			unset($va[$key]);
	}
	setcookie("offer_inquery",implode(",",$va),NULL,"/",$config['baseurl']);
	msg("$config[weburl]/?m=message&s=inquiry_basket");
}
if(!empty($_COOKIE['offer_inquery']))
{
	$offers=explode(",",$_COOKIE['offer_inquery']);
	foreach($offers as $v)
	{
		if(!empty($v))
		{
			$offer_array[]=$v*1;
		}
	}
	if($offer_array)
	{
		$offers=implode(",",$offer_array);
		$sql="select pic,a.title as subject,a.price,a.company_id,a.userid,a.id,b.company from ".INFO." a left join ".COMPANY." b on a.company_id=b.company_id where a.id in ($offers)";
		$db->query($sql);
		$re=$db->getRows();
		foreach($re as $k=>$pl)
		{
			$img= explode(',',$pl['pic']);
			$re[$k]['pic'] =$img[0];	
		}
		$tpl->assign("infolist",$re);
	}
}
//======================================
$tpl->assign("current","offer");
include_once("footer.php");
$out=tplfetch("inquiry_basket.htm");
?>