Файл: billing/_rootbill/_addfunds.inc.php
Строк: 112
<?
    $money=floatval($money); $money=round($money/CURK,2);
    if ($sub == "pay") {
        if ($money < 1) { $error = $_lang[FundsMinSumm]." ".round(1*CURK,2)." ".CURS; }
        else {
            @mysql_query("insert into bills (uid,money,created,addfunds) values(".$_SESSION["userId"].",$money,NOW(),1)") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            $bill_id = mysql_insert_id();
            Header("Location: billing.php?do=pay&id=$bill_id");
        }
    }
    if ($sub == "coupon" and $coupon) {
        $coupon = GetCoupon("coupon",$coupon);
        if (!$coupon->id) { $error = $_lang[FundsErrorCoupon]; }
        else if (!IsCanUseCoupon($coupon->id,$_SESSION["userId"])) { $error = $_lang[FundsErrorCoupon]; }
        else {
            @mysql_query("update users set money=money+$coupon->value where id='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            AddUsedByToCoupon($coupon->id,$_SESSION["userId"]);
            addUserLog($_SESSION['userId'], "moneyIn", $_lang[FundsTitle].", ".round($coupon->value*CURK,2)." ".CURS.", coupon $coupon->code");
            $success = $_lang[FundsCouponSuccess];
        }
    }
    _head('utf-8',$_lang[FundsTitle]);
    if ($error) {print "<font color=red>".$_lang[Error].": $error</font><BR><BR>";}
    if ($success) { print "$success ".round($coupon->value*CURK,2)." ".CURS."<BR><BR>"; }
    print "<form method=post>";
    print "<input type=hidden name=do value=addfunds>";
    print "<input type=hidden name=sub value=pay>";
    print $_lang[FundsSumm].": <input class=input type=text name=money value=0.00 size=4> ".CURS.""; 
    print " <input class=button type=submit value='".$_lang[FundsGotoPay]."'>";
    print "</form>";
    print "<form method=post>";
    print "<input type=hidden name=do value=addfunds>";
    print "<input type=hidden name=sub value=coupon>";
    print $_lang[FundsCouponCode].": <input class=input type=text name=coupon size=15>"; 
    print " <input class=button type=submit value='".$_lang[FundsCouponPay]."'>";
    print "</form>";
    _foot('utf-8');
?>