Пример #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
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
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $session_id, $tablestattraq, $wpdb, $limitNumber, $wpst_url;
    $orderBy = getVar("orderBy", "dd DESC");
    $startDate = date("Ymd");
    $endDate = date("Ymd");
    $betweenClause = "WHERE session_id = '{$session_id}'";
    $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 = createDateQueryString($year, 1, 1, 0, 0, 0);
        $endDate = createDateQueryString($year, 12, 31, 23, 59, 59);
        $betweenClause .= " AND 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 .= " AND 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 .= " AND 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 .= " AND access_time BETWEEN '{$startDate}' AND '{$endDate}'";
                    $drill_date_format = 0;
                    $width = 780;
                }
            }
        }
    }
    // START OF PAGE CONTENT OUTPUT
    echo "<h2>Session: {$session_id}</h2>";
    // SESSION DETAILS
    $sqlQuery = "SELECT * FROM {$tablestattraq} {$betweenClause} LIMIT 0,1";
    $row = $wpdb->get_row($sqlQuery);
    echo "<dl>" . "<dt>IP Address:</dt><dd><a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput={$row->ip_address}\" target=\"_blank\" title=\"Click for Who Is Information\">{$row->ip_address}</a></dd>" . "<dt>Browser:</dt><dd>{$row->browser}</dd>" . "<dt>User Agent:</dt><dd>{$row->user_agent}</dd>" . "<dt>Referrer:</dt><dd>{$row->referrer}</dd>" . "</dl>";
    $result = getPageDBResults("%Y-%m-%d %H:%i", $time_frame, $betweenClause, $orderBy, false);
    echo "<table>" . "<thead>" . "<tr>" . "<th><a href=\"{$wpst_url}view=session&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Date</a></th>" . "<th><a href=\"{$wpst_url}view=session&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&date_format={$date_format}&limitNumber={$limitNumber}&orderBy=" . ($orderBy == "dd DESC" ? "dd ASC" : "dd DESC") . "\">Page</a></th>" . "</tr>" . "</thead>";
    echo "<tbody>\n";
    if ($result) {
        foreach ($result as $row) {
            echo "<tr>" . "<td>{$row->access_time}</td>" . "<td>{$row->article_id}</td>" . "</tr>";
        }
    }
    echo "</tbody>";
    echo "</table>";
}
Пример #6
0
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
function getPageContent()
{
    global $time_frame, $year, $month, $day, $hour, $minute, $view, $limitPage, $limitNumber, $tablestattraq, $tableposts, $wpdb, $orderBy, $betweenClause, $date_format, $startDate, $endDate, $drill_date_format, $width, $table_prefix, $wpst_url, $wpst_chart_url;
    ?>
  <h1><img src="/wp-content/plugins/wp-stattraq/images/pages_icon_32.gif" alt="Page Views" />Page Views</h1>
  <p class="description">
	The Number of times the public pages in WordPress were viewed.  Mixed pages are pages that have multiple posts on them.  Feed represents the RSS ant Atom feeds.
  </p>
<?php 
    $totalHits = 0;
    $maxHits = 0;
    $rows = array();
    $results = getPageDBResults($date_format, $time_frame, $betweenClause, $orderBy);
    if ($results) {
        foreach ($results as $row) {
            $totalHits += $row->cnt;
            if ($maxHits < $row->cnt) {
                $maxHits = $row->cnt;
            }
            $rows[] = $row;
        }
    }
    // START PAGE CONTENT OUTPUT
    echo "<br />\n<img class=\"chart-picture\" src=\"{$wpst_chart_url}chart=page_views&time_frame={$time_frame}&year={$year}&month={$month}&day={$day}&hour={$hour}&minute={$minute}&startDate={$startDate}&endDate={$endDate}&width={$width}&height=270&orderBy={$orderBy}&limitPage={$limitPage}&limitNumber={$limitNumber}\" width=\"{$width}\" height=\"270\" alt=\"chart\" />\n";
    echo "<div id=\"chart-description\">Chart displays the number of times a page was viewed in the given time frame and the last date viewed.</div>";
    if (count($rows) > 0) {
        echo "<p>Average hits during this time period: " . $totalHits / count($rows) . "</p>";
    } else {
        echo "<p>No hits during this time period.</p>";
    }
    echo "<table>" . "<thead>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=page_views&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") . "&amp;limitNumber={$limitNumber}\">Article</a></th>") . ("<th><a href=\"{$wpst_url}view=page_views&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") . "&amp;limitNumber={$limitNumber}\">Hits</a></th>") . "<th>perc.</th>" . "</tr>" . "</thead>" . "<tfoot>" . "<tr>" . ("<th><a href=\"{$wpst_url}view=page_views&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") . "&amp;limitNumber={$limitNumber}\">Article</a></th>") . ("<th><a href=\"{$wpst_url}view=page_views&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") . "&amp;limitNumber={$limitNumber}\">Hits</a></th>") . "<th>perc.</th>" . "</tr>" . "</tfoot>";
    echo "<tbody>\n";
    $blogAddress = get_settings('home') . '/' . get_settings('blogfilename');
    foreach ($rows as $key => $row) {
        $year = $row->year;
        $month = $row->month;
        $day = $row->day;
        $hour = $row->hour;
        $minute = $row->minute;
        $posts_found_table = $table_prefix . "posts";
        $quid_options = "             ";
        if ($row->article_id == 0 || $row->article_id == 'Feed') {
            $quid_options = "Blank";
        } else {
            $res2 = "SELECT guid FROM " . $posts_found_table . " WHERE ID='" . addslashes($row->article_id) . "'";
            if (!mysql_query($res2)) {
                $quid_options = "Blank";
            } else {
                $quid_options = mysql_result(mysql_query($res2), 0, 0);
            }
        }
        if (strpos($quid_options, "page") === false) {
            $page_post_link = "?p=";
        } else {
            $page_post_link = "?page_id=";
        }
        if ($row->article_id == '0') {
            $post_title = 'Mixed';
        } else {
            if ($row->article_id == 'Feed') {
                $post_title = 'Feed';
            } else {
                $post_title = $wpdb->get_row("SELECT post_title FROM {$tableposts} WHERE ID='{$row->article_id}'");
                $post_title = stripslashes($post_title->post_title);
            }
        }
        echo "<tr>";
        echo "<td>" . ((int) $row->article_id > 0 ? "<a href=\"" . $blogAddress . $page_post_link . $row->article_id . "\">" . $post_title . "</a>" : $post_title) . "</td>";
        echo "<td class=\"right\">{$row->cnt}</td>" . "<td class=\"right\">" . round($row->cnt / $totalHits * 100) . "%</td>" . "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
}
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 
}