<?php
header("content-type:text/html;charset=utf-8");
session_start();
error_reporting(0);
if(!isset($_SESSION['username'])){
   exit; 
}
date_default_timezone_set("PRC");
include "../sql.php";
$uid=isset($_POST['suid'])?$_POST['suid']:null;
$chaxun_sql="select * from tixian_shenhe where id={$uid}";

$chaxun_rst=mysql_query($chaxun_sql);
$chaxun_row=mysql_fetch_assoc($chaxun_rst);
$chaxun_cha=$chaxun_row['zonger']-$chaxun_row['tixianjiner'];
if($chaxun_row['shifoutongguo']==1){
    echo "no";
}else{
 
   $tot_sql="update tb_tot set jiage='{$chaxun_cha}' where uid={$chaxun_row['uid']}";
   mysql_query($tot_sql);

   $shenhe_sql="update tixian_shenhe set zonger='{$chaxun_cha}',tixian_yuer='{$chaxun_cha}',shifoutongguo=1 where id={$uid}";
   if(mysql_query($shenhe_sql)){
          echo "yes";
       } 
}
?>