コード例 #1
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $the_interval, $date_format, $startDate, $endDate, $wpdb, $tablestattraq, $options, $betweenClause, $width, $drill_date_format, $chart_type, $wpst_chart_url, $wpst_url;
    $orderBy = st_getVar("orderBy", "dd DESC");
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    $results = getPageDBResults($date_format, $time_frame, $betweenClause, $orderBy);
    if ($results) {
        $count = count($results);
        for ($i = 0; $i < $count; $i++) {
            $row = $results[$i];
            $totalHits += $row->cnt;
            if ($maxHits < $row->cnt) {
                $maxHits = $row->cnt;
            }
            $rows[] = $row;
        }
    }
    ?>
<h1><img src="/wp-content/plugins/wp-stattraq/images/hits_icon_32.gif" alt="WordPress Hits" />WordPress Hits</h1>
<p class="description">
	After a page is requested in WordPress the StatTraq plugin is called to enter 
		information about the request.
	This page reflects the total number of pages requested from WordPress (excluding 
		WordPress Admin and StatTraq pages)
</p>
<?php 
    echo "<ul class=\"inline\">";
    echo "<li><a href=\"javascript:return false;\" onclick=\"document.getElementById('chart_img').src='{$wpst_chart_url}chart=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;startDate={$startDate}&amp;endDate={$endDate}&amp;width={$width}&amp;height=270&amp;orderBy={$orderBy}&amp;chart_type=hz_line&amp;limitNumber={$limitNumber}';return false;\">Line</a></li>";
    echo "<li><a href=\"javascript:return false;\" onclick=\"document.getElementById('chart_img').src='{$wpst_chart_url}chart=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;startDate={$startDate}&amp;endDate={$endDate}&amp;width={$width}&amp;height=270&amp;orderBy={$orderBy}&amp;chart_type=hz_bar&amp;limitNumber={$limitNumber}';return false;\">Bar</a></li>";
    echo '</ul>';
    echo "\n<img id=\"chart_img\" class=\"chart-picture\" src=\"{$wpst_chart_url}chart=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;startDate={$startDate}&amp;endDate={$endDate}&amp;width={$width}&amp;height=270&amp;orderBy={$orderBy}&amp;chart_type={$chart_type}&amp;limitNumber={$limitNumber}\" width=\"{$width}\" height=\"270\" alt=\"chart\" />\n";
    if (count($rows) > 0) {
        echo '<p>Average hits during this time period: ' . number_format($totalHits / count($rows), 2) . '</p>';
    } else {
        echo '<p>No hits during this time period.</p>';
    }
    echo '<table>' . '<thead>' . '<tr><th></th>' . ("<th><a href=\"{$wpst_url}view=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\">Hits</a></th>") . "<th>perc.</th>" . "<th>IP</th>" . "<th>Browser</th>" . "<th>Referrer</th>" . '</tr>' . '</thead>';
    echo '<tfoot>' . '<tr><th></th>' . ("<th><a href=\"{$wpst_url}view=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=hit_counter&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format=" . urlencode($date_format) . "&amp;orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\">Hits</a></th>") . "<th>perc.</th>" . "<th>IP</th>" . "<th>Browser</th>" . "<th>Referrer</th>" . '</tr>' . '</tfoot>';
    echo "<tbody>\n";
    $i = 1;
    foreach ($rows as $key => $row) {
        $year = $row->year;
        $month = $row->month;
        $day = $row->day;
        $hour = $row->hour;
        $minute = $row->minute;
        echo '<tr><td>' . $i++ . '</td>';
        if ($drill_date_format != 0) {
            echo "<td><a href=\"{$wpst_url}view=hit_counter&amp;time_frame={$drill_date_format}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}\">{$row->fmtDate}</a></td>";
        } else {
            echo "<td>{$row->fmtDate}</td>";
        }
        echo "<td class=\"right\">{$row->cnt}</td>" . "<td class=\"right\">" . round($row->cnt / $totalHits * 100) . "%</td>" . "<td><a href=\"{$wpst_url}view=ip_address&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;time_frame={$drill_date_format}\">ip addresses</a></td>" . "<td><a href=\"{$wpst_url}view=user_agent&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;time_frame={$drill_date_format}\">User Agents</a></td>" . "<td><a href=\"{$wpst_url}view=referrer&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;time_frame={$drill_date_format}\">Referrer</a></td>" . "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
}
コード例 #2
0
ファイル: sessions.php プロジェクト: prosenjit-itobuz/upages
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $wpdb, $tablestattraq, $wpst_url;
    $orderBy = st_getVar("orderBy", "dd DESC");
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "WHERE session_id <> 0";
    $date_format = "%Y-%m-%d %H:i";
    $drill_date_format = 6;
    $width = 600;
    if ($time_frame == 6) {
        $startDate = st_createDateQueryString($year, 1, 1, 0, 0, 0);
        $endDate = st_createDateQueryString($year, 12, 31, 23, 59, 59);
        $betweenClause .= " AND access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $drill_date_format = 8;
    } else {
        if ($time_frame == 8) {
            $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "01000000";
            $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "31235959";
            $betweenClause .= " AND access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $drill_date_format = 10;
        } else {
            if ($time_frame == 10) {
                $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "000000";
                $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "235959";
                $betweenClause .= " AND access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $drill_date_format = 12;
            } else {
                if ($time_frame == 12) {
                    $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "{$hour}0000";
                    $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "5959";
                    $betweenClause .= " AND access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $drill_date_format = 0;
                    $width = 780;
                }
            }
        }
    }
    echo "<p>Click a session ID for details of that session.</p>";
    $results = getPageDBResults("%Y-%m-%d %H:%i", $time_frame, $betweenClause, $orderBy);
    echo "<table>" . "<thead>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=sessions&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=sessions&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "session_id DESC" ? "session_id ASC" : "session_id DESC") . "\">Session</a></th>") . "</tr>" . "</thead>";
    echo '<tfoot><tr>' . ("<th><a href=\"{$wpst_url}view=sessions&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=sessions&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "session_id DESC" ? "session_id ASC" : "session_id DESC") . "\">Session</a></th>") . '</tr>' . '</tfoot>';
    echo '<tbody>';
    if ($results) {
        foreach ($results as $row) {
            $session_id = $row->session_id;
            echo "<tr>" . "<td>{$row->fmtDate}</td>" . "<td><a href=\"{$wpst_url}view=session&year={$year}&month={$month}&day={$day}&hour={$hour}&time_frame={$drill_date_format}&session_id={$session_id}\">{$session_id}</a></td>" . "<td>{$row->cnt}</td>" . "</tr>";
        }
    } else {
        echo '<tr><td>No data for this time period</td></tr>';
    }
    echo '</tbody></table>';
}
コード例 #3
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $wpdb, $tablestattraq, $betweenClause, $options, $drill_date_format, $startDate, $endDate, $width, $wpst_url, $wpst_chart_url;
    $orderBy = st_getVar("orderBy", "dd DESC");
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    $results = getPageDBResults("%Y-%m-%d %H:%i", $time_frame, $betweenClause, $orderBy);
    if ($results) {
        foreach ($results as $row) {
            $totalHits += $row->cnt;
            if ($maxHits < $row->cnt) {
                $maxHits = $row->cnt;
            }
            $rows[] = $row;
        }
    }
    ?>
