Exemple #1
0
            $payment->setPhonenumber($_POST["phone"]);
            $payment->setName($_POST["name"]);
            $payment->setAccount(rand(1000, 9999));
            $payment->setStatus(Payment::STATUS_COMPLETED);
            $payment->setAmount($amount);
            $payment->setPostBalance($amount);
            $payment->update();
            print "Payment created";
        }
    }
}
//////////////////////////////////////////////////////////////////////////////
// display the page
$slow->assign(array("DAY" => date("d-m-Y"), "TIME" => date("H:s")));
$slow->parse();
$slow->slowPrint();
function numberInput($input)
{
    $input = trim($input);
    $amount = 0;
    if (preg_match("/^[0-9,]+\$/", $input)) {
        $amount = 100 * (int) str_replace(',', '', $input);
    } elseif (preg_match("/^[0-9,]+\\.[0-9]\$/", $input)) {
        $amount = 10 * (int) str_replace(array('.', ','), '', $input);
    } elseif (preg_match("/^[0-9,]*\\.[0-9][0-9]\$/", $input)) {
        $amount = (int) str_replace(array('.', ','), '', $input);
    } else {
        $amount = (int) $input;
    }
    return $amount;
}