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>"; }
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); }
function luc_StatPressV_Vars($body) { global $wpdb; $table_name = STATPRESS_V_TABLE_NAME; $today = gmdate('Ymd', current_time('timestamp')); if (strpos(strtolower($body), "%today%") !== false) { $body = str_replace("%today%", luc_hdate($today), $body); } if (strpos(strtolower($body), "%since%") !== false) { $qry = $wpdb->get_results("SELECT date FROM {$table_name} WHERE ip IS NOT NULL ORDER BY date LIMIT 1;"); $body = str_replace("%since%", luc_hdate($qry[0]->date), $body); } if (strpos(strtolower($body), "%totalvisitors%") !== false) { $qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as pageview FROM {$table_name} WHERE spider='' and feed='' ;"); $body = str_replace("%totalvisitors%", $qry[0]->pageview, $body); } if (strpos(strtolower($body), "%totalpageviews%") !== false) { $qry = $wpdb->get_results("SELECT count(*) as pageview FROM {$table_name} WHERE spider='' and feed='' ;"); $body = str_replace("%totalpageviews%", $qry[0]->pageview, $body); } if (strpos(strtolower($body), "%todayvisitors%") !== false) { $qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as visitors FROM {$table_name} WHERE date = {$today} and spider='' and feed='';"); $body = str_replace("%todayvisitors%", $qry[0]->visitors, $body); } if (strpos(strtolower($body), "%todaypageviews%") !== false) { $qry = $wpdb->get_results("SELECT count(ip) as pageviews FROM {$table_name} WHERE date = {$today} and spider='' and feed='';"); $body = str_replace("%todaypageviews%", $qry[0]->pageviews, $body); } if (strpos(strtolower($body), "%thistotalvisitors%") !== false) { $qry = $wpdb->get_results("SELECT count(distinct ip) as pageviews FROM {$table_name} WHERE spider='' and feed='' AND urlrequested='" . mysql_real_escape_string(luc_StatPressV_URL()) . "';"); $body = str_replace("%thistotalvisitors%", $qry[0]->pageviews, $body); } if (strpos(strtolower($body), "%thistotalpageviews%") !== false) { $qry = $wpdb->get_results("SELECT count(distinct ip) as pageviews FROM {$table_name} WHERE spider='' and feed='' AND urlrequested='" . mysql_real_escape_string(luc_StatPressV_URL()) . "';"); $body = str_replace("%thistotalpageviews%", $qry[0]->pageviews, $body); } if (strpos(strtolower($body), "%thistodayvisitors%") !== false) { $qry = $wpdb->get_results("SELECT count(distinct ip) as pageviews FROM {$table_name} WHERE spider='' and feed='' AND date = {$today} AND urlrequested='" . mysql_real_escape_string(luc_StatPressV_URL()) . "';"); $body = str_replace("%thistodayvisitors%", $qry[0]->pageviews, $body); } if (strpos(strtolower($body), "%thistodaypageviews%") !== false) { $qry = $wpdb->get_results("SELECT count(ip) as pageviews FROM {$table_name} WHERE spider='' and feed='' AND date = {$today} AND urlrequested='" . mysql_real_escape_string(luc_StatPressV_URL()) . "';"); $body = str_replace("%thistodaypageviews%", $qry[0]->pageviews, $body); } if (strpos(strtolower($body), "%os%") !== false) { $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $os = luc_GetOS($userAgent); $body = str_replace("%os%", $os, $body); } if (strpos(strtolower($body), "%browser%") !== false) { $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $browser = luc_GetBrowser($userAgent); $body = str_replace("%browser%", $browser, $body); } if (strpos(strtolower($body), "%ip%") !== false) { $ipAddress = $_SERVER['REMOTE_ADDR']; $body = str_replace("%ip%", $ipAddress, $body); } if (strpos(strtolower($body), "%visitorsonline%") !== false) { $to_time = current_time('timestamp'); $from_time = strtotime('-4 minutes', $to_time); $qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as visitors FROM {$table_name} WHERE spider='' and feed='' AND timestamp BETWEEN {$from_time} AND {$to_time};"); $body = str_replace("%visitorsonline%", $qry[0]->visitors, $body); } if (strpos(strtolower($body), "%usersonline%") !== false) { $to_time = current_time('timestamp'); $from_time = strtotime('-4 minutes', $to_time); $qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as users FROM {$table_name} WHERE spider='' and feed='' AND user<>'' AND timestamp BETWEEN {$from_time} AND {$to_time};"); $body = str_replace("%usersonline%", $qry[0]->users, $body); } if (strpos(strtolower($body), "%toppost%") !== false) { $qry = $wpdb->get_results("SELECT urlrequested, count(ip) as totale FROM {$table_name} WHERE spider='' AND feed='' AND urlrequested <>'' GROUP BY urlrequested ORDER BY totale DESC LIMIT 1;"); $body = str_replace("%toppost%", luc_post_title_Decode($qry[0]->urlrequested), $body); } if (strpos(strtolower($body), "%topbrowser%") !== false) { $qry = $wpdb->get_results("SELECT browser,count(*) as totale FROM {$table_name} WHERE spider='' AND feed='' GROUP BY browser ORDER BY totale DESC LIMIT 1;"); $body = str_replace("%topbrowser%", luc_post_title_Decode($qry[0]->browser), $body); } if (strpos(strtolower($body), "%topos%") !== false) { $qry = $wpdb->get_results("SELECT os,count(id) as totale FROM {$table_name} WHERE spider='' AND feed='' GROUP BY os ORDER BY totale DESC LIMIT 1;"); $body = str_replace("%topos%", luc_post_title_Decode($qry[0]->os), $body); } if (strpos(strtolower($body), "%latesthits%") !== false) { $qry = $wpdb->get_results("SELECT search FROM {$table_name} WHERE search <> '' ORDER BY id DESC LIMIT 10;"); $body = str_replace("%latesthits%", urldecode($qry[0]->search), $body); for ($counter = 0; $counter < 10; $counter += 1) { $body .= "<br>" . urldecode($qry[$counter]->search); } } return $body; }
function luc_spyvisitors() { global $wpdb; global $StatPressV_Option; $action = "spyvisitors"; $table_name = STATPRESS_V_TABLE_NAME; // number of IP or bot by page $LIMIT = $StatPressV_Option['StatPressV_SpyVisitor_IP_Per_Page'] ? $StatPressV_Option['StatPressV_SpyVisitor_IP_Per_Page'] : 20; $LIMIT_PROOF = $StatPressV_Option['StatPressV_SpyVisitor_Visits_Per_IP'] ? $StatPressV_Option['StatPressV_SpyVisitor_Visits_Per_IP'] : 20; $pp = luc_page_periode(); // Number of distinct ip (unique visitors) $NumIP = $wpdb->get_var("SELECT count(distinct ip)\n\t\t\t\t\t\t\t\t\tFROM {$table_name}\n\t\t\t\t\t\t\t\t\tWHERE spider='' ;"); $NP = ceil($NumIP / $LIMIT); $LimitValue = $pp * $LIMIT - $LIMIT; $sql = "SELECT *\n\t\t\t\t\tFROM {$table_name} as T1\n\t\t\t\t\tJOIN\n\t\t\t\t\t\t(SELECT max(id) as MaxId,ip\n\t\t\t\t\t\t\tFROM {$table_name}\n\t\t\t\t\t\t\tWHERE spider=''\n\t\t\t\t\t\t\tGROUP BY ip\n\t\t\t\t\t\t\tORDER BY MaxId DESC LIMIT {$LimitValue}, {$LIMIT}\n\t\t\t\t\t\t) as T2\n\t\t\t\t\tON T1.ip = T2.ip\n\t\t\t\t\tORDER BY MaxId DESC, id DESC;\n\t\t\t\t"; $qry = $wpdb->get_results($sql); if ($StatPressV_Option['StatPressV_Use_GeoIP'] == 'checked' & function_exists('geoip_open')) { // Open the database to read and save info if (file_exists(luc_GeoIP_dbname('city'))) { $gic = geoip_open(luc_GeoIP_dbname('city'), GEOIP_STANDARD); $geoip_isok = true; } } echo "<div class='wrap'><h2>" . __('Visitor Spy', 'statpress') . "</h2>"; ?> <script> function ttogle(thediv){ if (document.getElementById(thediv).style.display=="inline") { document.getElementById(thediv).style.display="none" } else {document.getElementById(thediv).style.display="inline"} } </script> <?php $MaxId = 0; $num_row = 0; // Add pagination luc_insert_pagination_options("spyvisitors", $NumIP, $LIMIT); luc_print_pp_link($NP, $pp, $action); echo '<table class="widefat" id="mainspytab" name="mainspytab" width="99%" border="0" cellspacing="0" cellpadding="4">'; foreach ($qry as $rk) { // Visitor Spy if ($MaxId != $rk->MaxId) { if ($geoip_isok === true) { $gir = GeoIP_record_by_addr($gic, $rk->ip); } echo "<thead><tr><th scope='colgroup' colspan='2'>"; if ($rk->country != '') { echo "HTTP country " . luc_HTML_IMG($rk->country, 'country', false); } else { echo "Hostip country <IMG SRC='http://api.hostip.info/flag.php?ip=" . $rk->ip . "' border=0 width=18 height=12> "; } if ($geoip_isok === true) { $lookupsvc = "GeoIP details"; } else { $lookupsvc = "Hostip details"; } echo "\t<strong><span><font size='2' color='#7b7b7b'> " . $rk->ip . " </font></span></strong>\n\t\t\t\t\t<span style='color:#006dca;cursor:pointer;border-bottom:1px dotted #AFD5F9;font-size:8pt;'\n\t\t\t\t\t\tonClick=ttogle('" . $rk->ip . "');>" . $lookupsvc . "</span></div>\n\t\t\t\t\t<div id='" . $rk->ip . "' name='" . $rk->ip . "'>"; if ($geoip_isok === true) { echo "\t<small><br>\n\t\t\t\t\t\t\tCountry: " . utf8_encode($gir->country_name) . " (" . $gir->country_code . ")<br>\n\t\t\t\t\t\t\tCity: " . utf8_encode($gir->city) . "<br>\n\t\t\t\t\t\t\tLatitude/Longitude: <a href='http://maps.google.com/maps?q=" . $gir->latitude . "+" . $gir->longitude . "' target='_blank' title='Lookup latitude/longitude location on Google Maps...'>" . $gir->latitude . " " . $gir->longitude . "</a>\n\t\t\t\t\t\t</small>"; } else { echo "\t<iframe style='overflow:hide;border:0px;width:100%;height:35px;font-family:helvetica;paddng:0;'\n\t\t\t\t\t\t\tscrolling='no' marginwidth=0 marginheight=0 src=http://api.hostip.info/get_html.php?ip=" . $rk->ip . ">\n\t\t\t\t\t\t</iframe>"; } echo "\t<small>\n\t\t\t\t\t\t<br>" . $rk->os . "\n\t\t\t\t\t\t<br>" . $rk->browser . "\n\t\t\t\t\t\t<br>" . gethostbyaddr($rk->ip) . "\n\t\t\t\t\t\t<br>" . $rk->agent . "\n\t\t\t\t\t</small></div></th></tr></thead><tbody>\n\t\t\t\t\t<script> document.getElementById('" . $rk->ip . "').style.display='none';</script>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . luc_hdate($rk->date) . " " . $rk->time . "</td>\n\t\t\t\t\t<td>" . (isset($rk->post_title) ? $rk->post_title : luc_post_title_Decode(urldecode($rk->urlrequested))) . ""; if ($rk->searchengine != '') { echo "<br><small>arrived from <b>" . $rk->searchengine . "</b> searching <a target='_blank' href='" . $rk->referrer . "' >" . urldecode($rk->search) . "</a></small>"; } elseif ($rk->referrer != '' && strpos($rk->referrer, $home) === false) { echo "<br><small>arrived from <a target='_blank' href='" . $rk->referrer . "' >" . $rk->referrer . "</a></small>"; } echo "</div></td></tr>\n"; $MaxId = $rk->MaxId; $num_row = 1; } elseif ($num_row < $LIMIT_PROOF) { echo "<tr><td>" . luc_hdate($rk->date) . " " . $rk->time . "</td>\n\t\t\t\t\t\t<td>" . (isset($rk->post_title) ? $rk->post_title : luc_post_title_Decode(urldecode($rk->urlrequested))) . ""; if ($rk->searchengine != '') { echo "<br><small>arrived from <b>" . $rk->searchengine . "</b> searching <a target='_blank' href='" . $rk->referrer . "' >" . urldecode($rk->search) . "</a></small>"; } elseif ($rk->referrer != '' && strpos($rk->referrer, $home) === false) { echo "<br><small>arrived from <a target='_blank' href='" . $rk->referrer . "' >" . $rk->referrer . "</a></small>"; } $num_row += 1; echo "</td></tr></tbody>"; } } echo "</div></td></tr>\n</table>"; luc_print_pp_link($NP, $pp, $action); echo "</div>"; luc_StatPressV_load_time(); }
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 "" . urldecode($rk->agent) . "" on Google...'> " . $rk->agent . "</a> </td>\r\n\t\t\t<td>" . $rk->ipcount . "</td></tr>"; } ?> </tbody> </table> <?php if (isset($_POST['undefagentsrows'])) { die; } }
function luc_spybot() { global $wpdb, $StatPressV_Option; $action = "spybot"; $table_name = STATPRESS_V_TABLE_NAME; $LIMIT = $StatPressV_Option['StatPressV_SpyBot_Bots_Per_Page']; $LIMIT_PROOF = $StatPressV_Option['StatPressV_SpyBot_Visits_Per_Bot']; if ($LIMIT == 0) { $LIMIT = 10; } if ($LIMIT_PROOF == 0) { $LIMIT_PROOF = 30; } $pa = luc_page_posts(); $LimitValue = $pa * $LIMIT - $LIMIT; // limit the search 7 days ago $day_ago = gmdate('Ymd', current_time('timestamp') - 7 * 86400); $MinId = $wpdb->get_var("SELECT min(id) as MinId\n\t\t\t\tFROM {$table_name}\n\t\t\t\tWHERE date > {$day_ago};"); // Number of distinct spiders after $day_ago $Num = $wpdb->get_var("SELECT count(distinct spider)\n\t\t\t\tFROM {$table_name}\n\t\t\t\tWHERE spider<>''\n\t\t\t\t\tAND id >{$MinId};"); $NA = ceil($Num / $LIMIT); echo "<div class='wrap'><h2>" . __('Bot Spy', 'statpress') . "</h2>"; // selection of spider, group by spider, order by most recently visit (last id in the table) $sql = "SELECT *\n\t\t\t\t\tFROM {$table_name} as T1\n\t\t\t\t\tJOIN\n\t\t\t\t\t\t(SELECT spider,max(id) as MaxId\n\t\t\t\t\t\t\tFROM {$table_name}\n\t\t\t\t\t\t\tWHERE spider<>''\n\t\t\t\t\t\t\tGROUP BY spider\n\t\t\t\t\t\t\tORDER BY MaxId\n\t\t\t\t\t\t\tDESC LIMIT {$LimitValue}, {$LIMIT}\n\t\t\t\t\t\t) as T2\n\t\t\t\t\tON T1.spider = T2.spider\n\t\t\t\t\tWHERE T1.id > {$MinId}\n\t\t\t\t\tORDER BY MaxId DESC, id DESC;\n\t\t\t\t"; $qry = $wpdb->get_results($sql); echo '<div align="center">'; luc_print_pp_pa_link(0, 0, $action, $NA, $pa); echo '</div><div align="left">'; ?> <script> function ttogle(thediv){ if (document.getElementById(thediv).style.display=="inline") { document.getElementById(thediv).style.display="none" } else {document.getElementById(thediv).style.display="inline"} } </script> <table class="widefat" id="mainspytab" name="mainspytab"> <div align='left'> <?php $spider = "robot"; $num_row = 0; foreach ($qry as $rk) { // Bot Spy if ($robot != $rk->spider) { echo "<div align='left'>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr><th scope='colgroup' colspan='2'>"; $img = str_replace(" ", "_", strtolower($rk->spider)); $img = str_replace('.', '', $img) . ".png"; $lines = file(STATPRESS_V_PLUGIN_PATH . '/def/spider.dat'); foreach ($lines as $line_num => $spider) { list($title, $id) = explode("|", $spider); if ($title == $rk->spider) { break; } // break, the tooltip ($title) is found } echo "<IMG style='border:0px;height:16px;align:left;' alt='" . $title . "' title='" . $title . "' SRC='" . STATPRESS_V_PLUGIN_URL . '/images/spider/' . $img . "'>\n\t\t\t\t\t\t\t\t\t<span style='color:#006dca;cursor:pointer;border-bottom:1px dotted #AFD5F9;font-size:8pt;' onClick=ttogle('" . $img . "');>(more information)</span>\n\t\t\t\t\t\t\t\t\t<div id='" . $img . "' name='" . $img . "'><br /><small>" . $rk->ip . "</small><br><small>" . $rk->agent . "<br /></small></div>\n\t\t\t\t\t\t\t\t\t<script>document.getElementById('" . $img . "').style.display='none';</script>\n\t\t\t\t\t\t\t\t\t</th></tr></thead><tbody>\n\t\t\t\t\t\t\t\t\t<tr><td>" . luc_hdate($rk->date) . " " . $rk->time . "</td>\n\t\t\t\t\t\t\t\t\t<td>" . (isset($rk->post_title) ? $rk->post_title : luc_post_title_Decode(urldecode($rk->urlrequested))) . "</td></tr>"; $robot = $rk->spider; $num_row = 1; } else { if ($num_row < $LIMIT_PROOF) { echo "<tr>\n\t\t\t\t\t\t<td>" . luc_hdate($rk->date) . " " . $rk->time . "</td>\n\t\t\t\t\t\t<td>" . (isset($rk->post_title) ? $rk->post_title : luc_post_title_Decode(urldecode($rk->urlrequested))) . "</td></tr>"; $num_row += 1; } } echo "</div></td></tr>\n"; } echo "</tbody></table>"; luc_print_pp_pa_link(0, 0, $action, $NA, $pa); echo "</div>"; luc_StatPressV_load_time(); }
function luc_display_by_IP($ip) { global $wpdb; $table_name = STATPRESS_V_TABLE_NAME; $qry_s = "SELECT *\n\t\t\t\tFROM {$table_name}\n\t\t\t\tWHERE ip = '{$ip}'\n\t\t\t\tORDER BY id DESC\n\t\t\t\t"; $qry = $wpdb->get_results($qry_s); $num = $wpdb->num_rows; $qry_sa = "SELECT DISTINCT agent\n\t\t\t\tFROM {$table_name}\n\t\t\t\tWHERE ip = '{$ip}'\n\t\t\t\tORDER BY agent ASC ;\n\t\t\t\t"; $qrya = $wpdb->get_results($qry_sa); if ($_POST['markbot'] == 'Mark as spambot') { luc_BanBot('ip', $ip); } if ($_POST['banip'] == 'Ban IP address') { luc_BanIP($ip); } $text_OS = $StatPressV_Option['StatPressV_Dont_Show_OS_name'] != 'checked' ? true : false; $text_browser = $StatPressV_Option['StatPressV_Dont_Show_Browser_name'] != 'checked' ? true : false; $text = "Report for " . $ip . " "; ?> <form method=post> <div class='wrap'><table style="width:100%"><tr><td><h2> <?php _e($text); ?> </h2></td> <td width=50px align='right'> <input type=submit name=banip value='Ban IP address' > </td> </tr> </table> <table class='widefat'> <thead> <tr> <th scope='col' colspan='2'></th> </thead> <tbody> <tr> <td>Records in database:</td> <td> <?php _e($num); ?> </td> </tr> <tr> <td>Latest hit:</td> <td> <?php _e(luc_hdate($qry[0]->date) . " " . $qry[0]->time); ?> </td> </tr> <tr> <td>First hit:</td> <td> <?php _e(luc_hdate($qry[$num - 1]->date) . " " . $qry[$num - 1]->time); ?> </td> </tr> <tr> <td>User agent(s):</td> <td> <?php _e(luc_print_uas($qrya)); ?> </td> </tr> </tbody> </table> <?php $geoip = luc_GeoIP_get_data($ip); if ($geoip !== false) { ?> <table class='widefat'> <thead><tr><th scope='col' colspan='4'>GeoIP Information</th></tr></thead> <tbody> <tr> <td><strong>Country:</strong></td> <td> <?php _e($geoip['cn'] . " (" . $geoip['cc'] . ")"); ?> <IMG style='border:0px;height:16px;' alt='$cn' title='$cn' SRC=' <?php _e(STATPRESS_V_PLUGIN_URL . "/images/domain/" . strtolower($geoip['cc']) . '.png'); ?> '></td> <td><strong>Continent Code:</strong></td> <td> <?php _e($geoip['continent_code']); ?> </td> </tr> <tr> <td><strong>Region:</strong></td> <td> <?php _e($geoip['region']); ?> </td> <td><strong>Area Code: (USA Only)</strong></td> <td> <?php _e($geoip['area_code']); ?> </td> </tr> <tr> <td><strong>City:</strong></td> <td> <?php _e($geoip['city']); ?> </td> <td><strong>Postal Code: (USA Only)</strong></td> <td> <?php _e($geoip['postal_code']); ?> </td> </tr> <tr> <td><strong>Latitude/Longitude</strong></td> <td> <a href='http://maps.google.com/maps?q=<?php _e($geoip['latitude'] . "+" . $geoip['longitude']); ?> ' target='_blank' title='Lookup latitude/longitude location on Google Maps...'><?php _e($geoip['latitude'] . " " . $geoip['longitude']); ?> </a></td> <td><strong>Metro Code: (USA Only)</strong></td> <td> <?php _e($geoip['metro_code']); ?> </td> </tr> </tbody> </table> <?php } ?> <table class='widefat'> <thead> <tr> <th scope='col' colspan='6'>URLs Requested</th> </tr> </thead> <thead> <tr> <th scope='col'>Date</th> <th scope='col'>Time</th> <th scope='col'>OS</th> <th scope='col'>Browser</th> <th scope='col'>Agent</th> <th scope='col'>Referrer</th> <th scope='col'>URL Requested</th> </tr> </thead> <tbody> <?php foreach ($qry as $rk) { ?> <tr> <td> <?php _e(luc_hdate($rk->date)); ?> </td> <td> <?php _e($rk->time); ?> </td> <td> <?php _e(luc_HTML_IMG($rk->os, 'os', $text_OS)); ?> </td> <td> <?php _e(luc_HTML_IMG($rk->browser, 'browser', $text_browser)); ?> </td> <td> <?php _e($rk->agent); ?> </td> <td> <?php _e($rk->referrer); ?> </td> <td> <?php _e(luc_post_title_Decode($rk->urlrequested)); ?> </td> </tr> </tbody> <?php } ?> </table> </div> </form> <?php luc_StatPressV_load_time(); }