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

if($shenhe=="1"){
    $updatesql = "update dunling_renwu_log set shenhe='1' where id='$id'";
    mysql_query($updatesql,$config);

    $dansql = "select * from dunling_renwu_log where id = '$id' and username='$username'";
    $gao = mysql_query($dansql,$config);
    $g = mysql_fetch_array($gao);
    $danjia = $g['danjia'];
    $user = $g['user'];
    $danhao = $g['danhao'];
    
    $upusersql = "update dunling_user set jinbi=jinbi+'$danjia' where username='$user'";
    mysql_query($upusersql,$config);
    
    $datetime = time();
    isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$ip = $_SERVER['HTTP_X_FORWARDED_FOR']:$ip = $_SERVER['REMOTE_ADDR'];
    $logsql = "insert into dunling_renwu_shouru_log (username,danhao,danjia,datetime,ip,lx) values ('$user','$danhao','$danjia','$datetime','$ip','任务赚钱')";
    mysql_query($logsql,$config);
    
}

if($shenhe=="2"){
    $updatesql = "update dunling_renwu_log set shenhe='2' where id='$id'";
    mysql_query($updatesql,$config);
}
echo 'ok';
?>