<?php
define('BASE_ROOT', substr(dirname(__FILE__), 0, -13));
require_once(BASE_ROOT.'/conf/db.inc.php');
$mysql_conn = @mysql_connect(DB_HOST, DB_USER, DB_PASS);
if (!$mysql_conn) {
    die("could not connect to the database:\n" . mysql_error());//诊断连接错误
}
mysql_query("set names 'utf8'");//编码转化
$select_db = mysql_select_db(DB_DATA);
if (!$select_db) {
    die("could not connect to the db:\n" .  mysql_error());
}
$sql = "SELECT * FROM ".DB_PREFIX."aplipay WHERE id='".intval(1)."'";
$res = mysql_query($sql);
if (!$res) {
    die("could get the res:\n" . mysql_error());
}
$data=array();
while ($row = mysql_fetch_assoc($res)) {
    $data=$row; 
}
mysql_close($mysql_conn);
$config = array (	
		//应用ID,您的APPID。
		'app_id' => $data['app_id'],
		//商户私钥
		//'merchant_private_key' => "MIIEogIBAAKCAQEAxgKtWXyntAP56CSp92UD+5wr58MJhpWj81OK1Y55t8bgyWv07oENnKtu8Qb6NMOBjIarWkKp9sDgg3vpiEhFO9EKbp+LOGMVVgnzJ4ulv3KJjFjpi8zViwcKqFJ1Ymn5BNRSHfAxAm1z5z335mQNV5LRIKG3rpxcnDQCE4rxoxIHUN694UvjPOZdJo46qVU0dBMEm91HE1MsM+skz41dfcMoo4lZqVs4pff06303JfytimrVSjhQJv6D8zZymDAhk967tlq4yAArEg5SiPRljEnt0L0c7W2h0XgKE0Usw+5a6itpZXGY8kdB6DbUbcnOpdFqi6VPfgvdgQw+0My0YwIDAQABAoIBAD0B1iccIQ91qim8IiH3HaMIGv7tOKIeuMTfmIbzvszAmcF1YaGaYXdD2oqoe66GDgQd+e11XKiKBKJ+KxWyLqKfZXdv8JUO8iPwLNqiTA8QWxDC1DIeiiyrnrz9qu0HeZHjWOmgd3kn/+3fSeHSMcopkgVbzhweUOpPm9QpmwmCmJ5kzaF9tLMkwDh5+HwPDcR1Edks5NCivcy3LLGndMylhpY5cubbPOuMDN/vyeSJcYMTIg+t//id+Lb4EtFGp2qY+qIQGLxJCSQ3rut8EgnMD4LNqMEbFbBbWr8UVdCHLatr7SFguZ+zRlu4vRRqf0wvKuHSq6dyAbcHQ0dVdgECgYEA/+L3apkpDQTgkGcE+emfj+Jthe9CGuXJYyEjuUvrnrwl/OhaZFFg06T+qqCshdtD9GRAvnpbKuMNgdk8Wt2h8409zjeciXF/9I0bU0W6aVA192Diw68S+rEHD1+2ss1oABcutY7xmScFCCgNaKqzIm+zfYdStRr4kZH7/PLJ8MkCgYEAxhkk1w5h2HB/q+vU557AeOk+KbOE4l7wPvAHMwJcsYTUgjNFj+naS8OZO/DKe3spOtDoTLwvtgStcP/Mh5W4D2EYi2CVriqphq5SGGBMRf+m6avu5J51I/BaHnlZeEdMXJ3rwd5wPXSuEP1vSyOM44FlCZtGqrCYQHWk0U1EHcsCgYBxHbk340r1WWGYFCJsA62oonS+D11OnKPg8WZkZD5dZlj4qxJCZIMELFzzuqFpbttkbuj8CwTAOazf6NM4a99K1fYrcgP98jGZPsOElT9pjK6+k5LK5FrkfVtcnXgbJJhD6fuZAP6mMEyWJXZ//W3A3FYhOLAEJU8asskNMZq5mQKBgFDzY2+SS/+jcTizBWylHegLAEEQQAQ1YZ2Gfpqko3ZTXnfaNdnqaS8+vfaVnli5ao7DYbpByIlr/ehIT680SmPWfK4wCNqESoRj5d5aM7EDGJUykkvQSPQnutvrINma4SST0AyINnuWm68LsZgV7fPmI4C6eDU2NvFYYcK5/VTjAoGAGB26gkmVhkDRhcVhsE5vXuCxdjtYcH1I6y48jXlRsPIhA/pen3n+GRfdrsQq7taTJwF9u5c1L6qlxTD4uq/xFH91DW0RJmHqqIUoHYLmSXpsUUFtBoeqAq39R4xgtxQlZuOQk/tSUsiigsC9zo8cTTd1QCr6UilpXY/Wz2bD7Ss=",
		'merchant_private_key' => $data['merchant_private_key'],
		//异步通知地址
		//'notify_url' => "http://".$_SERVER['HTTP_HOST']."/source/plugin/alipay/notify_url.php",
		'notify_url'  => $data['notify_url'],
		//同步跳转
		//'return_url' => "http://".$_SERVER['HTTP_HOST']."/index.php?c=user",
                'return_url'  => $data['return_url'],
		//编码格式
		'charset' => "utf-8",
		//签名方式
		'sign_type'=>"RSA2",
		//支付宝网关
		'gatewayUrl' => "https://openapi.alipaydev.com/gateway.do",
		//支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
		//'alipay_public_key' => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxgKtWXyntAP56CSp92UD+5wr58MJhpWj81OK1Y55t8bgyWv07oENnKtu8Qb6NMOBjIarWkKp9sDgg3vpiEhFO9EKbp+LOGMVVgnzJ4ulv3KJjFjpi8zViwcKqFJ1Ymn5BNRSHfAxAm1z5z335mQNV5LRIKG3rpxcnDQCE4rxoxIHUN694UvjPOZdJo46qVU0dBMEm91HE1MsM+skz41dfcMoo4lZqVs4pff06303JfytimrVSjhQJv6D8zZymDAhk967tlq4yAArEg5SiPRljEnt0L0c7W2h0XgKE0Usw+5a6itpZXGY8kdB6DbUbcnOpdFqi6VPfgvdgQw+0My0YwIDAQAB",
                'alipay_public_key' =>$data['alipay_public_key'],
 );