<?php
require_once("../check.php");
require_once("../core/setting.php");
isset($_POST['money'])?$usermoney=$_POST['money']:$usermoney=null;
isset($_POST['alipay'])?$alipay=$_POST['alipay']:$alipay=null;
isset($_POST['payname'])?$payname=$_POST['payname']:$payname=null;

$minpay = $setting['minpay'];
$ifnumber = preg_match("/^([0-9.]{1,})$/",$usermoney);
if($ifnumber==false){
    echo 'e9';
    exit;
}

if($usermoney < $minpay){
    echo 'error';
    exit;
}

if($usermoney > $moneypay){
    echo '0';
    exit;
}else{
    ini_set("date.timezone","PRC");
    $time = time();
    $paysql = "insert into dunling_pay (username,time,money,alipay,payname,zt) values ('$username','$time','$usermoney','$alipay','$payname','0')";
    $menber_money_upsql = "update dunling_menber set moneypay = moneypay-'$usermoney' where username='$username'";
    mysql_query($paysql,$config);
    mysql_query($menber_money_upsql,$config);
    echo '1';
    mysql_close();
}
?>