示例#1
0
 /**
  * recalculates packets limits
  *
  * @param array $packets
  */
 protected function recalcTrafficLimits()
 {
     $config = $this->BILL->GetCADBiSConfig();
     $maximumMonthTraffic = $config['max_month_traffic'];
     $monthAccts = $this->BILL->GetMonthTotalAccts();
     $this->usedMonthTraffic = $monthAccts['traffic'] ? $monthAccts['traffic'] : 0;
     $this->restDaysCount = date("t") - date("j") + 1;
     $this->restMonthTraffic = $maximumMonthTraffic - $this->usedMonthTraffic;
     $this->allowedDayTraffic = $this->restMonthTraffic / $this->restDaysCount;
     $SumOfRangs = 0;
     for ($i = 0; $i < count($this->packets); ++$i) {
         $SumOfRangs += $this->packets[$i]['rang'] * $this->packets[$i]['simuluse_sum'];
     }
     for ($i = 0; $i < count($this->packets); ++$i) {
         $this->packetsCoefs[$this->packets[$i]['gid']] = (double) $this->packets[$i]['rang'] * (double) $this->packets[$i]['simuluse_sum'] / (double) $SumOfRangs;
     }
     $this->onePointCost = round($this->allowedDayTraffic / (double) $SumOfRangs);
     for ($i = 0; $i < count($this->packets); ++$i) {
         $dayLimit = round($this->allowedDayTraffic * $this->packetsCoefs[$this->packets[$i]['gid']]);
         $restPacketMonthTraffic = $dayLimit * $this->restDaysCount;
         $this->monthTrafficLimits[$this->packets[$i]['gid']] = $restPacketMonthTraffic;
         if (($this->packets[$i]['exceed_times'] + 1) * $dayLimit <= $restPacketMonthTraffic) {
             $dayLimit *= $this->packets[$i]['exceed_times'] + 1;
         } else {
             $dayLimit = $restPacketMonthTraffic;
         }
         $this->dayTrafficLimits[$this->packets[$i]['gid']] = $dayLimit;
     }
 }
<?php