<h1><img src="/wp-content/plugins/wp-stattraq/images/hits_icon_32.gif" alt="User Counter" />User Counter</h1>
<p>
	When a browser or user agent visits your WordPress blog each hit is recorded in the database.  StatTraq attempts to set a cookie for your blog to keep track of the user.  However, spiders and <acronym title="Really Simple Syndication">RSS</acronym> feed spiders are often counted as one visitor (Feed services sometimes act as a proxy to reduce the bandwidth required by the service and the stress this adds to your server).
</p>
<?php 
    echo "<br />\n<img class=\"chart-picture\" src=\"{$wpst_chart_url}chart=user_counter&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&startDate={$startDate}&endDate={$endDate}&width={$width}&height=270&orderBy={$orderBy}&amp;limitNumber={$limitNumber}\" width=\"{$width}\" height=\"270\" alt=\"chart\" />\n";
    if (count($rows) > 0) {
        echo "<p>Average hits during this time period: " . number_format($totalHits / count($rows), 2) . "</p>";
    } else {
        echo "<p>No hits during this time period.</p>";
    }
    echo "<table>" . "<thead>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=user_counter&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format=" . urlencode($date_format) . "&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=user_counter&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format=" . urlencode($date_format) . "&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\">Users</a></th>") . "<th>perc.</th>" . "<th>Sessions</th>" . "</tr>" . "</thead>" . "<tfoot>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=user_counter&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format=" . urlencode($date_format) . "&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>") . ("<th><a href=\"{$wpst_url}view=user_counter&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format=" . urlencode($date_format) . "&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\">Users</a></th>") . "<th>perc.</th>" . "<th>Sessions</th>" . "</tr>" . "</tfoot>";
    echo "<tbody>\n";
    foreach ($rows as $row) {
        $str = $row->cnt;
        $year = $row->year;
        $month = $row->month;
        $day = $row->day;
        $hour = $row->hour;
        $minute = $row->minute;
        echo "<tr>";
        if ($drill_date_format != 0) {
            echo "<td><a href=\"{$wpst_url}view=user_counter&time_frame={$drill_date_format}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}\">{$row->fmtDate}</a></td>";
        } else {
            echo "<td>{$row->fmtDate}</td>";
        }
        echo "<td class=\"right\">{$row->cnt}</td>" . "<td class=\"right\">" . round($row->cnt / $totalHits * 100) . "%</td>" . "<td><a href=\"{$wpst_url}view=sessions&year={$year}&month={$month}&day={$day}&hour={$hour}&time_frame={$drill_date_format}\">Sessions</a></td>" . "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
}
コード例 #4
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $showReferrerType, $siteName, $limitNumber, $wpst_url;
    $orderBy = st_getVar("orderBy", "cnt DESC");
    if (strstr($orderBy, 'search_phrase') == false && strstr($orderBy, 'cnt') == false) {
        $orderBy = "cnt DESC";
    }
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "";
    $date_format = "%Y-%m-%d %H:i";
    $drill_date_format = 6;
    $width = 600;
    if ($time_frame == 4) {
        $date_format = "%Y";
    }
    if ($time_frame == 6) {
        $startDate = $year . '0100000000';
        $endDate = $year + 1 . '0101000000';
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $date_format = "%Y-%m";
        $drill_date_format = 8;
    } else {
        if ($time_frame == 8) {
            $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "01000000";
            $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "31235959";
            $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $date_format = "%Y-%m-%d";
            $drill_date_format = 10;
        } else {
            if ($time_frame == 10) {
                $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "000000";
                $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "235959";
                $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $date_format = "%Y-%m-%d %H:00";
                $drill_date_format = 12;
            } else {
                if ($time_frame == 12) {
                    $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "{$hour}0000";
                    $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "5959";
                    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $date_format = "%Y-%m-%d %H:i";
                    $drill_date_format = 0;
                    $width = 780;
                }
            }
        }
    }
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    $results = getPageDBResults($date_format, $time_frame, $betweenClause, $orderBy);
    // START PAGE CONTENT OUTPUT
    echo "<h1><img src=\"/wp-content/plugins/wp-stattraq/images/searches_icon_32.gif\" alt=\"Search Terms\" />Search Terms</h1>";
    echo "<table>" . "<thead>" . "<tr>" . '<th>Search</th>' . ("<th><a href=\"{$wpst_url}view=query_strings&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "search_phrase DESC" ? "search_phrase ASC" : "search_phrase DESC") . "&amp;showReferrerType={$showReferrerType}&amp;limitNumber={$limitNumber}\">Search Term</a></th>") . ("<th><a href=\"{$wpst_url}view=query_strings&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "&amp;showReferrerType={$showReferrerType}&amp;limitNumber={$limitNumber}\"># ref</a></th>") . "</tr>" . "</thead>" . "<tfoot>" . "<tr>" . '<th>Search</th>' . ("<th><a href=\"{$wpst_url}view=query_strings&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format={$date_format}&amp;orderBy=" . ($orderBy == "search_phrase DESC" ? "search_phrase ASC" : "search_phrase DESC") . "&amp;showReferrerType={$showReferrerType}&amp;limitNumber={$limitNumber}\">Search Term</a></th>") . ("<th><a href=\"{$wpst_url}view=query_strings&amp;time_frame={$time_frame}&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;hour={$hour}&amp;minute={$minute}&amp;date_format={$date_format}&amp;orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "&amp;showReferrerType={$showReferrerType}&amp;limitNumber={$limitNumber}\"># ref</a></th>") . "</tr>" . "</tfoot>";
    echo "<tbody>\n";
    if ($results) {
        foreach ($results as $row) {
            echo '<tr><td style="font-size: smaller;"><a href="http://search.yahoo.com/search?p=' . urlencode($row->search_phrase) . '" title="Search Yahoo!">Y</a>|<a href="http://search.msn.com/results.aspx?q=' . urlencode($row->search_phrase) . '" title="Search MSN">M</a></td>' . '<td><a href="http://www.google.com/search?q=' . urlencode($row->search_phrase) . '" title="Search Google">' . htmlentities($row->search_phrase) . '</a></td><td class="right">' . $row->cnt . '</td></tr>';
        }
    } else {
        echo '<tr><td>No Data for this statistic</td></tr>';
    }
    echo "</tbody>" . "\n</table>";
}
コード例 #5
0
ファイル: index.php プロジェクト: prosenjit-itobuz/upages
$options = st_loadOptions();
$year = (int) st_getVar('year', date("Y"));
$month = (int) st_getVar('month', date("m"));
$day = (int) st_getVar('day', date("d"));
$hour = (int) st_getVar('hour', date("H"));
$minute = (int) st_getVar('day', date("i"));
$view = st_getVar('view', $options['default_view']);
$time_frame = st_getVar('time_frame', $options['default_time_frame']);
// day
$orderBy = st_getVar('orderBy', "dd");
$session_id = st_getVar('session_id', 'google');
$limitPage = st_getVar('limitPage', 0);
// the page number for the SQL query limit
$limitNumber = st_getVar('limitNumber', $options['default_limit_number']);
// the number of results to be returned in the query
$showReferrerType = st_getVar('showReferrerType', 0);
$wpst_url = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=wp-stattraq/index.php&";
$wpst_ip_url = get_bloginfo('wpurl') . "/wp-content/plugins/wp-stattraq/access_detail.php?";
$wpst_chart_url = get_bloginfo('wpurl') . "/wp-content/plugins/wp-stattraq/reporter/chart_maker.php?";
// TODO: Check to see if file exists
$views = array('hit_counter', 'ip_address', 'page_views', 'query_strings', 'search_engine_stats', 'referrer', 'session', 'sessions', 'summary', 'user_agent', 'user_counter', 'options');
if (in_array($view, $views)) {
    require_once dirname(__FILE__) . "/reporter/{$view}.php";
} else {
    echo "You hacker you.";
    exit;
}
?>
<div style="clear:right;">
<?php 
require_once 'navigation.php';
コード例 #6
0
ファイル: referrer.php プロジェクト: prosenjit-itobuz/upages
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $showReferrerType, $siteName, $wpdb, $tablestattraq, $wpst_url, $limitNumber;
    $orderBy = st_getVar("orderBy", "cnt DESC");
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "";
    $date_format = "%Y-%m-%d %H:i";
    $drill_date_format = 6;
    $width = 600;
    if ($time_frame == 4) {
        $date_format = "%Y";
    }
    if ($time_frame == 6) {
        $startDate = $year . '0100000000';
        $endDate = $year + 1 . '0101000000';
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $date_format = "%Y-%m";
        $drill_date_format = 8;
    } else {
        if ($time_frame == 8) {
            $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "01000000";
            $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "31235959";
            $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $date_format = "%Y-%m-%d";
            $drill_date_format = 10;
        } else {
            if ($time_frame == 10) {
                $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "000000";
                $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "235959";
                $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $date_format = "%Y-%m-%d %H:00";
                $drill_date_format = 12;
            } else {
                if ($time_frame == 12) {
                    $startDate = st_createDateQueryString($year, $month, $day, $hour, 0, 0);
                    $endDate = st_createDateQueryString($year, $month, $day, $hour, 59, 59);
                    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $date_format = "%Y-%m-%d %H:i";
                    $drill_date_format = 0;
                    $width = 780;
                }
            }
        }
    }
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    $results = getPageDBResults($date_format, $time_frame, $betweenClause, $orderBy, false);
    if ($results) {
        foreach ($results as $row) {
            $totalHits += $row->cnt;
            if ($maxHits < $row->cnt) {
                $maxHits = $row->cnt;
            }
            $rows[] = $row;
        }
    }
    // START PAGE CONTENT OUTPUT
    ?>
