コード例 #1
0
ファイル: game.php プロジェクト: bumasa/casino
        if (21 < $scd) {
            $win = $bet * 2;
            if ($mydouble == "Ok") {
                $win *= 2;
                $state = "1|0|0|0|1|6";
            } else {
                $state = "1|0|0|0|1|4";
            }
        }
        if ($scd == $scp) {
            $win = $bet;
            if ($mydouble == "Ok") {
                $win *= 2;
            }
            $state = "1|0|0|0|1|8";
        }
        $scoresplayer = "0|0," . $scp . "|{$scp}";
        $scoresdealer = "0|0," . $scd1 . "|{$scd1},{$scd2}|{$scd2},{$scd3}|{$scd3},{$scd4}|{$scd4},{$scd5}|{$scd5}";
        $payout = "0.0|" . $win . "|0.0|{$win}";
        if ($win > 0) {
            mysql_query("update users set cash=cash+'{$win}' where login='******'");
            mysql_query("update game_bank set bank=bank-'{$win}' where name='ttuz'");
        }
        $cash = cash($l);
        mysql_query("INSERT INTO stat_game VALUES('NULL','" . $date . "','{$time}','{$l}','{$cash}','{$bet}','{$win}','BlackJack')");
        $bet3 = $bet . ".0|{$bet}.0|0.0|{$bet}.0|0.0";
        echo "STATE=" . $state . "&SCORESDEALER={$scoresdealer}&CARDSDEALER={$cardsdealer}&JACKPOT=0.00&SCORESPLAYER={$scoresplayer}&PAYOUT={$payout}&CARDSPLAYER={$cardsplayer}&BET={$bet3}&RESULT=OK&BALANCE={$cash}&";
        unset($_SESSION['cardsdealer']);
        unset($_SESSION['cardsplayer']);
    }
}
コード例 #2
0
 public function set_budget()
 {
     try {
         $budget = new Budget();
         $budget->user_id = auth()->user()->id;
         $budget->expenses = Request::input('expenses');
         $budget->savings = Request::input('savings');
         $budget->invest = Request::input('invest');
         $budget->income = Request::input('income');
         function cash($x)
         {
             $total = $x->expenses + $x->savings + $x->invest;
             if ($total < $x->income) {
                 return $x->income - $total;
             } else {
                 return 0.0;
             }
         }
         $budget->cash = cash($budget);
         $budget->save($budget);
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }