<?php
!function_exists('html') && exit('ERR');

if(!$webdb[alipay_id]){
	showerr('系統沒有設置支付寶收款帳號,所以不能使用支付寶在線支付');
}

if($trade_status=='TRADE_FINISHED'){
	$veryfy_result = file_get_contents("http://notify.alipay.com/trade/notify_query.do?notify_id=$notify_id&partner=2088001505801569");
	if(!eregi("true$",$veryfy_result)){
		showerr('安全驗證參數校驗失敗，無法完成充值！<hr>'.$veryfy_result);
	}

	olpay_end($out_trade_no);
}
else
{
	$array=olpay_send();

	$url  = "http://pay.phpwind.com/pay/create_payurl.php?";

	$para = array(
			'_input_charset' => 'gbk',
			'service' => 'create_direct_pay_by_user',
			'return_url' => $array[return_url],
			'payment_type' => '1',
			'subject' => $array[title],
			'body' => $array[content],
			'out_trade_no' => $array[numcode],
			'total_fee' => $array[money],
			'seller_email' => $webdb[alipay_id],
		);
	foreach($para as $key => $value){
		if($value){
			$url  .= "$key=".urlencode($value)."&";
		}
	}
	
	header("location:$url");
	exit;
}
?>