$v) { $$k=$v; } $link=conndb($datebase_write); $item=$_GET['item']; if (strtolower($_GET['s'])=='n') { $item=numrotstr($item); $sql="select * from partnumber where id=$item limit 0,1"; //echo $sql; $res = mysql_query($sql,$link) or die(mysqlErr($query,$link)); $rs_number = mysql_fetch_assoc($res); $pid=$rs_number['item']; } else { $pid=$item; } $orlang=$_GET['lang']; $partn=$_GET['partn']; $IDfag=substr($pid,0,2); //询价表单 include('../lang/part/'.$orlang.'.php'); include("../lib/country.php"); @session_start(); $username=substr($_SESSION['_username'],4); //询价表单 mysql_select_db('user_pro',$link) or die("Select Datebase Error: " . mysql_error()); $clientID = '0'; $clientArr=array(); $haveshow=array(); $haveshow[0]=0; //$lang='cn'; $query = sprintf("select userid from `id".$IDfag."` where pid='%d'",$pid); //echo $query; //$result = mysql_query($query,$link) or die(showBuy($lang,$item)); $result = mysql_query($query,$link); if ($result) while($row = mysql_fetch_assoc($result)){ $clientID.=','.$row['userid']; $clientArr[]=$row['userid']; } $clientID = ltrim($clientID,','); mysql_select_db($datebase["db"],$link) or die("Select Datebase Error: " . mysql_error()); $i=1; /* $query = sprintf("select count(*) as num from `user_info` where ispromotion=1 and userid in (%s)",$clientID); $result = mysql_query($query,$link) or die("查询异常中断2 : ".$query); $row = mysql_fetch_assoc($result); $total=$row['num']; $totalpage=ceil($total/11); $page=$_GET['page']; if ($page=='') $page=1; */ $ClientList.='
'; //$query = sprintf("select * from `user_info` where ispromotion=1 and userid in (%s) order by integral desc",$clientID); //先排有竞价排名的客户 $query=sprintf("select partitem from product where id='%d'",$pid); $result = mysql_query($query,$link); $row = mysql_fetch_assoc($result); $part=$row['partitem']; $query = "select a.* from `user_info` a join user_pro.sortrule b on a.userid=b.customer where a.ispromotion=1 and a.period >NOW() and b.sdate<=NOW() and b.edate>=NOW() and b.partlist like '%".$part."%' and a.userid in (".$clientID.") order by b.sort"; getcustomer($query); //没有排名的客户随机 $query = sprintf("select * from `user_info` where ispromotion=1 and period >NOW() and userid in (%s) and userid not in(".implode(',',$haveshow).") order by (integral/1000+ROUND(rand()*20)) desc",$clientID); getcustomer($query); function getcustomer($query) { global $link,$ClientList,$i,$haveshow,$Cli,$lang,$PartLang,$partn; //echo $query; $result = mysql_query($query,$link) or die("查询异常中断2 : ".$query); while($row = mysql_fetch_assoc($result)){ $haveshow[$row[userid]]=$row[userid]; $xml = ROOT.'/2008/cache/client/'.$row['username'].'.xml'; if(!file_exists($xml)){ continue; } $doc = new DOMDocument(); $doc->load($xml); $rows = $doc->getElementsByTagName( "item" ); foreach($rows as $node){ $company = $node->getElementsByTagName($lang."_company" )->item(0)->nodeValue; if(empty($company)) $company = $node->getElementsByTagName( "en_company" )->item(0)->nodeValue; $phone = $node->getElementsByTagName($lang."_phone" )->item(0)->nodeValue; if(empty($phone)) $phone = $node->getElementsByTagName( "en_phone" )->item(0)->nodeValue; $email = $node->getElementsByTagName($lang."_email" )->item(0)->nodeValue; if(empty($email)) $email = $node->getElementsByTagName( "en_email" )->item(0)->nodeValue; $msn = $node->getElementsByTagName($lang."_msn" )->item(0)->nodeValue; if(empty($msn)) $msn = $node->getElementsByTagName( "en_msn" )->item(0)->nodeValue; $address = $node->getElementsByTagName($lang."_address" )->item(0)->nodeValue; if(empty($address)) $address = $node->getElementsByTagName( "en_address" )->item(0)->nodeValue; $url = $node->getElementsByTagName("url" )->item(0)->nodeValue; $url = trim($url); $Makes = $node->getElementsByTagName( "Makes" )->item(0)->nodeValue; $Part = $node->getElementsByTagName( "Part" )->item(0)->nodeValue; } $PC = getCityName($row['province'],$row['city']); $logo = 'http://yiparts.com/2008/pic/ClientLogo/small/'.$row['username'].'.gif'; $urlstr=$url; if(strpos($url,'http://')===false) $url='http://'.$url; if(!empty($company)){ $phone=preg_replace('/\s{2,}| /',' ',strip_tags($phone)); $phone=str_replace(' ','',$phone); $phone=str_replace(',', '/',$phone); $phone=str_replace(chr(13), '/',$phone); $phone=str_replace(chr(10), '/',$phone); $phon=explode('/',$phone); $phone=$phon[0]; //partnumber='.$partn.' //m=product&id='.$item.' if($row['webtype']==3 || $row['webtype']==4) { $aurl='m=product'; } else{ $aurl='s=3'; } $ClientList.=' '; $Cli=1; if($i % 2 ==0) $ClientList.=''; $i++; } } } $ClientList.='
'; //询价表单开始 if(!empty($username)){ if($_SESSION['_usertype']=='vip'){ $table='user_info'; }else{ $table='user_general'; } $query_ord =sprintf("select * from yiautoparts_db.".$table." where username=%s limit 0,1",escape($username)); $result_ord = mysql_query($query_ord,$link) or die(mysqlErr($query_ord,$link)); $row_ord = mysql_fetch_array($result_ord); } if($lang!='cn') { asort($CountryList); $first=0; $delang='CN'; $cli_msg="No information about the suppliers of the part temporarily, your inquiry will be published on."; } else { $first=1; $cli_msg="暂时没有销售此配件的供应商信息, 您的求购信息将在宜配网上公布。"; } if(!empty($row_ord['country'])) $mylang=$row_ord['country']; foreach($CountryList as $k=>$v){ if(empty($mylang)) { $ACCEPT = $_SERVER['HTTP_ACCEPT_LANGUAGE']; $ACCEPT = explode('-',$ACCEPT); $ACCEPT = strtoupper($ACCEPT[1]); if(empty($ACCEPT)) $ACCEPT=$delang; } else { $ACCEPT=$mylang; } $v=explode('@',$v); if($k==$ACCEPT) $selected = ' selected="selected"'; else $selected=''; $cl = $v[2]; if(!empty($v[$first])) $cl=' ('.$cl.')'; $opti[$k]= ''; } if($row_ord['Gender']=='0') $check='checked="checked"'; //$order_form='
'.implode(';',$row_ord).'
'; $order_form='
'.$cli_msg.'
'.$PartLang['yourName'].': *
'.$PartLang['country'].':
'.$PartLang['company'].': *
'.$PartLang['phone'].': *
'.$PartLang['fax'].':
E-mail: *
Msn:
'.$PartLang['address'].': *
'.$PartLang['note'].':
'; //询价表单结束 if ($Cli!='') { echo $ClientList; } else { echo $order_form; } mysql_free_result($result);