<h1><img src="/wp-content/plugins/wp-stattraq/images/referrers_icon_32.gif" alt="Referrers" />Referrers</h1>
<p class="description">
	When a site refers to your WordPress blog and the browser passes referrer data this is recorded to help you know who's linking to your site.  See also the Search Terms to understand what the search engines are referring to your site for.
</p>
<?php 
    echo "<table>" . "<thead>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "referrer DESC" ? "referrer ASC" : "referrer DESC") . "\">Referrer</a></th>") . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\"># ref</a></th>") . "<th>ref. %</th>" . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "url DESC" ? "url ASC" : "url DESC") . "\">URL</a></th>") . "</tr>" . "</thead>" . "<tfoot>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "referrer DESC" ? "referrer ASC" : "referrer DESC") . "\">Referrer</a></th>") . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\"># ref</a></th>") . "<th>ref. %</th>" . ("<th><a href=\"{$wpst_url}view=referrer&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "url DESC" ? "url ASC" : "url DESC") . "\">URL</a></th>") . "</tr>" . "</tfoot>";
    echo "<tbody>\n";
    foreach ($rows as $row) {
        $str = $row->cnt;
        $year = $row->year;
        $month = $row->month;
        $day = $row->day;
        $hour = $row->hour;
        $minute = $row->minute;
        echo "<tr>";
        if ($drill_date_format != 0) {
            echo "<td><a href=\"" . htmlentities($row->referrer) . "\" target=\"_blank\">" . (strlen($row->referrer) > 50 ? substr($row->referrer, 0, 50) : $row->referrer) . "</a></td>";
        } else {
            echo "<td>{$row->referrer}</td>";
        }
        echo "<td class=\"right\">{$row->cnt}</td>" . "<td class=\"right\">" . round($row->cnt / $totalHits * 100) . "%</td>" . "<td>" . $row->url . "</td>" . "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
}
コード例 #7
0
ファイル: options.php プロジェクト: prosenjit-itobuz/upages
function getPageContent()
{
    global $wpdb, $tablestattraq, $table_stattraq_options, $options, $wpst_url;
    $action = st_getVar('action');
    $options_defaults_view = st_getVar('options_defaults_view', 'summary');
    $options_defaults_time_frame = st_getVar('options_defaults_time_frame', 10);
    $options_defaults_limit_number = st_getVar('options_defaults_limit_number', 20);
    $options_user_counts_hide_bots = st_getVar('options_user_counts_hide_bots', 'false');
    $options_user_agents_hide_bots = st_getVar('options_user_agents_hide_bots', 'false');
    $options_referrers_hide_this_blog = st_getVar('options_referrers_hide_this_blog', 'false');
    $options_ip_addresses_hide_bots = st_getVar('options_ip_addresses_hide_bots', 'false');
    $saved = false;
    if ($action == 'Save') {
        // default view
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_defaults_view}' WHERE option_name='options_defaults_view'";
        if ($wpdb->query($sqlQuery) == 0 && $options_defaults_view != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_defaults_view'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_defaults_view', '{$options_defaults_view}')";
            $wpdb->query($sqlQuery);
        }
        // TIME_FRAME
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_defaults_time_frame}' WHERE option_name='options_defaults_time_frame'";
        if ($wpdb->query($sqlQuery) == 0 && $options_defaults_time_frame != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_defaults_time_frame'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_defaults_time_frame', '{$options_defaults_time_frame}')";
            $wpdb->query($sqlQuery);
        }
        // options_defaults_limit_number
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_defaults_limit_number}' WHERE option_name='options_defaults_limit_number'";
        if ($wpdb->query($sqlQuery) == 0 && $options_defaults_limit_number != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_defaults_limit_number'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_defaults_limit_number', '{$options_defaults_limit_number}')";
            $wpdb->query($sqlQuery);
        }
        // options_user_counts_hide_bots
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_user_counts_hide_bots}' WHERE option_name='options_user_counts_hide_bots'";
        if ($wpdb->query($sqlQuery) == 0 && $options_user_counts_hide_bots != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_user_counts_hide_bots'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_user_counts_hide_bots', '{$options_user_counts_hide_bots}')";
            $wpdb->query($sqlQuery);
        }
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_user_agents_hide_bots}' WHERE option_name='options_user_agents_hide_bots'";
        if ($wpdb->query($sqlQuery) == 0 && $options_user_agents_hide_bots != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_user_agents_hide_bots'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_user_agents_hide_bots', '{$options_user_agents_hide_bots}')";
            $wpdb->query($sqlQuery);
        }
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_referrers_hide_this_blog}' WHERE option_name='options_referrers_hide_this_blog'";
        if ($wpdb->query($sqlQuery) == 0 && $options_referrers_hide_this_blog != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_referrers_hide_this_blog'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_referrers_hide_this_blog', '{$options_referrers_hide_this_blog}')";
            $wpdb->query($sqlQuery);
        }
        $sqlQuery = "UPDATE {$table_stattraq_options} SET option_value='{$options_ip_addresses_hide_bots}' WHERE option_name='options_ip_addresses_hide_bots'";
        if ($wpdb->query($sqlQuery) == 0 && $options_ip_addresses_hide_bots != $wpdb->get_var("SELECT option_value FROM {$table_stattraq_options} WHERE option_name='options_ip_addresses_hide_bots'")) {
            $sqlQuery = "INSERT INTO {$table_stattraq_options} (option_name, option_value) VALUES ('options_ip_addresses_hide_bots', '{$options_ip_addresses_hide_bots}')";
            $wpdb->query($sqlQuery);
        }
        $saved = true;
    }
    $results = $wpdb->get_results("SELECT * FROM {$table_stattraq_options}");
    if ($results) {
        foreach ($results as $result) {
            switch ($result->option_name) {
                case 'options_defaults_view':
                    $options_defaults_view = $result->option_value;
                    break;
                case 'options_defaults_time_frame':
                    $options_defaults_time_frame = $result->option_value;
                    break;
                case 'options_defaults_limit_number':
                    $options_defaults_limit_number = $result->option_value;
                    break;
                case 'options_user_counts_hide_bots':
                    $options_user_counts_hide_bots = $result->option_value;
                    break;
                case 'options_user_agents_hide_bots':
                    $options_user_agents_hide_bots = $result->option_value;
                    break;
                case 'options_referrers_hide_this_blog':
                    $options_referrers_hide_this_blog = $result->option_value;
                    break;
                case 'options_ip_addresses_hide_bots':
                    $options_ip_addresses_hide_bots = $result->option_value;
                    break;
            }
        }
    }
    ?>
