Exemple #1
0
function luc_url_monitoring()
{
    global $wpdb, $StatPressV_Option;
    $table_name = STATPRESS_V_TABLE_NAME;
    $querylimit = 20;
    $pa = luc_page_posts();
    $action = "urlmonitoring";
    // Number of distinct "no author post or page URL"
    $Num = $wpdb->get_var("SELECT COUNT(*)\r\n\t\t\t\tFROM {$table_name}\r\n\t\t\t\tWHERE realpost=0 AND (spider ='' OR spider LIKE 'Unknown Spam Bot')\r\n\t\t\t\t");
    $NumPage = ceil($Num / $querylimit);
    echo "<div class='wrap'><h2>" . __('URL Monitoring', 'statpress') . "</h2>\r\n\t       </br> This page is designed to help you secure your website:<div title='Indeed this page shows all URLs that have access to your website or your blog and who are not posts or pages written by an author of your website.Some are legitimate as /category or the robots like Google. Nevertheless, they are all shown so you can secure your blog or your site by selecting the ones you want to block access to your site.'>Learn more</div>";
    luc_print_pp_pa_link(0, 0, $action, $NumPage, $pa);
    $LimitValue = $pa * $querylimit - $querylimit;
    ?>
	<table class='widefat' >
		<thead>
		<tr>
			<th scope='col'>Date</th>
			<th scope='col'>Time</th>
			<th scope='col'>IP</th>
			<th scope='col'>Country</th>
			<th scope='col' width="30%">URL requested</th>
			<th scope='col' width="30%">Agent</th>
			<th scope='col'>Spider</th>
			<th scope='col'>OS</th>
			<th scope='col'>Browser</th>
		</tr>
		</thead>
		<tbody>
	<?php 
    $qry = $wpdb->get_results("SELECT date,time,ip,urlrequested,agent,os,browser,spider,country,realpost\r\n\t\t\tFROM {$table_name}\r\n\t\t\tWHERE realpost=0 AND (spider ='' OR spider LIKE 'Unknown Spam Bot')\r\n\t\t\tORDER BY id DESC\r\n\t\t\tLIMIT {$LimitValue}, {$querylimit};");
    foreach ($qry as $rk) {
        echo "<tr>\r\n\t\t\t<td>" . luc_hdate($rk->date) . "</td>\r\n\t\t\t<td>" . $rk->time . "</td>\r\n\t\t\t<td>" . luc_create_href($rk->ip, 'ip') . "</td>\r\n\t\t\t<td>" . luc_HTML_IMG($rk->country, 'country', false) . "</td>\r\n\t\t\t<td>" . $rk->urlrequested . "</td>\r\n\t\t\t<td><a href='http://www.google.com/search?q=%22User+Agent%22+" . urlencode($rk->agent) . "' target='_blank' title='Search for User Agent string on Google...'> " . $rk->agent . "</a> </td>\r\n\t\t\t<td>" . luc_HTML_IMG($rk->spider, 'spider', false) . "</td>\r\n\t\t\t<td>" . luc_HTML_IMG($rk->os, 'os', $text_OS) . "</td>\r\n\t\t\t<td>" . luc_HTML_IMG($rk->browser, 'browser', $text_browser) . "</td>";
    }
    ?>
		</tbody>
	</table>
	
<?php 
    echo "</div>";
    luc_print_pp_pa_link(0, 0, $action, $NumPage, $pa);
    luc_StatPressV_load_time($start);
}
Exemple #2
0
function luc_main_table_latest_undefagents()
{
    global $wpdb, $StatPressV_Option;
    $table_name = STATPRESS_V_TABLE_NAME;
    $querylimit = isset($_POST['undefagentsrows']) ? $_POST['undefagentsrows'] : $StatPressV_Option['StatPressV_Rows_Per_Latest'];
    ?>
	<table class='widefat' >
		<thead>
		<tr>
			<th scope='col'>Date</th>
			<th scope='col'>Time</th>
			<th scope='col'>IP</th>
			<th scope='col' width="30%">Agent</th>
			<th scope='col'>Count</th>
		</tr>
		</thead>
		<tbody>
	<?php 
    $qry = $wpdb->get_results("SELECT date, time, ip, agent ,COUNT(ip) AS ipcount\r\n\t\t\tFROM {$table_name}\r\n\t\t\tWHERE (os=''\r\n\t\t\t\tOR browser='')\r\n\t\t\t\tAND searchengine=''\r\n\t\t\t\tAND spider=''\r\n\t\t\tGROUP BY ip,agent\r\n\t\t\tORDER BY id DESC\r\n\t\t\tLIMIT {$querylimit};");
    foreach ($qry as $rk) {
        echo "<tr>\r\n\t\t\t<td>" . luc_hdate($rk->date) . "</td>\r\n\t\t\t<td>" . $rk->time . "</td>\r\n\t\t\t<td>" . luc_create_href($rk->ip, 'ip') . "</td>\r\n\t\t\t<td><a target='_blank' href='http://www.google.com/search?q=%22User+Agent%22+" . urlencode($rk->agent) . "' target='_blank' title='Search for &quot;" . urldecode($rk->agent) . "&quot; on Google...'> " . $rk->agent . "</a> </td>\r\n\t\t\t<td>" . $rk->ipcount . "</td></tr>";
    }
    ?>
		</tbody>
	</table>
	<?php 
    if (isset($_POST['undefagentsrows'])) {
        die;
    }
}
Exemple #3
0
function luc_ValueTable($fld, $fldtitle, $limit = 0, $param = "", $queryfld = "", $exclude = "")
{
    global $wpdb;
    $table_name = STATPRESS_V_TABLE_NAME;
    if ($queryfld == '') {
        $queryfld = $fld;
    }
    echo "<div class='wrap'>\r\n\t\t\t\t<table class='widefat'>\r\n\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th scope='col' style='width:400px;'><h2>{$fldtitle}</h2></th>\r\n\t\t\t\t\t\t<th scope='col' style='width:100px;'>" . __('Visits', 'statpress') . "</th>\r\n\t\t\t\t\t\t<th></th></tr>\r\n\t\t\t\t\t</thead>";
    $rks = $wpdb->get_var("SELECT count({$param} {$queryfld}) as rks\r\n\t\t\t\t\t\t\t\tFROM {$table_name}\r\n\t\t\t\t\t\t\t\t{$exclude};");
    if ($rks > 0) {
        $sql = "SELECT count({$param} {$queryfld}) as pageview, {$fld}\r\n\t\t\t\t\t\tFROM {$table_name}\r\n\t\t\t\t\t\t{$exclude}\r\n\t\t\t\t\t\tGROUP BY {$fld} ORDER BY pageview DESC";
        if ($limit > 0) {
            $sql = $sql . " LIMIT {$limit}";
        }
        $qry = $wpdb->get_results($sql . ";");
        $tdwidth = 450;
        // Collects data
        $data = array();
        foreach ($qry as $rk) {
            $pc = round($rk->pageview * 100 / $rks, 1);
            if ($fld == 'country') {
                $rk->{$fld} = strtoupper($rk->{$fld});
            }
            if ($fld == 'date') {
                $rk->{$fld} = luc_hdate($rk->{$fld});
            }
            if ($fld == 'urlrequested') {
                $rk->{$fld} = luc_post_title_Decode($rk->{$fld});
            }
            $data[substr($rk->{$fld}, 0, 50)] = $rk->pageview;
        }
    }
    // Draw table body
    echo "<tbody id='the-list'>";
    if ($rks > 0) {
        // Chart!
        if ($fld == 'country') {
            $chart = luc_GoogleGeo("", "", $data);
        } else {
            $chart = luc_GoogleChart("", "500x200", $data);
        }
        echo "<tr><td></td><td></td><td rowspan='" . ($limit + 2) . "'>{$chart}</td></tr>";
        foreach ($data as $key => $value) {
            echo "<tr>";
            if ($fld == 'ip') {
                echo "\t<td style='width:500px;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . luc_create_href($key, 'ip') . "</td>";
            } else {
                echo "\t<td style='width:500px;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $key . "</td>";
            }
            echo "\t<td style='width:100px;text-align:center;'>" . $value . "</td>";
            echo "</tr>";
        }
    }
    echo "</tbody></table></div><br>";
}