Execute($sql); if(empty($rs->fields['user_id'])||empty($rs->fields['name'])||empty($rs->fields['simply'])){ $xtpl->assign("CONFIRMENINFO",""); ;} } //$xtpl->assign("PAGENAME","English"); //报价区 $price_element_array = array("cu","al","pb","zn","sn","ni"); while(list($key,$ele)=each($price_element_array)){ if($ele=="zn"){ $sql = "select id,".$ele."_b,addtime from ".$ele." order by addtime desc limit 0,2"; $rs1 = $conn->Execute($sql); $i=0; while(!$rs1->EOF){ ++$i; $atime[$i] = $rs1->fields[addtime]; $a_today[$i] = $rs1->fields[$ele."_b"]; $a[$i]=split("-",$rs1->fields[$ele."_b"]); $avg_a[$i]=round(($a[$i][0]+$a[$i][1])/2); $rs1->MoveNext(); } $price_a = $avg_a[1]-$avg_a[2]; $price_a = $price_a>=0?"".$price_a."":"".$price_a.""; $xtpl->assign(strtoupper($ele)."_PRICE_TODAY",$a_today[1]); $xtpl->assign(strtoupper($ele)."_FLUCTUATION",$price_a); $xtpl->assign(strtoupper($ele)."_PRICE_RENEW_DATE",ConvertDate($atime[1],"m/d")); } else{ $sql = "select id,".$ele."_a,addtime from ".$ele." order by addtime desc limit 0,2"; $rs1 = $conn->Execute($sql); $i=0; while(!$rs1->EOF){ ++$i; $atime[$i] = $rs1->fields[addtime]; $a_today[$i] = $rs1->fields[$ele."_a"]; $a[$i]=split("-",$rs1->fields[$ele."_a"]); $avg_a[$i]=round(($a[$i][0]+$a[$i][1])/2); $rs1->MoveNext(); } $price_a = $avg_a[1]-$avg_a[2]; $price_a = $price_a>=0?"".$price_a."":"".$price_a.""; $xtpl->assign(strtoupper($ele)."_PRICE_TODAY",$a_today[1]); $xtpl->assign(strtoupper($ele)."_FLUCTUATION",$price_a); $xtpl->assign(strtoupper($ele)."_PRICE_RENEW_DATE",ConvertDate($atime[1],"m/d")); } } //报价区 //新闻区 $sql = "select id,title,nid,addtime,brief from news where language='en' order by nid desc limit 0,4"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $newsdate = date ("m/d",(strtotime($rs->fields['addtime']))); $xtpl->assign("NEWSDATE",$newsdate); $xtpl->assign("NEWSID",$rs->fields['id']); if(strlen($rs->fields["title"])>50){ $xtpl->assign("NEWSTITLE",substr($rs->fields['title'],0,50)."..."); } else{ $xtpl->assign("NEWSTITLE",$rs->fields['title']); } if(strlen($rs->fields["brief"])>140){ $xtpl->assign("NEWSBRIEF",replace_gb(substr($rs->fields['brief'],0,140))."..."); } else{ $xtpl->assign("NEWSBRIEF",replace_gb($rs->fields['brief'])); } $xtpl->parse("main.news_row"); $rs->MoveNext(); } $sql = "select id,title,nid,addtime from news where language='en' and `type`=3 order by nid desc limit 0,9"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $xtpl->assign("NEWSDATE",substr($rs->fields['addtime'],5,5)); $xtpl->assign("NEWSID",$rs->fields['id']); $xtpl->assign("NEWSTITLE",substr($rs->fields['title'],0,30)."..."); $xtpl->parse("main.news_row_3"); $rs->MoveNext(); } $sql = "select id,title,nid,addtime from news where language='en' and `type`=1 order by nid desc limit 0,9"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $xtpl->assign("NEWSDATE",substr($rs->fields['addtime'],5,5)); $xtpl->assign("NEWSID",$rs->fields['id']); $xtpl->assign("NEWSTITLE",substr($rs->fields['title'],0,30)."..."); $xtpl->parse("main.news_row_1"); $rs->MoveNext(); } //新闻区 $sql = "select id,title,nid,addtime from bulletin order by nid desc limit 0,9"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $xtpl->assign("BULLETINDATE",substr($rs->fields['addtime'],5,5)); $xtpl->assign("BULLETINID",$rs->fields['id']); $xtpl->assign("BULLETINTITLE",substr($rs->fields['title'],0,10)."..."); $xtpl->parse("main.bulletin_row"); $rs->MoveNext(); } //business center $sql1="select uid,max(addtime) as c from gxinfo_en group by uid order by c desc limit 0,11"; $rs1 = $conn->Execute($sql1); while(!$rs1->EOF){ $sql="select *,A.info as info1,A.id as info3,B.info as info2 from gxinfo_en as A,user_2 as B where A.uid=B.user_id and A.uid='".$rs1->fields["uid"]."' order by addtime desc limit 0,1"; $rs = $conn->Execute($sql); if(!$rs->EOF){ if ($rs->fields["cooperation"]=='Supply'){$style="style4";} else {$style="style3";} $xtpl->assign("INFOBGCOLOR",$style); $xtpl->assign("COOPERATION",$rs->fields["cooperation"]); $xtpl->assign("UID",$rs->fields["info3"]); if(strlen($rs->fields["info1"])>75){ $info=substr($rs->fields["info1"],0,75); $xtpl->assign("INFO",$info); $a="..."; $xtpl->assign("A",$a); } else{ $xtpl->assign("INFO",$rs->fields["info1"]); $a=""; $xtpl->assign("A",$a); } $xtpl->assign("ADDTIME",date("M d Y H:i",$rs->fields["addtime"])); $xtpl->assign("NAME",$rs->fields["simply"]); $xtpl->assign("LXR",$rs->fields["lxr"]); $xtpl->assign("PHONE",$rs->fields["phone"]); $xtpl->assign("COMPANYNAME",$rs->fields["name"]); } $xtpl->parse("main.trade_row"); $rs1->MoveNext(); } //外汇区 $sql = "select addtime,name_en,index_val from smm_another_index where status = 'R' order by show_order"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $rateaddtime = date ("M d",(strtotime($rs->fields['addtime']))); $xtpl->assign("RATEADDTIME",$rateaddtime); $xtpl->assign("RATENAME",$rs->fields['name_en']); $xtpl->assign("RATEPRICE",$rs->fields['index_val']); $xtpl->parse("main.exchange_rate_row"); $rs->MoveNext(); } //广告 2007-10-18 by buoren $sql="select * from ads where ad_page = 'index' and instr(place,'ed') and ad_stop > '$curtime' order by place limit 0,2"; $rs = $conn->Execute($sql); while(!$rs->EOF){ $xtpl->assign("ADLINK","../readadlink.php?id=".$rs->fields['keyid']); $xtpl->assign("ADTARGET",$rs->fields['target']); $xtpl->assign("IMGURL",$rs->fields['imageurl']); if (count($rs)<2) { $xtpl->assign("AD160_60","
  • "); } elseif (count($rs)<1) { $xtpl->assign("AD160_60","
  • "); } $xtpl->parse("main.ad_home_160_60"); $rs->MoveNext(); } $xtpl->assign("CALENDAR_START_VALUE",date("Y")."-01-01"); $xtpl->assign("CALENDAR_END_VALUE",date("Y-m-d")); $xtpl->parse("main"); $xtpl->out("main"); ?>