<?
session_start();
require_once("../common/init.php");
if ($_GET[lang]=="")
{

$sqllanginfo = "select * from ch_lang  where AutoDo='1'   ";
}
else
{
	

$lang=$_GET[lang];
$sqllanginfo = "select * from ch_lang  where ProductName='$lang'  ";
}
$langInfo  = $DB->getdata($sqllanginfo);
$lang_agentname=$langInfo[ProductIntro];

$lang=$langInfo[ProductName];

$smarty->assign('lang_sj',$langInfo[sj]);
$smarty->assign('lang_zc',$langInfo[zc]);
$smarty->assign('lang_wjmm',$langInfo[wjmm]);
$smarty->assign('lang_sjb',$langInfo[sjb]);

$smarty->assign('lang_dl',$langInfo[dl]);
$smarty->assign('lang_jrsc',$langInfo[jrsc]);
$smarty->assign('lang_jg',$langInfo[jg]);
$smarty->assign('lang_ckxq',$langInfo[ckxq]);

$smarty->assign('lang_rmb',$langInfo[rmb]);
$smarty->assign('lang_yuan',$langInfo[yuan]);
$smarty->assign('lang_sjtime',$langInfo[sjtime]);
$smarty->assign('lang_zz',$langInfo[zz]);
$smarty->assign('lang_sl',$langInfo[sl]);
$smarty->assign('lang_cpjs',$langInfo[cpjs]);
$smarty->assign('lang_cply',$langInfo[cply]);
$smarty->assign('lang_dqwz',$langInfo[dqwz]);
$smarty->assign('lang_syindex',$langInfo[syindex]);

$smarty->assign('lang_soshuo',$langInfo[soshuo]);
$smarty->assign('lang_cpsoshuo',$langInfo[cpsoshuo]);
$smarty->assign('lang_wzsoshuo',$langInfo[wzsoshuo]);

$smarty->assign('lang_tjwt',$langInfo[tjwt]);
$smarty->assign('lang_wtlx',$langInfo[wtlx]);

$smarty->assign('lang_lxr',$langInfo[lxr]);
$smarty->assign('lang_lybt',$langInfo[lybt]);
$smarty->assign('lang_lylr',$langInfo[lylr]);
$smarty->assign('lang_yzm',$langInfo[yzm]);
$smarty->assign('lang_yzmzq',$langInfo[yzmzq]);
$smarty->assign('lang_yzmcw',$langInfo[yzmcw]);
$smarty->assign('lang_wtlb',$langInfo[wtlb]);
$smarty->assign('lang_gong',$langInfo[gong]);
$smarty->assign('lang_gong1',$langInfo[gong1]);
$smarty->assign('lang_gong2',$langInfo[gong2]);
$smarty->assign('lang_gong3',$langInfo[gong3]);
$smarty->assign('lang_oprice',$langInfo[oprice]);
$smarty->assign('lang_nprice',$langInfo[nprice]);

$smarty->assign('lang_welcome',$langInfo[welcome]);
$smarty->assign('lang_logout',$langInfo[logout]);
$smarty->assign('lang_gl',$langInfo[gl]);

$smarty->assign('lang_lb',$langInfo[lb]);
$smarty->assign('lang_ljgm',$langInfo[ljgm]);
$smarty->assign('lang_cz',$langInfo[cz]);
$smarty->assign('lang_more',$langInfo[more]);
$smarty->assign('lang_fh',$langInfo[fh]);
$smarty->assign('lang_wdl',$langInfo[wdl]);
$smarty->assign('lang_ydl',$langInfo[ydl]);
$smarty->assign('lang_yhm',$langInfo[yhm]);
$smarty->assign('lang_mm',$langInfo[mm]);
$smarty->assign('lang_qrmm',$langInfo[qrmm]);
$smarty->assign('lang_lxrz',$langInfo[lxrz]);
$smarty->assign('lang_lxry',$langInfo[lxry]);
$smarty->assign('lang_gsmz',$langInfo[gsmz]);
$smarty->assign('lang_gsmy',$langInfo[gsmy]);
$smarty->assign('lang_gj',$langInfo[gj]);
$smarty->assign('lang_sf',$langInfo[sf]);
$smarty->assign('lang_cs',$langInfo[cs]);
$smarty->assign('lang_txdzz',$langInfo[txdzz]);
$smarty->assign('lang_txdzy',$langInfo[txdzy]);
$smarty->assign('lang_yb',$langInfo[yb]);
$smarty->assign('lang_czh',$langInfo[czh]);
$smarty->assign('lang_email',$langInfo[email]);

if($lang==""){
$lang="Chinese";
}

$smarty->assign('lang',$lang);



/**
 * ¼æÈÝpostº¯Êý
 *
 * date 2012-05-25 13:40:41
 */
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];
$Password2 = $_POST['Password2'];
$Company_GB = $_POST['Company_GB'];
$Company_EN = $_POST['Company_EN'];
$Contact_GB = $_POST['Contact_GB'];
$Contact_EN = $_POST['Contact_EN'];
$Country = $_POST['Country'];
$Province_GB = $_POST['Province_GB'];
$City_GB = $_POST['City_GB'];
$Addr_GB = $_POST['Addr_GB'];
$Addr_EN = $_POST['Addr_EN'];
$PostCode = $_POST['PostCode'];
$Email = $_POST['Email'];
$Tel = $_POST['Tel'];
$Fax = $_POST['Fax'];
$QQ_openid = $_POST['openid'];
$ZF_openid = $_POST['ZF_openid'];
if($UserName == null || $Password == null || $Password2 == null || $Contact_GB == null|| $Contact_EN == null || $Company_GB == null || $Company_EN == null || $Addr_GB ==null || $Addr_EN == null || $Tel == null || $Fax == null || $Email == null)
{
	
	echo ''.$langInfo[srkz].'¡£';
	exit();
}


$sql="select count(*) from users where UserName='$UserName'";
$rs=$db->query($sql);
$exist = $db->result($rs,0,0);
if($exist){
   $db->close();
  die('<script>alert('.$langInfo[yhm].' '.$UserName.''.$langInfo[ybzy].');history.back();</script>');
}

$sql="insert into users set UserName='$UserName',Password=MD5('$Password'),Company_GB='$Company_GB',".
	"Company_EN='$Company_EN',Contact_GB='$Contact_GB',Contact_EN='$Contact_EN',Country='$Country',Province_GB='$Province_GB',".
	"City_GB='$City_GB',Addr_GB='$Addr_GB',Addr_EN='$Addr_EN',".
	"PostCode='$PostCode',Email='$Email',QQ_openid='$QQ_openid',ZF_openid='$ZF_openid',Tel='$Tel',Fax='$Fax',iStatus ='1',dtCreate=now()";
$db->query($sql);

$mailvars['UserName'] = $UserName;
$mailvars['Password'] = $Password;

$smarty->assign('UserName',$UserName);
$smarty->assign('Password',$Password);
$smarty->display('user_reg_submit.html');
if($mailvars){
@SendTemplateMail("user_reg.htm",$mailvars,$Email,$langInfo[zc]."Success£¡".$_CFG['Company'].$langInfo[yhm]);}





$db->close();
?>