<form action="<?php 
    echo $wpst_url;
    ?>
view=options" method="post">
<h1><img src="/wp-content/plugins/wp-stattraq/images/summary_icon_32.gif" alt="Summary" />Options</h1>
<p class="description">
	Set options for StatTraq
</p>
<?php 
    if ($saved) {
        echo "<h3>Options Saved.</h3>";
    } elseif ($options['default_view'] == 'options') {
        echo "<h3 style=\"color: #023ED4;\">Please choose your options to start using StatTraq.</h3>";
    }
    ?>
<fieldset>
	<legend>Default Settings</legend>
	<dl>
		<dt><label for="options_defaults_view">Default View</label></dt>
		<dd>
			<select name="options_defaults_view" id="options_defaults_view">
				<option value="summary"<?php 
    echo $options_defaults_view == 'summary' ? ' selected="selected"' : '';
    ?>
>Summary</option>
				<option value="hit_counter"<?php 
    echo $options_defaults_view == 'hit_counter' ? ' selected="selected"' : '';
    ?>
>Hit Counter</option>
				<option value="user_counter"<?php 
    echo $options_defaults_view == 'user_counter' ? ' selected="selected"' : '';
    ?>
>User Counter</option>
				<option value="page_views"<?php 
    echo $options_defaults_view == 'page_views' ? ' selected="selected"' : '';
    ?>
