Esempio n. 1
0
<?php

$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$list = $BILL->GetTarifs();
if (count($list)) {
    for ($i = 0; $i < count($list); ++$i) {
        $data = $list[$i];
        $total_time_limit = $data[total_time_limit] ? gethours($data[total_time_limit]) . ":" . getmins($data[total_time_limit]) . ":" . getsecs($data[total_time_limit]) : "неограничено";
        $month_time_limit = $data[month_time_limit] ? gethours($data[month_time_limit]) . ":" . getmins($data[month_time_limit]) . ":" . getsecs($data[month_time_limit]) : "неограничено";
        $week_time_limit = $data[week_time_limit] ? gethours($data[week_time_limit]) . ":" . getmins($data[week_time_limit]) . ":" . getsecs($data[week_time_limit]) : "неограничено";
        $day_time_limit = $data[day_time_limit] ? gethours($data[day_time_limit]) . ":" . getmins($data[day_time_limit]) . ":" . getsecs($data[day_time_limit]) : "неограничено";
        $session_timeout = $data[session_timeout] ? gethours($data[session_timeout]) . ":" . getmins($data[session_timeout]) . ":" . getsecs($data[session_timeout]) : "неограничено";
        $total_traffic_limit = $data[total_traffic_limit] ? bytes2mb($data[total_traffic_limit]) . " Мб" : "неограничено";
        $month_traffic_limit = $data[month_traffic_limit] ? bytes2mb($data[month_traffic_limit]) . " Мб" : "неограничено";
        $week_traffic_limit = $data[week_traffic_limit] ? bytes2mb($data[week_traffic_limit]) . " Мб" : "неограничено";
        $day_traffic_limit = $data[day_traffic_limit] ? bytes2mb($data[day_traffic_limit]) . " Мб" : "неограничено";
        $times_d = NULL;
        $times_hf = NULL;
        $times_ht = NULL;
        $times_mf = NULL;
        $times_mt = NULL;
        makelogintimearrays($data[login_time], &$times_d, &$times_hf, &$times_ht, &$times_mf, &$times_mt);
        $times_d_template_s = array("Mo", "Tu", "We", "Th", "Fr", "Sa", "Wk", "Al");
        $times_d_template_t = array("Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Рабочие дни", "Все дни недели");
        if (isset($times_d) && count($times_d)) {
            $timeslist = "";
            for ($j = 0; $j < count($times_d); ++$j) {
                $dsel = "<select name=times_d[] style=\"width:100%;\" class=tbl1>";
                for ($k = 0; $k < count($times_d_template_s); ++$k) {
                    if ($times_d[$j] == $times_d_template_s[$k]) {
                        $timeslist .= $times_d_template_t[$k];
<?php

if ((!check_auth() || $CURRENT_USER['level'] < 7) && $BILLEVEL != 2) {
    die("Access denied!");
}
require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
require_once dirname(__FILE__) . "/CADBiS/PacketsTodayLimits.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
$ajaxbuf = new ajax_buffer("update_buffer");
$ajaxbuf->show_progress(true);
$ajaxbuf->set_postback_url($_SERVER['REQUEST_URI']);
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
require_once dirname(__FILE__) . "/CADBiS/cadbis_statistic_backend.php";
$packets = $BILL->GetTarifs();
$config = $BILL->GetCADBiSConfig();
$packets_confs = array();
foreach ($packets as &$packet) {
    $accts = $BILL->GetTarifTodayAccts($packet['gid']);
    $packet['accts']['traffic'] = $accts['traffic'];
    $packet['accts']['time'] = $accts['time'];
    $packets_confs[$packet['gid']]['rang'] = new ajax_var('rng' . $packet['gid'], $packet['rang']);
    $packets_confs[$packet['gid']]['exceed_times'] = new ajax_var('et' . $packet['gid'], $packet['exceed_times']);
    $ajaxbuf->register_vars($packets_confs[$packet['gid']]);
}
$max_month_traffic = new ajax_var('max_month_traffic', $config['max_month_traffic'] / 1024 / 1024);
$ajaxbuf->register_var($max_month_traffic);
if ($ajaxbuf->is_post_back()) {
    foreach ($packets as &$packet) {
        $packet['rang'] = $packets_confs[$packet['gid']]['rang']->get_value();
        $packet['exceed_times'] = $packets_confs[$packet['gid']]['exceed_times']->get_value();
        $BILL->UpdateTarif($packet['gid'], $packet);
Esempio n. 3
0
 /**
  * 
  * @param CBilling $BILL
  */
 public function __construct($BILL)
 {
     $this->BILL = $BILL;
     $this->packets = $BILL->GetTarifs();
 }
Esempio n. 4
0
                    $accts[0]["time"] = $data["time"];
                    $accts[0]["packet"] = $tdata["packet"];
                }
            } else {
                $head = "Статистика по тарифам";
            }
            break;
    }
    ?>
    <br><br><div align=center><a href="<?php 
    OUT("?p={$p}&act={$act}");
    ?>
">назад</a></div> 
   <?php 
    if ($action == "today" || $action == "week" || $action == "month") {
        $tarlist = $BILL->GetTarifs();
        $tarsel = "<select name=gid style=\"width:70%\"  class=inputbox><option value=\"all\"></option>";
        for ($i = 0; $i < count($tarlist); ++$i) {
            if ($gid == $tarlist[$i]["gid"]) {
                $sel = " selected";
            } else {
                $sel = "";
            }
            $tarsel .= "<option value=\"" . $tarlist[$i]["gid"] . "\"{$sel}>" . $tarlist[$i]["packet"] . "</option>\r\n";
        }
        $tarsel .= "</select>";
        ?>
   <form action="<?php 
        OUT("?p={$p}&act={$act}&action={$action}&draw={$draw}&sort={$sort}");
        ?>
" method=post>