Beispiel #1
0
function UserTimeTraffic()
{
    global $SAMSConf;
    global $DATE;
    global $USERConf;
    global $SquidUSERConf;
    if (isset($_GET["id"])) {
        $id = $_GET["id"];
    }
    $SquidUSERConf = new SAMSUSER();
    $SquidUSERConf->sams_user($id);
    if ($USERConf->ToWebInterfaceAccess("GSC") != 1 && ($USERConf->s_user_id != $SquidUSERConf->s_user_id && $USERConf->ToWebInterfaceAccess("W") != 1)) {
        exit(0);
    }
    $DB = new SAMSDB();
    $sdate = $DATE->sdate();
    $edate = $DATE->edate();
    $bdate = $DATE->BeginDate();
    $eddate = $DATE->EndDate();
    $sday = $DATE->sday;
    $smon = $DATE->smon;
    $syea = $DATE->syea;
    $shou = $DATE->shou;
    $eday = $DATE->eday;
    $emon = $DATE->emon;
    $eyea = $DATE->eyea;
    require "reportsclass.php";
    $dateselect = new DATESELECT($DATE->sdate(), $DATE->edate());
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if ($USERConf->ToWebInterfaceAccess("WAUC") != 1) {
        exit(0);
    }
    PageTop("ttraffic_48.jpg", "{$traffic_1} <FONT COLOR=\"BLUE\"> {$SquidUSERConf->s_nick}</FONT><BR>{$URLTimeForm_userbuttom_4_time_1}<BR>{$bdate}");
    print "<TABLE WIDTH=\"90%\"><TR><TD>";
    print "<FORM NAME=\"UserIDForm\" ACTION=\"main.php\">\n";
    print "<INPUT TYPE=\"HIDDEN\" NAME=\"id\" id=id value=\"{$SquidUSERConf->s_user_id}\">\n";
    print "<INPUT TYPE=\"HIDDEN\" NAME=\"show\" id=Show value=\"exe\">\n";
    print "<INPUT TYPE=\"HIDDEN\" NAME=\"function\" id=function value=\"usertimetraffic\">\n";
    print "<INPUT TYPE=\"HIDDEN\" NAME=\"filename\" id=filename value=\"userbuttom_3_time.php\">\n";
    $dateselect->SetDate();
    print "<TD><IMG SRC=\"{$SAMSConf->ICONSET}/printer.gif\" TITLE=\"Print\" ALT=\"Print\" onClick=\"JavaScript:window.print();\"></TABLE>\n";
    print "</FORM>\n";
    $URL = array("time" => array(), "url" => array(), "method" => array());
    $count = 0;
    $QUERY = "SELECT * FROM (SELECT substring(s_time from 1 for 5) as time  , substring( s_url from position('//' in s_url)+2 for position('/' in substring(s_url from position('/' in s_url)+2 )) ) as url_domain, s_method FROM squidcache WHERE s_user='******' AND s_date='{$sdate}' AND s_method!='CONNECT' ORDER BY s_time) AS _cache GROUP BY _cache.time,_cache.url_domain ORDER BY _cache.time";
    $num_rows = $DB->samsdb_query_value($QUERY);
    while ($row = $DB->samsdb_fetch_array()) {
        $URL["time"][$count] = $row['time'];
        $URL["url"][$count] = str_replace("/", "", $row['url_domain']);
        $URL["method"][$count] = $row['s_method'];
        $count++;
    }
    $QUERY = "SELECT * FROM (SELECT substring(s_time from 1 for 5) as time, s_url as url_domain,  s_method FROM squidcache WHERE s_user='******' AND s_date='{$sdate}' AND s_method='CONNECT' ORDER BY s_time) AS _cache GROUP BY _cache.time,_cache.url_domain ORDER BY _cache.time";
    $num_rows = $DB->samsdb_query_value($QUERY);
    while ($row = $DB->samsdb_fetch_array()) {
        $URL["time"][$count] = $row['time'];
        $URL["url"][$count] = str_replace("/", "", $row['url_domain']);
        $URL["method"][$count] = $row['s_method'];
        $count++;
    }
    print "<CENTER>\n";
    print "<script type=\"text/javascript\" src=\"lib/jquery-1.2.6.js\"></script>\n";
    print "<script type=\"text/javascript\" src=\"lib/jquery.dataTables.js\"></script>\n";
    print "<script type=\"text/javascript\">\n";
    print "\$(document).ready(function(){\n";
    print "  \$(\"#urltime\").dataTable({\n";
    print "\t\"bInfo\": 0,\n";
    print "\t\"iDisplayLength\": {$count},\n";
    print "\t\"iDisplayStart\": 0,\n";
    print "\t\"iDisplayEnd\": {$count},\n";
    print "\t\"oLanguage\": {\n";
    print "\t\t\"sSearch\": \"search\", \n";
    print "\t\t\"sLengthMenu\": \"Show _MENU_ entries\"\n";
    print "\t\t},\n";
    print "\t\"aoColumns\": [ \n";
    print "\t\t{ \"sType\": \"numeric\", \"sWidth\": \"15%\" },\n";
    print "\t\t{ \"sType\": \"html\", \"sWidth\": \"75%\"},\n";
    print "\t\t{ \"sType\": \"html\", \"sWidth\": \"10%\"},\n";
    print "    ]\n";
    print "  });\n";
    print "});\n";
    print "</script>\n";
    print "</CENTER>\n";
    asort($URL["time"]);
    reset($URL["time"]);
    $cache = 0;
    print "<TABLE CLASS=samstable id=\"urltime\" WIDTH=80%>";
    print "<THEAD>\n";
    print "<TH>Time";
    print "<TH>URL";
    print "<TH>Method";
    print "</THEAD>\n";
    print "<TBODY>\n";
    $size = 0;
    asort($URL["time"]);
    reset($URL["time"]);
    while (list($key, $val) = each($URL["time"])) {
        print "<TR>";
        LTableCell($URL['time'][$key], 15);
        if ($USERConf->ToWebInterfaceAccess("C") == 1) {
            RTableCell($URL['url'][$key], 75);
        }
        RTableCell($URL['method'][$key], 15);
        print "</TR>\n";
    }
    print "</TBODY>\n";
    print "</TABLE>";
}