>Page Views</option>
				<option value="user_agent"<?php 
    echo $options_defaults_view == 'user_agent' ? ' selected="selected"' : '';
    ?>
>Browsers</option>
				<option value="referrer"<?php 
    echo $options_defaults_view == 'referrer' ? ' selected="selected"' : '';
    ?>
>Referrers</option>
				<option value="query_strings"<?php 
    echo $options_defaults_view == 'query_strings' ? ' selected="selected"' : '';
    ?>
>Search Terms</option>
			</select>
			<br />
			When the StatTraq reporter loads up, show me this view
		</dd>
		<dt><label for="options_defaults_time_frame">Default Time Period</label></dt>
		<dd>
			<select name="options_defaults_time_frame" id="options_defaults_time_frame">
				<option value="4"<?php 
    echo $options_defaults_time_frame == 4 ? ' selected="selected"' : '';
    ?>
>Year</option>
				<option value="8"<?php 
    echo $options_defaults_time_frame == 8 ? ' selected="selected"' : '';
    ?>
>Month</option>
				<option value="10"<?php 
    echo $options_defaults_time_frame == 10 ? ' selected="selected"' : '';
    ?>
>Day</option>
				<option value="12"<?php 
    echo $options_defaults_time_frame == 12 ? ' selected="selected"' : '';
    ?>
>Hour</option>
			</select>
		</dd>
		<dt>Default number of results per report</dt>
		<dd>
			<input type="radio" name="options_defaults_limit_number" value="10" id="options_defaults_limit_number_10" <?php 
    echo $options_defaults_limit_number == 10 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_10">10</label>
			<input type="radio" name="options_defaults_limit_number" value="20" id="options_defaults_limit_number_20" <?php 
    echo $options_defaults_limit_number == 20 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_20">20</label>
			<input type="radio" name="options_defaults_limit_number" value="50" id="options_defaults_limit_number_50" <?php 
    echo $options_defaults_limit_number == 50 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_50">50</label>
			<input type="radio" name="options_defaults_limit_number" value="100" id="options_defaults_limit_number_100" <?php 
    echo $options_defaults_limit_number == 100 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_100">100</label>
			<input type="radio" name="options_defaults_limit_number" value="500" id="options_defaults_limit_number_500" <?php 
    echo $options_defaults_limit_number == 500 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_500">500</label>
			<input type="radio" name="options_defaults_limit_number" value="1000" id="options_defaults_limit_number_1000" <?php 
    echo $options_defaults_limit_number == 1000 ? 'checked="checked"' : '';
    ?>
 /><label for="options_defaults_limit_number_1000">1000</label>
			<br />
				You will still be able to change the number of results after setting this default value, when you first load up the StatTraq reporter you will be shown results with these settings.
		</dd>
	</dl>
</fieldset>
<fieldset>
	<legend>User Count Report Settings</legend>
	<dl>
		<dt><input type="checkbox" name="options_user_counts_hide_bots" id="options_user_counts_hide_bots" value="true" <?php 
    echo $options_user_counts_hide_bots != 'false' ? 'checked="checked"' : '';
    ?>
 /><label for="options_user_counts_hide_bots">Hide bots in the user count statistics</label></dt>
	</dl>
