Пример #1
0
        $count[] = $row['count'];
        // Use something like below to filter off domain names
        // $host[]   = preg_replace("/\.tld.domain.*/", "", $row['host']);
        $host[] = $row['host'];
    }
}
// CDUKES: Jun 18, 2008: Added in support of the SQZ feature
if (defined('SQZ_ENABLED') && SQZ_ENABLED == TRUE) {
    $query = "SELECT SUM(counter) FROM " . DEFAULTLOGTABLE . " ";
    $result = perform_query($query, $dbLink) or die(mysql_error());
    $row = fetch_array($result);
    $totalrows = commify($row[0]);
    // die ("Total COUNT rows: $totalrows");
} else {
    if (defined('COUNT_ROWS') && COUNT_ROWS == TRUE && $num_results) {
        $totalrows = commify(get_total_rows(DEFAULTLOGTABLE));
        // die ("Total COUNT rows:" . $totalrows);
    } else {
        // Get Total number of rows
        $query = "SELECT count(*) from " . DEFAULTLOGTABLE;
        $result = perform_query($query, $dbLink) or die(mysql_error());
        $numrows = mysql_num_rows($result);
        $totalrows = commify($numrows);
        // die ("Total rows: $query<br>" . $totalrows);
    }
}
// A new pie graph
$graph = new PieGraph(640, 480, 'auto');
$graph->SetShadow();
// Title setup
/* cdukes - 2-28-08: Added a test to notify the user if they selected more TopX than what was available in the database
Пример #2
0
 *
 */
$basePath = dirname(__FILE__);
require_once $basePath . "/../common_funcs.php";
$dbLink = db_connect_syslog(DBADMIN, DBADMINPW);
session_start();
$username = $_SESSION['username'];
$action = get_input('action');
switch ($action) {
    case "get":
        $username = $_SESSION['username'];
        $sql = "SELECT totd FROM users where username='******'";
        $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
        $line = fetch_array($result);
        if ($line[0] == "show") {
            $count = get_total_rows('totd', $dbLink);
            $sql = "SELECT * FROM totd where lastshown<(SELECT NOW() - INTERVAL " . $_SESSION['TOOLTIP_REPEAT'] . " MINUTE) ORDER BY RAND() LIMIT 1";
            $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
            while ($line = fetch_array($result)) {
                $num = $line['tipnum'];
                $id = $line['id'];
                $name = $line['name'];
                $text = $line['text'];
            }
            if ($id) {
                echo "<i>Tip #{$num} of {$count}</i><br><b>{$name}:</b><br>{$text}";
                $sql = "UPDATE totd SET lastshown=NOW() WHERE id='" . $id . "'";
                perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
            }
        }
        break;
Пример #3
0
     $content_mask = $_GET['content_mask'];
 } else {
     $content_mask = "";
 }
 //construct where clause
 $where = "WHERE 1=1";
 /*
     if (LOG_QUERIES == 'TRUE') {
     $myFile = MYSQL_QUERY_LOG;
     $fh = fopen($myFile, 'a') or die("can't open file $myFile");
     fwrite($fh, print_r($_GET));
     fclose($fh);
     }
 */
 $where .= " AND user='******'username'] . "'";
 $count = get_total_rows("ui_layout", $dbLink, "{$where}");
 if ($count > 0) {
     $total_pages = ceil($count / $limit);
 } else {
     $total_pages = 0;
 }
 if ($page > $total_pages) {
     $page = $total_pages;
 }
 $start = $limit * $page - $limit;
 // do not put $limit*($page - 1)
 $response->page = $page;
 $response->total = $total_pages;
 $response->records = $count;
 $sql = "SELECT * FROM ui_layout {$where} ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}";
 $result = perform_query($sql, $dbLink, $_REQUEST['pageId']);