| 35 | | $bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'ubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com bot' => 'become.com', 'Technorati Blog Bot'=>'technorati'); |
|---|
| | 44 | $bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'ubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com bot' => 'become.com', 'Technorati Blog Bot' => 'technorati'); |
|---|
| | 250 | } |
|---|
| | 251 | |
|---|
| | 252 | |
|---|
| | 253 | ### Function: Check IP |
|---|
| | 254 | function check_ip($ip) { |
|---|
| | 255 | if(!empty($_COOKIE[USER_COOKIE]) && ($ip != 'unknown')) { |
|---|
| | 256 | return "(<a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=$ip\" target=\"_blank\" title=\"".gethostbyaddr($ip)."\">$ip</a>)"; |
|---|
| | 257 | } |
|---|
| | 258 | } |
|---|
| | 259 | |
|---|
| | 260 | |
|---|
| | 261 | ### Function: Display UserOnline For Admin |
|---|
| | 262 | function display_useronline() { |
|---|
| | 263 | global $wpdb, $bots; |
|---|
| | 264 | // Reassign Bots Name |
|---|
| | 265 | $bots_name = array(); |
|---|
| | 266 | foreach($bots as $botname => $botlookfor) { |
|---|
| | 267 | $bots_name[] = $botname; |
|---|
| | 268 | } |
|---|
| | 269 | |
|---|
| | 270 | // Get The Users Online |
|---|
| | 271 | $usersonline = $wpdb->get_results("SELECT * FROM $wpdb->useronline"); |
|---|
| | 272 | |
|---|
| | 273 | // Variables Variables Variables |
|---|
| | 274 | $members = array(); |
|---|
| | 275 | $guests = array(); |
|---|
| | 276 | $bots = array(); |
|---|
| | 277 | $total_users = 0; |
|---|
| | 278 | $total_members = 0; |
|---|
| | 279 | $total_guests = 0; |
|---|
| | 280 | $total_bots = 0; |
|---|
| | 281 | $nicetext_users = ''; |
|---|
| | 282 | $nicetext_members = ''; |
|---|
| | 283 | $nicetext_guests = ''; |
|---|
| | 284 | $nicetext_bots = ''; |
|---|
| | 285 | |
|---|
| | 286 | // Process Those User Who Is Online |
|---|
| | 287 | if($usersonline) { |
|---|
| | 288 | foreach($usersonline as $useronline) { |
|---|
| | 289 | if($useronline->username == 'Guest') { |
|---|
| | 290 | $guests[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url))); |
|---|
| | 291 | $total_guests++; |
|---|
| | 292 | } elseif(in_array($useronline->username, $bots_name)) { |
|---|
| | 293 | $bots[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url))); |
|---|
| | 294 | $total_bots++; |
|---|
| | 295 | } else { |
|---|
| | 296 | $members[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url))); |
|---|
| | 297 | $total_members++; |
|---|
| | 298 | } |
|---|
| | 299 | } |
|---|
| | 300 | $total_users = ($total_guests+$total_bots+$total_members); |
|---|
| | 301 | } |
|---|
| | 302 | |
|---|
| | 303 | // Nice Text For Users |
|---|
| | 304 | if($total_users > 1) { |
|---|
| | 305 | $nicetext_users = $total_users.' '.__('Users'); |
|---|
| | 306 | } else { |
|---|
| | 307 | $nicetext_users = $total_users.' '.__('User'); |
|---|
| | 308 | } |
|---|
| | 309 | |
|---|
| | 310 | // Nice Text For Members |
|---|
| | 311 | if($total_members > 1) { |
|---|
| | 312 | $nicetext_members = $total_members.' '.__('Members'); |
|---|
| | 313 | } else { |
|---|
| | 314 | $nicetext_members = $total_members.' '.__('Member'); |
|---|
| | 315 | } |
|---|
| | 316 | |
|---|
| | 317 | |
|---|
| | 318 | // Nice Text For Guests |
|---|
| | 319 | if($total_guests > 1) { |
|---|
| | 320 | $nicetext_guests = $total_guests.' '.__('Guests'); |
|---|
| | 321 | } else { |
|---|
| | 322 | $nicetext_guests = $total_guests.' '.__('Guest'); |
|---|
| | 323 | } |
|---|
| | 324 | |
|---|
| | 325 | // Nice Text For Bots |
|---|
| | 326 | if($total_bots > 1) { |
|---|
| | 327 | $nicetext_bots = $total_bots.' '.__('Bots'); |
|---|
| | 328 | } else { |
|---|
| | 329 | $nicetext_bots = $total_bots.' '.__('Bot'); |
|---|
| | 330 | } |
|---|
| | 331 | ?> |
|---|
| | 332 | <div class="wrap"> |
|---|
| | 333 | <h2>UserOnline Stats</h2> |
|---|
| | 334 | <p>There are a total of <b><?php echo $nicetext_users; ?></b> online now.</p> |
|---|
| | 335 | <p>Out of which, there are <b><?php echo $nicetext_members; ?></b>, <b><?php echo $nicetext_guests; ?></b> and <b><?php echo $nicetext_bots; ?></b>.</p> |
|---|
| | 336 | <p>Most users ever online was <b><?php get_most_useronline(); ?></b> on <b><?php get_most_useronline_date(); ?></b></p> |
|---|
| | 337 | </div> |
|---|
| | 338 | <?php |
|---|
| | 339 | // Print Out Members |
|---|
| | 340 | if($total_members > 0) { |
|---|
| | 341 | echo '<div class="wrap"><h2>'.$nicetext_members.' '.__('Online Now').'</h2>'."\n"; |
|---|
| | 342 | } |
|---|
| | 343 | $no=1; |
|---|
| | 344 | if($members) { |
|---|
| | 345 | foreach($members as $member) { |
|---|
| | 346 | echo '<p><b>#'.$no.' - <a href="'.get_settings('home').'/wp-stats.php?author='.$member['username'].'">'.$member['username'].'</a></b> '.check_ip($member['ip']).' on '.gmdate('d.m.Y @ H:i', $member['timestamp']).'<br />'.$member['location'].' [<a href="'.$member['url'].'">url</a>]</p>'."\n"; |
|---|
| | 347 | $no++; |
|---|
| | 348 | } |
|---|
| | 349 | echo '</div>'; |
|---|
| | 350 | } |
|---|
| | 351 | // Print Out Guest |
|---|
| | 352 | if($total_guests > 0) { |
|---|
| | 353 | echo '<div class="wrap"><h2>'.$nicetext_guests.' '.__('Online Now').'</h2>'."\n"; |
|---|
| | 354 | } |
|---|
| | 355 | $no=1; |
|---|
| | 356 | if($guests) { |
|---|
| | 357 | foreach($guests as $guest) { |
|---|
| | 358 | echo '<p><b>#'.$no.' - '.$guest['username'].'</b> '.check_ip($guest['ip']).' on '.gmdate('d.m.Y @ H:i', $guest['timestamp']).'<br />'.$guest['location'].' [<a href="'.$guest['url'].'">url</a>]</p>'."\n"; |
|---|
| | 359 | $no++; |
|---|
| | 360 | } |
|---|
| | 361 | echo '</div>'; |
|---|
| | 362 | } |
|---|
| | 363 | // Print Out Bots |
|---|
| | 364 | if($total_bots > 0) { |
|---|
| | 365 | echo '<div class="wrap"><h2>'.$nicetext_bots.' '.__('Online Now').'</h2>'."\n"; |
|---|
| | 366 | } |
|---|
| | 367 | $no=1; |
|---|
| | 368 | if($bots) { |
|---|
| | 369 | foreach($bots as $bot) { |
|---|
| | 370 | echo '<p><b>#'.$no.' - '.$bot['username'].'</b> '.check_ip($bot['ip']).' on '.gmdate('d.m.Y @ H:i', $bot['timestamp']).'<br />'.$bot['location'].' [<a href="'.$bot['url'].'">url</a>]</p>'."\n"; |
|---|
| | 371 | $no++; |
|---|
| | 372 | } |
|---|
| | 373 | echo '</div>'; |
|---|
| | 374 | } |
|---|
| | 375 | if($total_users == 0) { |
|---|
| | 376 | echo '<div class="wrap"><h2>'.__('No One Is Online Now').'</h2></div>'."\n"; |
|---|
| | 377 | } |
|---|
| | 378 | ?> |
|---|
| | 379 | <?php |
|---|