</fieldset>
<fieldset>
	<legend>Browser/User Agent Report Settings</legend>
	<dl>
		<dt><input type="checkbox" name="options_user_agents_hide_bots" id="options_user_agents_hide_bots" value="true" <?php 
    echo $options_user_agents_hide_bots != 'false' ? 'checked="checked"' : '';
    ?>
 /><label for="options_user_agents_hide_bots">Hide Bots from User Agent statistics</label></dt>
		<dd>
			Show <em>only</em> browsers in this list and not bots or <acronym title="Really Simple Syndication">RSS</acronym>/Atom feed aggregators.
		</dd>
</dl>
</fieldset>
<fieldset>
	<legend>IP Address Report Settings</legend>
	<dl>
		<dt><input type="checkbox" name="options_ip_addresses_hide_bots" id="options_ip_addresses_hide_bots" value="true" <?php 
    echo $options_ip_addresses_hide_bots != 'false' ? 'checked="checked"' : '';
    ?>
 /><label for="options_ip_addresses_hide_bots">Hide Bots from IP Address statistics</label></dt>
		<dd>
			Show <em>only</em> browsers in this list and not bots or feed spiders.
		</dd>
</dl>
</fieldset>
<fieldset>
	<legend>Referrer Report Settings</legend>
	<dl>
		<dt><input type="checkbox" name="options_referrers_hide_this_blog" id="options_referrers_hide_this_blog" value="true" <?php 
    echo $options_referrers_hide_this_blog != 'false' ? 'checked="checked"' : '';
    ?>
 /><label for="options_referrers_hide_this_blog">Hide this blog from referrer reports</label></dt>
	</dl>
<input type="submit" name="action" value="Save" accesskey="s" />
</fieldset>
</form>
<?php 
}
コード例 #8
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $wpdb, $tablestattraq, $options, $wpst_url;
    $orderBy = st_getVar("orderBy", "cnt DESC");
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "";
    $date_format = "%Y-%m-%d %H:i";
    $first_of_month = mktime(0, 0, 0, $month, 1, $year);
    #remember that mktime will automatically correct if invalid dates are entered
    # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
    # this provides a built in "rounding" feature to generate_calendar()
    $maxdays = date('t', $first_of_month);
    #number of days in the month
    if ($time_frame == 4) {
        $betweenClause = "WHERE line_id <> -1";
        // bluff the where clause
        $date_format = "%Y";
    }
    if ($time_frame == 6) {
        $startDate = $year . '0100000000';
        $endDate = $year + 1 . '0101000000';
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $date_format = "%Y-%m";
    } else {
        if ($time_frame == 8) {
            $startDate = st_createDateQueryString($year, $month, 1, 0, 0, 0);
            $endDate = st_createDateQueryString($year, $month, $maxdays, 23, 59, 59);
            $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $date_format = "%Y-%m-%d";
        } else {
            if ($time_frame == 10) {
                $startDate = st_createDateQueryString($year, $month, $day, 0, 0, 0);
                $endDate = st_createDateQueryString($year, $month, $day, 23, 59, 59);
                $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $date_format = "%Y-%m-%d %H:00";
            } else {
                if ($time_frame == 12) {
                    $startDate = st_createDateQueryString($year, $month, $day, $hour, 0, 0);
                    $endDate = st_createDateQueryString($year, $month, $day, $hour, 59, 59);
                    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $date_format = "%Y-%m-%d %H:i";
                }
            }
        }
    }
    $totalHits = 0;
    $maxHits = 0;
    ?>
<h1><img src="/wp-content/plugins/wp-stattraq/images/user_agents_icon_32.gif" alt="Browsers" /> Browsers</h1>
<p class="description">
Displays the different user agents that have requested documents from WordPress.
You can configure the options page to not display bots and <acronym title="Really Simple Syndication">RSS</acronym>/Atom aggregators.
</p>
<?php 
    echo "<table>" . "<tr>" . "<td><a href=\"{$wpst_url}view=user_agent&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "cnt DESC" ? "cnt ASC" : "cnt DESC") . "\">Count</td>" . "<td><a href=\"{$wpst_url}view=user_agent&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "browser DESC" ? "browser ASC" : "browser DESC") . "\">Browser</a></td>" . "</tr>";
    $hideBots = $options['user_agents_hide_bots'] == 'true' ? ' AND user_agent_type=0 ' : '';
    $sqlQuery = "SELECT COUNT(browser) AS cnt, browser, DATE_FORMAT(access_time,'{$date_format}') AS dd FROM {$tablestattraq} {$betweenClause} {$hideBots} GROUP BY browser ORDER By {$orderBy} LIMIT {$limitPage}, {$limitNumber}";
    $results = $wpdb->get_results($sqlQuery);
    if ($results) {
        foreach ($results as $row) {
            echo "<tr><td>{$row->cnt}</td><td>{$row->browser}</td></tr>";
        }
    }
    echo "</table>";
}
コード例 #9
0
<?php

