<?php
require("global.php");

$is_mob = defined('InWap')?true:false;
$wap = $is_mob?'wap':'';


if($action=='post'){

	$money = abs(number_format($money,2));
	$floor = floor($money/10);

	if($money>$lfjdb[rmb]){
		showerr('你的余额不足！');
	}

	add_rmb($lfjuid,-$money,0,"充值积分");	//扣除余额

	$num = $money*$webdb[alipay_scale] + $floor*$webdb[alipay_give_scale];
	
	add_user($lfjuid,$num,'在线充值');

	refreshto("$webdb[www_url]/member/{$wap}index.php","恭喜你充值成功",3);
}

if(in_array($banktype,array('alipay','tenpay','chinabank','yeepay','paypal','wxpay'))){

	$atc_moeny = number_format($atc_moeny,2);
	if($atc_moeny<0.01){
		showerr("你输入的金额不能小于 0.01 元");
	}

	//跳转到在线支付接口先充值余额后，再返回到余额支付
	$array=array('money'=>$atc_moeny,'url'=>"$webdb[www_url]/do/{$wap}buymoneycard.php?action=post&money=$atc_moeny",'mob'=>$is_mob,'bank'=>$banktype,'numcode'=>'');
	$url=post_olpay( $array );
	echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=$url'>";


}elseif($banktype){
	showerr("支付类型有误!");	
}

$lfjdb[money]=get_money($lfjuid);

$webdb[alipay_give_scale] = intval($webdb[alipay_give_scale]);

require(ROOT_PATH."inc/{$wap}head.php");
require(html("{$wap}buymoneycard"));
require(ROOT_PATH."inc/{$wap}foot.php");

?>