<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网银在线支付接口</title>
</head>
<body onLoad="javascript:document.E_FORM.submit()">
<!-- onLoad="javascript:document.E_FORM.submit()"-->
<?php
$obj = new payment();
$obj->set_where("pay_code = 'chinabank'");
$one = $obj->get_one();
$pay_config = $one['pay_config'];
$arr = explode('|',$pay_config);
$url = 'http://' . $_SERVER['SERVER_NAME'];
	
//////////////////////////////
	
$v_mid = $arr[0];
$key = $arr[1];
$v_url = $url . url(array('channel'=>'pay','dir'=>'chinabank','file'=>'receive'));
$remark2 = '[url:=' . $url . url(array('channel'=>'pay','dir'=>'chinabank','file'=>'receive')) . ']';
	
$v_oid = post('v_oid');
if($v_oid == '')
{
	$v_oid = get_random(date('ymdHis'),3);
}
	
$v_amount = post('v_amount');
$v_moneytype = "CNY";
$text = $v_amount . $v_moneytype . $v_oid . $v_mid . $v_url . $key;
$v_md5info = strtoupper(md5($text));
$remark1 = post('remark1');
	
$v_rcvname = post('v_rcvname');
$v_rcvaddr = post('v_rcvaddr');
$v_rcvtel = post('v_rcvtel');
$v_rcvpost = post('v_rcvpost');
$v_rcvemail = post('v_rcvemail');
$v_rcvmobile = post('v_rcvmobile');
	
$v_ordername = post('v_ordername');
$v_orderaddr = post('v_orderaddr');
$v_ordertel = post('v_ordertel');
$v_orderpost = post('v_orderpost');
$v_orderemail = post('v_orderemail');
$v_ordermobile = post('v_ordermobile');
	
//////////////////////////////
	
$user_id = check_user_login();
$obj = new account();
$obj->set_where('acc_status = 1');
$obj->set_where("acc_user_id = $user_id");
$obj->set_where("acc_sn = '$v_oid'");
if($obj->get_count() == 0)
{
	$obj->set_value('acc_user_id',$user_id);
	$obj->set_value('acc_sn',$v_oid);
	$obj->set_value('acc_increase',1);
	$obj->set_value('acc_amount',sprintf('%.2f',$v_amount));
	$obj->set_value('acc_add_time',time());
	$obj->set_value('acc_edit_time',time());
	$obj->set_value('acc_status',1);
	$obj->add();
}
	
?>
<!--以下信息为标准的 HTML 格式 + PHP 语言 拼凑而成的 网银在线 支付接口标准演示页面 无需修改-->
<form method="post" name="E_FORM" action="https://Pay3.chinabank.com.cn/PayGate?encoding=UTF-8">
	<input type="hidden" name="v_mid" value="<?php echo $v_mid;?>">
	<input type="hidden" name="v_oid" value="<?php echo $v_oid;?>">
	<input type="hidden" name="v_amount" value="<?php echo $v_amount;?>">
	<input type="hidden" name="v_moneytype" value="<?php echo $v_moneytype;?>">
	<input type="hidden" name="v_url" value="<?php echo $v_url;?>">
	<input type="hidden" name="v_md5info" value="<?php echo $v_md5info;?>">
	
	<!--以下几项项为网上支付完成后，随支付反馈信息一同传给信息接收页 -->	
	
	<input type="hidden" name="remark1" value="<?php echo $remark1;?>">
	<input type="hidden" name="remark2" value="<?php echo $remark2;?>">
	
	<!--以下几项只是用来记录客户信息，可以不用，不影响支付 -->
	
	<input type="hidden" name="v_rcvname" value="<?php echo $v_rcvname;?>">
	<input type="hidden" name="v_rcvtel" value="<?php echo $v_rcvtel;?>">
	<input type="hidden" name="v_rcvpost" value="<?php echo $v_rcvpost;?>">
	<input type="hidden" name="v_rcvaddr" value="<?php echo $v_rcvaddr;?>">
	<input type="hidden" name="v_rcvemail" value="<?php echo $v_rcvemail;?>">
	<input type="hidden" name="v_rcvmobile" value="<?php echo $v_rcvmobile;?>">
	
	<input type="hidden" name="v_ordername" value="<?php echo $v_ordername;?>">
	<input type="hidden" name="v_ordertel" value="<?php echo $v_ordertel;?>">
	<input type="hidden" name="v_orderpost" value="<?php echo $v_orderpost;?>">
	<input type="hidden" name="v_orderaddr" value="<?php echo $v_orderaddr;?>">
	<input type="hidden" name="v_ordermobile" value="<?php echo $v_ordermobile;?>">
	<input type="hidden" name="v_orderemail" value="<?php echo $v_orderemail;?>">
</form>
	
</body>
</html>