/************************************************************
Version   Change
  1.1     Fixed the code to reconize pages as well as posts.
************************************************************/
function getPageTitle()
{
    return "Page Views";
}
$orderBy = st_getVar("orderBy", "cnt DESC");
$startDate = date("Ymd");
$endDate = date("Ymd");
$betweenClause = "";
$date_format = "%Y-%m-%d %H:i";
$drill_date_format = 6;
$width = 600;
if ($time_frame == 4) {
    $date_format = "%Y";
}
if ($time_frame == 6) {
    $startDate = st_createDateQueryString($year, 1, 1, 0, 0, 0);
    $endDate = st_createDateQueryString($year, 12, 31, 23, 59, 59);
    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
    $date_format = "%Y-%m";
    $drill_date_format = 8;
} else {
    if ($time_frame == 8) {
        $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "01000000";
        $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "31235959";
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
コード例 #10
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $wpdb, $tablestattraq, $options, $wpst_ip_url;
    ?>
<script>
function toggleInfo(sLineID)
{
	var sDisplay = document.getElementById('lineid:'+sLineID).style.display;
	document.getElementById('lineid:'+sLineID).style.display = (sDisplay == 'none'? '' : 'none');
}
</script>
<h1>
IP Address
</h1>
<p class="description">
On the Internet each computer has what is called an IP address.  That is a number on a network that is used to identify the computer so that data (such as a web page) can be transmitted to the computer.  When a computer requests a web page the IP address is sent.
</p>
<?php 
    $ip_address = st_getVar("ip_address", null);
    $orderBy = st_getVar("orderBy", "ip_address DESC");
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "";
    $date_format = "%Y-%m-%d %H:i";
    if ($time_frame == 4) {
        $date_format = "%Y";
    }
    if ($time_frame == 6) {
        $startDate = st_createDateQueryString($year, 1, 1, 0, 0, 0);
        $endDate = st_createDateQueryString($year, 12, 31, 23, 59, 59);
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $date_format = "%Y-%m";
    } else {
        if ($time_frame == 8) {
            $startDate = st_createDateQueryString($year, $month, 1, 0, 0, 0);
            $endDate = st_createDateQueryString($year, $month, 31, 23, 59, 59);
            $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $date_format = "%Y-%m-%d %H:%i";
        } else {
            if ($time_frame == 10) {
                $startDate = st_createDateQueryString($year, $month, $day, 0, 0, 0);
                $endDate = st_createDateQueryString($year, $month, $day, 23, 59, 59);
                $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $date_format = "%Y-%m-%d %H:00";
            } else {
                if ($time_frame == 12) {
                    $startDate = st_createDateQueryString($year, $month, $day, $hour, 0, 0);
                    $endDate = st_createDateQueryString($year, $month, $day, $hour, 59, 59);
                    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $date_format = "%Y-%m-%d %H:i";
                }
            }
        }
    }
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    if ($ip_address != null) {
        $betweenClause .= " AND ip_address = '{$ip_address}'";
    }
    $hideBots = $options['ip_addresses_hide_bots'] == 'true' ? ' AND user_agent_type=0 ' : '';
    $sqlQuery = "SELECT DISTINCT ip_address, DATE_FORMAT(access_time,'{$date_format}') AS dd, browser, line_id, article_id FROM {$tablestattraq} {$betweenClause} {$hideBots} GROUP BY dd, ip_address ORDER BY {$orderBy} LIMIT {$limitPage}, {$limitNumber}";
    $results = $wpdb->get_results($sqlQuery);
    echo "<table cellpadding=\"4\">" . "<tr>" . "<th><a href=\"index.php?view=ip_address&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">time</a></th>" . "<th><a href=\"index.php?view=ip_address&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "ip_address DESC" ? "ip_address ASC" : "ip_address DESC") . "\">ip</a></th>" . "<th><a href=\"index.php?view=ip_address&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&orderBy=" . ($orderBy == "browser DESC" ? "browser ASC" : "browser DESC") . "\">Browser</a></th>" . "<th>Article</th>" . "<th>Who Is</th>" . "<th>Info</th>" . "</tr>";
    if ($results) {
        foreach ($results as $row) {
            echo "<tr>\n\t" . "<td>{$row->dd}</td>" . "<td><a href=\"index.php?view=ip_address&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&ip_address={$row->ip_address}\">{$row->ip_address}</a></td>" . "<td>{$row->browser}</td>" . "<td>{$row->article_id}</td>" . "<td><a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput={$row->ip_address}\" target=\"_blank\">whois</a></td>" . "<td><a href=\"#\" onclick=\"toggleInfo('{$row->line_id}')\">info</a></td>" . "</tr>\n";
            echo "<tr id=\"lineid:{$row->line_id}\" style=\"display:none;\">\n\t" . "<td colspan=\"6\">";
            $sqlQuery = "SELECT * FROM {$tablestattraq} where line_id={$row->line_id}";
            $access = $wpdb->get_row($sqlQuery);
            ?>
		<dl>
			<dt><strong>Access Time: </strong></dt>
				<dd><?php 
            echo $access->access_time;
            ?>
</dd>
			<dt><strong>IP Address: </strong></dt>
				<dd><?php 
            echo $access->ip_address;
            ?>
</>
				<a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php 
            echo $access->ip_address;
            ?>
" target="_blank">whois</a></dd>
			<dt><strong>URL: </strong></dt>
				<dd><?php 
            echo $access->url;
            ?>
</dd>
			<dt><strong>Article ID: </strong></dt>
				<dd><?php 
            echo $access->article_id;
            ?>
</dd>
			<dt><strong>User Agent: </strong></dt>
				<dd><?php 
            echo $access->user_agent;
            ?>
</dd>
			<dt><strong>Browser: </strong></dt> 
				<dd><?php 
            echo $access->browser;
            ?>
</dd>
			<dt><strong>Referrer: </strong></dt>
				<dd><?php 
            echo $access->referrer;
            ?>
</dd>
		</dl>
		<?php 
            echo "</td></tr>\n";
        }
    }
    echo "</table>";
}
コード例 #11
0
// $outputFormat = "jpg";
// for future expansion - no other chart types are supported at this time.
$chart_type = st_getVar('chart_type', 'hz_bar');
//chart=hit_counter
// time_frame=$time_frame&year=$year&month=$month&day=$day&date_format=$date_format&startDate=$startDate&endDate=$endDate&width=600&height=270
/*$year = getVar("year", date("Y"));
$month = getVar("month", date("m"));
$day = getVar("day", date("d"));
$hour = getVar("hour", date("H"));
$minute = getVar("minute", date("i"));*/
$startDate = st_getVar("startDate", date("Y-m-d 00:00:00"));
$endDate = st_getVar("endDate", date("Y-m-d 23:59:59"));
$imageWidth = st_getVar("width", 600);
$imageHeight = st_getVar("height", 270);
$betweenClause = "";
$orderBy = st_getVar("orderBy", "dd DESC");
if ($time_frame != 4) {
    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
}
//   require("phpPieGraph.php");
// Setup how high and how wide the ouput image is
// Create a new Image
$image = ImageCreate($imageWidth, $imageHeight);
// Fill it with your favorite background color..
$backgroundColor = ImageColorAllocate($image, 255, 255, 255);
ImageFill($image, 0, 0, $backgroundColor);
$text = ImageColorAllocate($image, 0, 0, 0);
// Interlace the image..
Imageinterlace($image, 1);
$totalHits = 0;
// HORZONTAL BAR CHART
コード例 #12
0
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $showReferrerType, $siteName, $limitNumber, $tableposts, $wpdb;
    $orderBy = st_getVar("orderBy", "cnt DESC");
    if (strstr($orderBy, 'search_phrase') == false && strstr($orderBy, 'cnt') == false) {
        $orderBy = "cnt DESC";
    }
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "";
    $date_format = "%Y-%m-%d %H:i";
    $drill_date_format = 6;
    $width = 600;
    if ($time_frame == 4) {
        $date_format = "%Y";
    }
    if ($time_frame == 6) {
        $startDate = $year . '0100000000';
        $endDate = $year + 1 . '0101000000';
        $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
        $date_format = "%Y-%m";
        $drill_date_format = 8;
    } else {
        if ($time_frame == 8) {
            $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "01000000";
            $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . "31235959";
            $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
            $date_format = "%Y-%m-%d";
            $drill_date_format = 10;
        } else {
            if ($time_frame == 10) {
                $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "000000";
                $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . "235959";
                $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                $date_format = "%Y-%m-%d %H:00";
                $drill_date_format = 12;
            } else {
                if ($time_frame == 12) {
                    $startDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "{$hour}0000";
                    $endDate = "{$year}" . ($month < 10 ? "0" : "") . $month . ($day < 10 ? "0" : "") . $day . ($hour < 10 ? "0" : "") . "5959";
                    $betweenClause = " WHERE access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $date_format = "%Y-%m-%d %H:i";
                    $drill_date_format = 0;
                    $width = 780;
                }
            }
        }
    }
    $google = getPageDBResults("Googlebot", $date_format, $time_frame, $betweenClause, $orderBy);
    $yahoo = getPageDBResults("Inktomi/Yahoo", $date_format, $time_frame, $betweenClause, $orderBy);
    $msn = getPageDBResults("msnbot", $date_format, $time_frame, $betweenClause, $orderBy);
    $total = $wpdb->get_var("SELECT COUNT(ID) FROM {$tableposts} WHERE post_status='publish'");
    $google_count = 0;
    $yahoo_count = 0;
    $msn_count = 0;
    if ($google) {
        $google_count = $google->cnt;
    }
    if ($yahoo) {
        $yahoo_count = $yahoo->cnt;
    }
    if ($msn) {
        $msn_count = $msn->cnt;
    }
    ?>

<h1><img src="/wp-content/plugins/wp-stattraq/images/user_agents_icon_32.gif" alt="Search Engine Saturation" />Search Engine Saturation</h1>
<p class="description">
These results do not reflect any time period but merely reflect which pages have been searched by the search engines since being added or modified.
</p>
<table>
	<thead>
		<tr>
			<th></th>
			<th>Google</th>
			<th>Yahoo</th>
			<th>MSN</th>
		</tr>
	</thead>
	<tbody>
		<?php 
    echo '<tr><td>Number of Pages Indexed</td><td class="right">' . $google_count . '</td><td class="right">' . $yahoo_count . '</td><td class="right">' . $msn_count . '</td></tr>';
    echo '<tr><td>Number of Pages <em>Not</em> Indexed</td><td class="right">' . ($total - $google_count) . '</td><td class="right">' . ($total - $yahoo_count) . '</td><td class="right">' . ($total - $msn_count) . '</td></tr>';
    echo '<tr><td>Percent Saturation</td><td class="right">' . floor($google_count / $total * 100) . '%</td><td class="right">' . floor($yahoo_count / $total * 100) . '%</td><td class="right">' . floor($msn_count / $total * 100) . '%</td></tr>';
    ?>
	</tbody>
</table>
<h3>Submit Your Blog to the Top Search Engines</h3>
<p class="description">
	You can click the links below to add your WordPress site to the search engines' list of links to spider.
</p>
<dl>
	<dt>Google.com</dt>
	<dd><a href="http://www.google.com/addurl.html">http://www.google.com/addurl.html</a></dd>
	<dt>Yahoo.com (requires login)</dt>
	<dd><a href="http://submit.search.yahoo.com/free/request">http://submit.search.yahoo.com/free/request</a></d>
	<dt>MSN.com</dt>
	<dd><a href="http://search.msn.com/docs/submit.aspx?FORM=WSDD2">http://search.msn.com/docs/submit.aspx?FORM=WSDD2</a></d>
</dl>
<?php 
}