<div class="title"><span>Update TradeInfo of WebSite</span> </div>
 <div class="infodiv"><br /><br />
 <?php 
$sql="select count(id) as counts from trade_product where istranslated=0";
$result=mysql_query($sql);
$counts=mysql_result($result,0,counts);
if($counts==0){ 
	echo "<p align=center>您的贸易产品信息没有更新的内容，不用提交信息</p>";
}else{
	if(!issubmit($userid)){
		$sql="insert into trade_trans_list(userId,updatetime,state) value($userid,'".date("Y-m-d H:i:s")."',1)";
		$sql2="update trade_product_trans set istranslated=0 where proId in (".getmodifyproids($userid).")";
		$sql3="update trade_product set istranslated='".date("Y-m-d H:i:s")."' where userId=$userid";
		echo $sql2;
		echo $sql3;
		mysql_query($sql);
		mysql_query($sql2);
		mysql_query($sql3);
		echo "<p align=center>已经提交ETW国际翻译修改。。。<br></p>";

		$xmlhead="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r";
		$sql="select * from trade_product where userId=$userid order by updatetime";
		$body="<channel>\n\r";

		$result=mysql_query($sql);
			while($rs=mysql_fetch_array($result)){
			$body=$body."<item>\n\r";
			$body=$body."<userId>".$rs['userId']."</userId>\n\r";
			$body=$body."<proId>".$rs['proId']."</proId>\n\r";
			$body=$body."<proname>".$rs['proname']."</proname>\n\r";
			$body=$body."<keywords>".$rs['keywords']."</keywords>\n\r";
			$body=$body."<description>".$rs['details']."</description>\n\r";
			$body=$body."<details>".$rs['details']."</details>\n\r";
			$body=$body."<picture>".$rs['picture']."</picture>\n\r";
			$body=$body."<minorder>".$rs['minorder']."</minorder>\n\r";
			$body=$body."<fobprice>".$rs['fobprice']."</fobprice>\n\r";
			$body=$body."<port>".$rs['port']."</port>\n\r";
			$body=$body."<payment>".$rs['payment']."</payment>\n\r";
			$body=$body."<deliverytime>".$rs['deliverytime']."</deliverytime>\n\r";
			$body=$body."<supplyability>".$rs['supplyability']."</supplyability>\n\r";
			$body=$body."<package>".$rs['package']."</package>\n\r";
			$body=$body."</item>\n\r\n\r";
			}
			mysql_free_result($result);
		$body=$body."</channel>";
		$pro_xml=$xmlhead.$body;
		$dir="trade/xml/$userid/";
		$xmlfile="trade/xml/$userid/pro.xml";
		if(!is_dir($dir)){
					if(!mkdir($dir , 0777 ,true)) die("创建站体文件夹失败");
			  }
		fopen($xmlfile,"w");
		file_put_contents($xmlfile,$pro_xml);	
		
		$param_body="<channel>\n\r";
		$param_sql="select * from trade_pro_param where userId=$userid order by proId";
		$para_result=mysql_query($param_sql);
		while($row=mysql_fetch_array($para_result)){
			$param_body=$param_body."<item>\n\r";
			$param_body=$param_body."<userId>".$row['userId']."</userId>\n\r";
			$param_body=$param_body."<proId>".$row['proId']."</proId>\n\r";
			$param_body=$param_body."<parameter>".$row['parameter']."</parameter>\n\r";
			$param_body=$param_body."<paramvalue>".$row['paramvalue']."</paramvalue>\n\r";
			$param_body=$param_body."</item>\n\r\n\r";
		}
		$param_xml=$xmlhead.$param_body."</channel>";
		$xmlparam="trade/xml/$userid/param.xml";
		fopen($xmlparam,"w");
		file_put_contents($xmlparam,$param_xml);
	}else{
		echo "<p align=center>您修改贸易产品信息已经提交，请不要重复提交</p>";
	}
} ?>
      <br />
</div>   