<?php
error_reporting(0);
require_once("../../check.php");
require_once("../../../config.php");
isset($_POST['money'])?$money=$_POST['money']:$money=null;

$minpaysql = "select * from dunling_config where id='1'";
$minpayery = mysql_query($minpaysql,$config);
$pay = mysql_fetch_array($minpayery);
$conminpay = $pay['minpay'];
if($money<$conminpay){
    echo "minpay";
    exit;
}
$usersql = "select * from dunling_user where username='$username'";
$userery = mysql_query($usersql,$config);
$user = mysql_fetch_array($userery);
$pay1 = $user['pay1'];
$pay2 = $user['pay2'];
$pay3 = $user['pay3'];
$yy = $user['money'];
if($money>$yy){
    echo "no";
    exit;
}
date_default_timezone_set('PRC');
$datetime = time();
$insql = "insert into dunling_pay (username,money,datetime,pay1,pay2,pay3,zt) values ('$username','$money','$datetime','$pay1','$pay2','$pay3','0')";
mysql_query($insql,$config);
$kosql = "update dunling_user set money=money-'$money' where username='$username'";
mysql_query($kosql,$config);
echo "ok";
?>