if (!check_auth() || $CURRENT_USER['level'] < 7) {
    die("Access denied!");
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$gid = 0;
$packet = null;
if (isset($_POST['btnSave'])) {
    $gid = $_POST['hdnGid'];
    $BILL->SetUrlCategoriesDenied($gid, array());
    foreach ($_POST['deniedcats'] as $gid => $dencats) {
        $BILL->SetUrlCategoriesDenied($gid, array_keys($dencats));
    }
}
if (isset($_POST['btnFilter'])) {
    $gid = $_POST['selPacket'];
}
if ($gid > 0) {
    $packet = $BILL->GetTarifData($gid);
}
$packets = $BILL->GetTarifs();
$cats = $BILL->GetUrlCategories();
示例#3
0
">назад</a></div>      
       <?php 
                $form = 0;
            } else {
                $form = true;
                echo $res;
            }
        }
    } else {
        echo $error;
        $form = 1;
    }
}
if ($form) {
    if (!isset($mod) && isset($mode) && $mode == "edit" && isset($gid)) {
        $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
        $data = $BILL->GetTarifData($gid);
        $vars[0] = $data['packet'];
        $activated = !$data['blocked'];
        $time_vals[0] = gethours($data['total_time_limit']);
        $time_vals[1] = getmins($data['total_time_limit']);
        $time_vals[2] = getsecs($data['total_time_limit']);
        $time_vals[3] = gethours($data['month_time_limit']);
        $time_vals[4] = getmins($data['month_time_limit']);
        $time_vals[5] = getsecs($data['month_time_limit']);
        $time_vals[6] = gethours($data['week_time_limit']);
        $time_vals[7] = getmins($data['week_time_limit']);
        $time_vals[8] = getsecs($data['week_time_limit']);
        $time_vals[9] = gethours($data['day_time_limit']);
        $time_vals[10] = getmins($data['day_time_limit']);
        $time_vals[11] = getsecs($data['day_time_limit']);
示例#4
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];
示例#5
0
    } else {
        ?>
 <div align=left><a href="<?php 
        OUT("?p={$p}&act={$act}&action={$action}&show=tbl&page={$page}");
        ?>
">Отобразить в виде таблицы</a></div>
 <?php 
    }
    if ($form) {
        if (!isset($page) || $page < 1 && $page != "all") {
            $page = 1;
        }
        if (!isset($sort)) {
            $sort = "";
        }
        $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
        $ulist = $BILL->GetUsersList($sort);
        if ($sort == "traffic" || $sort == "time") {
            for ($i = 0; $i < count($ulist); ++$i) {
                $data = $BILL->GetUserTotalAcctsData($ulist[$i]);
                $tmplist[$i]["traffic"] = $data["traffic"];
                $tmplist[$i]["uid"] = $ulist[$i];
                $tmplist[$i]["time"] = $data["time"];
            }
            if ($sort == "traffic") {
                usort($tmplist, "accts_compare_traffic_desc");
            } elseif ($sort == "time") {
                usort($tmplist, "accts_compare_time_desc");
            }
            $tmplist = array_values($tmplist);
            for ($i = 0; $i < count($tmplist); ++$i) {
示例#6
0
<?php

include "restore_confs.php";
error_reporting(E_PARSE);
if ($BILLEVEL < 3 && $action != "topurl") {
    die($CURRENT_USER["level"] . "");
} elseif ($BILLEVEL <= 1) {
    die("");
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
include "graph_class.php";
$gr = new CGraph();
//настройки графика
$params = array();
$params[0] = 600;
$params[1] = 500;
$params[2] = 255;
$params[3] = 255;
$params[4] = 255;
$params[5] = 0;
$params[6] = 0;
$params[7] = 0;
$params[8] = 155;
$params[9] = 155;
$params[10] = 155;
$params[11] = 50;
$params[12] = 50;
$params[13] = "./GOST_A.TTF";
$params[15] = "";
$params[16] = "";
$params[17] = 6;
<?php

define('COUNT_ON_PAGE', 30);
if (!check_auth() || $CURRENT_USER['level'] < 7) {
    die("Access denied!");
}
require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
CADBiSNew::instance()->link_href('skins/smadbis/css/grid.css');
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$cats = $BILL->GetUrlCategoriesAssoc();
// any action on selected keywords
if (isset($_POST['selected_kwds'])) {
    $selkwds = $_POST['selected_kwds'];
    foreach ($selkwds as $word => $on) {
        if (isset($_POST['btnLeave'])) {
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnDelete'])) {
            $BILL->DeleteUrlCategoryKeyword($word);
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnReplace'])) {
            $keyword = $BILL->GetUrlCategoryConflictKeyword($word);
            $BILL->ReplaceUrlCategoryKeyword($word, $keyword['forcid']);
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnUnsense'])) {
            $BILL->AddUrlCategoryUnsenseword($word);
            $BILL->DeleteUrlCategoryKeyword($word);
            $BILL->ResolveUrlCategoryConflict($word);
        }
    }
}
示例#8
0
<?php

if ($BILLEVEL < 3) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$BILL->KillInactiveUsers();
if (!isset($sort)) {
    $sort = "start_time";
}
$list = $BILL->GetOnlineUsersData($sort);
if (!isset($action)) {
    $action = "";
}
if ($action == "message") {
    if ($sure == "true") {
        $klmessage = str_replace("'", "", $klmessage);
        $klmessage = $FLTR->DirectProcessString($klmessage);
        $prg = $GV["send_program"] . " " . $klip . " '" . $klmessage . "'" . " &";
        //die($prg);
        //$res=shell_exec("nohup $prg> /dev/null 2>&1 &");
        $res = shell_exec("{$prg}");
        //echo($prg.":<br>".$res."<br>");
        //exec($GV["kill_program"]." ".$user." ".$server." ".$ip." ".$port);
        //$BILL->KillUser($port);
        //$list=$BILL->GetOnlineUsersData();
        setpage("?p={$p}&act={$act}");
    } else {
        ?>
     <div align=center><b>Напишите сообщение следующим пользователям:</b></div>
     <table width=100% align=center class=tbl2><td> 
示例#9
0
<?php

if ($BILLEVEL < 3) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
/**
 * render icon for file format
 *
 * @param string $ctype
 */
function log_url_format_ctype($ctype)
{
    $ctype_ico_match = array('text/html' => 'img/icons/html.jpg', 'avi' => 'img/icons/avi.jpg', 'javascript' => 'img/icons/js.gif', 'pdf' => 'img/icons/pdf.jpg', 'image/png' => 'img/icons/png.png', 'image/gif' => 'img/icons/gif.gif', 'image/jpeg' => 'img/icons/jpeg.gif', 'text/plain' => 'img/icons/txt.png', 'text/x' => 'img/icons/xml.png', 'rar' => 'img/icons/rar.png', 'text/xml' => 'img/icons/xml.png', 'mp3' => 'img/icons/mp3.png', 'swf' => 'img/icons/swf.jpg', 'x-icon' => 'img/icons/gif.gif', 'image/icons' => 'img/icons/gif.gif', 'rdf+xml' => 'img/icons/xml.png', 'shockwave-flash' => 'img/icons/swf.jpg', 'text/css' => 'img/icons/css.jpg', 'default' => 'img/icons/file.png', 'video/' => 'img/icons/video.gif', 'audio/' => 'img/icons/mp3.jpg', 'application/xml' => 'img/icons/xml.png', 'application/json' => 'img/icons/js.gif');
    $res = "";
    foreach ($ctype_ico_match as $key => $value) {
        if (stristr($ctype, $key)) {
            $res = $value;
            break;
        }
    }
    if (!empty($res)) {
        $res = '<img src="' . $res . '" width="30px" height="30px" title="' . $ctype . '"/>';
    } else {
        $res = $ctype;
    }
    return $res;
}
/**
 * Primitive paging
 *
示例#10
0
 function IsUserExistsById($id)
 {
     global $MDL, $GV, $CURRENT_USER;
     $MDL->Load("smadbis");
     $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
     return $BILL->IsUserExistsByUid($id);
     /*include $this->list_file;
       return (file_exists($this->data_dir."/".$id) && is_file($this->data_dir."/".$id));*/
 }
//////////////////////////////////////////////////////////////
$SSIfile = "../skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CAdmin.php";
require $Root_Path . "bin/config.php";
require $Root_Path . "bin/CBilling.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oBilling = new CBilling($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
////////////////////////////////////////////////
//Login Processing
////////////////////////////////////////////////
//Check if admin is logged in already
if (!isset($_SESSION['LOGIN'])) {
    $login = "******";
    header('Location: ./index.php');
} else {
    if ($_SESSION['LOGIN'] != true) {
        if (isset($_SESSION['UNAME'])) {
            unset($_SESSION['UNAME']);
        }
        if (isset($_SESSION['LOGIN'])) {
<?php

if (!check_auth() || $CURRENT_USER['level'] < 7) {
    die("Access denied!");
}
require_once dirname(__FILE__) . '/CADBiS/recognize.php';
if (isset($_GET['urlcheck']) || !empty($_GET['urlcheck'])) {
    die(Recognizer::recognizeByUrlCheck($_GET['url']));
} else {
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    $result = "";
    $url = "www.yandex.ru";
    if (isset($_REQUEST['url'])) {
        $url = $_REQUEST['url'];
    }
    $current_cid = $BILL->GetUrlCategory($url);
    $cats = $BILL->GetUrlCategories();
    $kwds_weights = $BILL->GetKeywordsWeights();
    $cat_by_cid = array();
    $i = 0;
    foreach ($cats as &$cat) {
        $cat_by_cid[$cat['cid']] = $i++;
        $cat['keywords'] = $BILL->GetUrlCategoryKeywords($cat['cid']);
    }
    // Setting url category
    if (isset($_GET['set']) || isset($_POST['btnAttach'])) {
        if ($setcid > 0 && !empty($url)) {
            $BILL->AddUrlCategoryMatch($url, $setcid);
        }
    }
    // Applying conflicts resolves
示例#13
0
<?php

if ($BILLEVEL < 3) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
if (isset($mod) && $mod == "users") {
    $tdata = $BILL->GetTarifData($gid);
    $list = $BILL->GetUsersOfTarif($gid);
    ?>
  <div align=center><a href="<?php 
    OUT("?p={$p}&act={$act}&action={$action}");
    ?>
">назад</a></div>
  <div align=center><b>Список пользователей тарифа '<?php 
    OUT($tdata['packet']);
    ?>
'</b></div>
  <table width=100% class=tbl2>
  <tr>
  <td class=tbl1>№</td>
  <td class=tbl1>Логин</td>
  <td class=tbl1>ФИО</td>
  <td class=tbl1>Трафик</td>
  <td class=tbl1>Время</td>
  <td class=tbl1>Действия</td>
  </tr>
  <?php 
    for ($i = 0; $i < count($list); ++$i) {
        $adata = $BILL->GetUserTotalAcctsData($list[$i]["uid"]);
        ?>
示例#14
0
    return;
}
if (!isset($action)) {
    $action = "";
}
if (!isset($mod)) {
    $mod = "";
}
if (!isset($sort)) {
    $sort = ">traffic";
}
if ($action) {
    if (!isset($gid)) {
        $gid = "all";
    }
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    switch ($action) {
        case "today":
            $accts = $BILL->GetTodayUsersAccts($sort, 0, $gid);
            $wday = date("w");
            if ($wday == 0) {
                $wday = 6;
            }
            $head = "Статистика по пользователям за " . $wdaysto[$wday - 1] . ", " . date("d") . " " . $monthsof[date("n") - 1] . "" . date(" Y года");
            break;
        case "month":
            $accts = $BILL->GetMonthUsersAccts($sort, 0, $gid);
            $head = "Статистика по пользователям за " . $months[date("n") - 1] . " " . date("Y") . " года:<br>\n   <small>(по состоянию на " . date("d") . " " . $monthsof[date("n") - 1] . ")</small>";
            break;
        case "week":
            $accts = $BILL->GetWeekUsersAccts($sort, 0, $gid);
示例#15
0
  <?php 
} elseif ($act == "users") {
    if ($BILLEVEL < 3) {
        return;
    }
    ?>
 <div align=center><b>Пользователи</b></div><br>
 <?php 
    if (isset($action) && $action == "add") {
        include SK_DIR . "/billing/admin_add_user.php";
    } elseif (isset($action) && $action == "delete") {
        include SK_DIR . "/billing/admin_delete_user.php";
    } elseif (isset($action) && $action == "edit") {
        include SK_DIR . "/billing/admin_edit_user.php";
    } elseif (isset($action) && $action == "block") {
        $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
        if ($BILL->IsUserActivated($uid)) {
            $BILL->BlockUser($uid);
            ?>
    <div align=center><b>Пользователь заблокирован!</b></div>
    <?php 
        } else {
            $BILL->ActivateUser($uid);
            ?>
    <div align=center><b>Пользователь активирован!</b></div>
    <?php 
        }
        ?>
  <div align=center><a href="<?php 
        OUT("?p={$p}&act={$act}");
        ?>
示例#16
0
<?php

if ($BILLEVEL < 5) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$BILL->KillInactiveUsers();
$list = $BILL->GetOnlineUsersData();
if (!isset($action)) {
    $action = "";
}
if ($action == "save") {
    $error = "";
    $GV['max_month_traffic'] = mb2bytes($max_month_traffic);
    $GV['start_year'] = $start_year;
    $res = "<?php\r\n";
    $res .= "\$GV['start_year']=" . $GV['start_year'] . ";\r\n";
    $res .= "\$GV['max_month_traffic']=" . $GV['max_month_traffic'] . ";\r\n";
    $res .= "\$GV['max_month_time']=" . $GV['max_month_time'] . ";\r\n";
    $res .= "?>";
    $fp = fopen($GV["modules_conf_dir"] . "/smadbisext.conf.php", "w+");
    if (!$fp) {
        $error .= "<b>Ошибка:</b> Невозможно открыть файл!";
    }
    if (!$error) {
        fwrite($fp, $res);
        fclose($fp);
    }
    if (!$error) {
        OUT("<div align=center>Сохранено!</div><br><div align=center><a href=\"?p={$p}&act={$act}\">назад</a></div>");
    } else {
示例#17
0
function is_gid_allowed($gid, $BILLEVEL)
{
    global $GV, $CURRENT_USER;
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    $data = $BILL->GetTarifData($gid);
    if (!$data) {
        return true;
    }
    return $data[level] <= $BILLEVEL;
}
<?php

if (!check_auth() || $CURRENT_USER['level'] < 7) {
    die("Access denied!");
}
require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
CADBiSNew::instance()->script_src('js/ajax/manager.js');
CADBiSNew::instance()->link_href('skins/smadbis/css/grid.css');
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
if (isset($_REQUEST['renderkwdsfor'])) {
    $cid = $_REQUEST['renderkwdsfor'];
    die(implode(", ", $BILL->GetUrlCategoryKeywordsWithWeights($cid)));
}
$ajaxbuf_cats = new ajax_buffer("update_buffer_cats");
$ajaxbuf_cats->show_progress(true);
$emanager = new ajax_entities_manager('entities_manager', $ajaxbuf_cats);
class cats_formatter extends grid_formatter
{
    protected $_field = '';
    /**
     * Entities manager
     * @var ajax_entities_manager
     */
    protected $_entities_manager = null;
    /**
     * @param string $field
     * @param ajax_entities_manager $entities_manager
     */
    public function __construct($field, $entities_manager)
    {
示例#19
0
<?php

error_reporting(E_PARSE);
include "restore_confs.php";
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$cur = $BILL->GetMonthTotalAccts();
$mon = $BILL->GetMonthMaxAccts();
$imgnum = 20.0;
$prc_tr = (double) $cur["traffic"] / (double) $mon["traffic"] * 100.0;
$perimg = 100.0 / $imgnum;
$year = date("Y");
$month = date("m");
$day = date("d");
$daycount = date("t");
$maxtraf = 0;
$daynorm = $mon["traffic"] / $daycount;
$rest = $mon["traffic"] - $cur["traffic"];
$dnrm = $rest / ($daycount - $day + 1);
$k = $dnrm < 0 ? -90000 : 100;
$prc_tr2 = (double) $daynorm / (double) $dnrm * 100.0 - $k;
if ($prc_tr2 > 100) {
    $prc_tr2 = 100;
}
if ($prc_tr2 < 0) {
    $prc_tr2 = 0;
}
$imgnum = (int) ((double) $prc_tr2 / $perimg);
$imgnum += 1;
if ($imgnum > 20) {
    $imgnum = 20;
}
<?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);
示例#21
0
                ?>
">назад</a></div>   
      <?php 
                $form = 0;
            } else {
                $form = true;
                echo $res;
            }
        }
    } else {
        echo $error;
        $form = 1;
    }
}
if ($form) {
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    if (!isset($mod) && isset($mode) && $mode == "edit" && isset($uid)) {
        $vars = array();
        $user = $BILL->GetUserData($uid);
        $k = 0;
        $vars[$k++] = $user['user'];
        $k += 2;
        //$vars[1]=$user['password'];
        //$vars[2]=$user['password'];
        $vars[$k++] = $user['gid'];
        $vars[$k++] = $user['max_total_traffic'];
        $vars[$k++] = $user['max_month_traffic'];
        $vars[$k++] = $user['max_week_traffic'];
        $vars[$k++] = $user['max_day_traffic'];
        $vars[$k++] = $user['simultaneous_use'];
        $vars[$k++] = $user['fio'];
<?php

if (!check_auth() || $CURRENT_USER['level'] < 7) {
    die("Access denied!");
}
require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
CADBiSNew::instance()->script_src('js/ajax/manager.js');
CADBiSNew::instance()->link_href('skins/smadbis/css/grid.css');
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$cats = $BILL->GetUrlCategories();
global $cats_cid;
$cats_cid_title = array();
foreach ($cats as $cat) {
    $cats_cid[$cat['cid']] = $cat;
}
$ajaxbuf_url_cats = new ajax_buffer("update_buffer_cats");
$emanager = new ajax_entities_manager('entities_manager', $ajaxbuf_url_cats);
$ajaxbuf_url_matched_cats = new ajax_buffer("update_buffer_cats_matched");
//$emanager_matched = new ajax_entities_manager('entities_manager_matched', $ajaxbuf_url_matched_cats);
class cat_urls_formatter extends grid_formatter
{
    protected $_field = '';
    /**
     * Entities manager
     * @var ajax_entities_manager
     */
    protected $_cats_cid_title = null;
    protected $_manager = '{}';
    /**
     * @param string $field
<?php

if ($BILLEVEL < 4) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
if (isset($mod) && $mod == "users") {
    $tdata = $BILL->GetTarifData($gid);
    $list = $BILL->GetUsersOfTarif($gid);
    ?>
  <div align=center><a href="<?php 
    OUT("?p={$p}&act={$act}&action={$action}");
    ?>
">назад</a></div>
  <div align=center><b>Список пользователей тарифа '<?php 
    OUT($tdata['packet']);
    ?>
'</b></div>
  <table width=100% class=tbl2>
  <tr>
  <td class=tbl1>№</td> 
  <td class=tbl1>Логин</td>
  <td class=tbl1>ФИО</td> 
  <td class=tbl1>Трафик</td>
  <td class=tbl1>Время</td>
  <td class=tbl1>Действия</td>  
  </tr>
  <?php 
    for ($i = 0; $i < count($list); ++$i) {
        $adata = $BILL->GetUserTotalAcctsData($list[$i]["uid"]);
        ?>
示例#24
0
<?php

if ($BILLEVEL < 5) {
    return;
}
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$countries = $BILL->GetAvailableCountries();
if ($_POST['country'] || $_GET['country']) {
    $country = $_POST['country'] ? $_POST['country'] : $_GET['country'];
}
?>
 <b>Выберите страну:</b>
 <form action="<?php 
echo "?p={$p}&act={$act}";
?>
" method="post">
 <select name="country">
   <?php 
foreach ($countries as $ctry) {
    $sel = isset($country) && $country == $ctry['ctry'] ? "selected" : "";
    ?>
<option value="<?php 
    echo $ctry['ctry'];
    ?>
" <?php 
    echo $sel;
    ?>
><?php 
    echo $ctry['country'] . "(" . $ctry['ctry'] . ")";
    ?>
</option><?php 
示例#25
0
        ?>
<br><br>
                <div align=center><input type=submit class=button value="Удалить!"></div>              
              </form>
               <div align=center><a href="<?php 
        OUT("?p={$p}&act={$act}&action={$action}&page={$page}");
        ?>
">назад</a></div> 
              <?php 
    }
}
if ($form) {
    if (!isset($page) || $page < 1) {
        $page = 1;
    }
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    $ulist = $BILL->GetTarifs();
    $pgcnt = $PDIV->GetPagesCount($ulist);
    $list = $PDIV->GetPage($ulist, $page);
    for ($i = 0; $i < $pgcnt; ++$i) {
        if ($page != $i + 1) {
            $pagestext .= "<a href=\"?p={$p}&act={$act}&action={$action}&page=" . ($i + 1) . "\">" . ($i + 1) . "</a>";
        } else {
            $pagestext .= "" . ($i + 1) . "";
        }
        if ($i < $pgcnt - 1) {
            $pagestext .= ", ";
        }
    }
    ?>
 <form action="<?php 
示例#26
0
        OUT("?p={$p}&act={$act}&action={$action}&page={$page}");
        ?>
">Отобразить с подробными данными</a></div>
 <?php 
    } else {
        ?>
 <div align=left><a href="<?php 
        OUT("?p={$p}&act={$act}&action={$action}&show=tbl&page={$page}");
        ?>
">Отобразить в виде таблицы</a></div>
 <?php 
    }
    if (!isset($page) || $page < 1 && $page != "all") {
        $page = 1;
    }
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    $ulist = $BILL->GetUsersList();
    $pgcnt = $PDIV->GetPagesCount($ulist);
    if ($page != "all") {
        $list = $PDIV->GetPage($ulist, $page);
    } else {
        $list = $ulist;
    }
    for ($i = 0; $i < $pgcnt; ++$i) {
        if ($page != $i + 1) {
            $pagestext .= "<a href=\"?p={$p}&act={$act}&action={$action}&show={$show}&page=" . ($i + 1) . "\">" . ($i + 1) . "</a>";
        } else {
            $pagestext .= "" . ($i + 1) . "";
        }
        $pagestext .= ", ";
    }
//////////////////////////////////////////////////////////////
$SSIfile = "./skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CTipOfTheDay.php";
require $Root_Path . "bin/CBilling.php";
require $Root_Path . "bin/CServMsg.php";
require $Root_Path . "includes/language.php";
require $Root_Path . "includes/siteconfig.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oBilling = new CBilling($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//Check if the logged in user has access
if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) {
    $_SESSION['PageRef'] = $url;
    header('Location: ./chess_login.php');
} else {
    $oR3DCQuery->CheckSIDTimeout();
    if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) {
        $_SESSION['PageRef'] = $url;
        header('Location: ./chess_login.php');
    } else {
        $_SESSION['PageRef'] = "";
        $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);
示例#28
0
<?php

//session_start();
error_reporting(0);
require_once "DrClass.php";
require_once "restore_confs.php";
require_once "funcs.php";
require_once "cadbisnew/graph/charts.php";
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
//include charts.php in your script
if (isset($chart_type)) {
    switch ($chart_type) {
        case "loading":
            $title = "Нагрузка";
            if (!isset($_SESSION['graph_prev_values'])) {
                $_SESSION['graph_prev_values'] = array($title, 0);
            }
            if (!isset($_SESSION['graph_prev_indexes'])) {
                $_SESSION['graph_prev_indexes'] = array(0, 1);
            }
            //��� �������
            $chart['chart_type'] = "line";
            //����� �������
            $chart['legend_label'] = array('font' => "Tahoma");
            $chart['chart_grid_h'] = array('alpha' => 10, 'color' => "000000", 'thickness' => 1, 'type' => "solid");
            $chart['chart_grid_v'] = array('alpha' => 10, 'color' => "000000", 'thickness' => 1, 'type' => "solid");
            $chart['chart_pref'] = array('line_thickness' => 2, 'point_shape' => "none", 'fill_shape' => false);
            //������ ��� �������
            $_SESSION['graph_prev_values'][] = $BILL->getChannelLoading();
            $_SESSION['graph_prev_indexes'][] = $_SESSION['graph_prev_indexes'][count($_SESSION['graph_prev_indexes']) - 1] + 1;
            if (count($_SESSION['graph_prev_values']) == 15) {
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "./skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CTipOfTheDay.php";
require $Root_Path . "bin/CBilling.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "bin/config.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oBilling = new CBilling($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
$RequiresPayment = $oBilling->IsPaymentEnabled();
if (!$bCronEnabled) {
    if ($oR3DCQuery->ELOIsActive()) {
        $oR3DCQuery->ELOCreateRatings();
    }
    $oR3DCQuery->MangeGameTimeOuts();
}
if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) {
    $user = trim($_POST['txtName']);
    $pass = trim($_POST['txtPassword']);
    if ($user != "" && $pass != "") {
        $sid = $oR3DCQuery->Login($user, $pass);
        $id = $oR3DCQuery->GetIDByUserID($config, $user);
示例#30
0
<body>
 <?php 
if (!isset($action)) {
    $action = "";
}
if (!isset($act)) {
    $act = "";
}
if (!isset($sort)) {
    $sort = ">traffic";
}
if (!isset($gid)) {
    $gid = "all";
}
if ($action && $act == "smadbisrept") {
    $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
    switch ($action) {
        case "today":
            $accts = $BILL->GetTodayUsersAccts($sort, 0, $gid);
            $wday = date("w");
            if ($wday == 0) {
                $wday = 6;
            }
            $head = "Статистика по пользователям за " . $wdaysto[$wday - 1] . ", " . date("d") . " " . $monthsof[date("n") - 1] . "" . date(" Y года");
            break;
        case "month":
            $accts = $BILL->GetMonthUsersAccts($sort, 0, $gid);
            $head = "Статистика по пользователям за " . $months[date("n") - 1] . " " . date("Y") . " года:<br>\n   <small>(по состоянию на " . date("d") . " " . $monthsof[date("n") - 1] . ")</small>";
            break;
        case "week":
            $accts = $BILL->GetWeekUsersAccts($sort, 0, $gid);