-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.php
48 lines (43 loc) · 1.11 KB
/
lib.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once "conf.php";
function request($key, $default = "") {
if(isset($_REQUEST[$key])) {
return $_REQUEST[$key];
}
return $default;
}
/**
* not yet implemented
*/
function getInvoiceNumber() {
return rand(100, 1000000);
}
/*
* @return string*
*/
function writeLog($msg, $level = Config::LOG_LEVEL_INFO) {
if($level >= Config::$LOG_LEVEL) {
$file = Config::$LOG_FILE . date("Y-m-d") . ".log";
//if(is_object($msg) || is_array($msg))
$p = print_r($msg, true);
if(!Config::$LOG_MULTILNE)
{
$p = str_replace(array("\r", "\n"), array("{r}", "{n}"), $p);
}
$bytes = file_put_contents($file, date("H:i:s") . " $level $p\n", FILE_APPEND);
}
}
function calcPrice() {
$deps = 0;
$nos = request("nos");
if(request("deposit")) {
$deps++;
}
if(request("dslip")) {
$deps += count($_REQUEST["dslip"]);
}
$apc = Config::$TRANSACTION_AMOUNT["AMOUNT_PAYCHECK"];
$asl = Config::$TRANSACTION_AMOUNT["AMOUNT_SLIP"];
//die("($nos - $deps) * $apc + $deps * ($apc + $asl);");
return ($nos - $deps) * $apc + $deps * ($apc + $asl);
}