Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-UserOnline |
Version | 2.00 |
Comparing to | |
See all releases |
Version 2.00
- readme-install.txt +45 -0
- readme-upgrade.txt +34 -0
- readme.txt +17 -0
- useronline-install.php +111 -0
- useronline.php +120 -0
- wp-useronline.php +133 -0
readme-install.txt
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> Installation Instructions
|
2 |
+
--------------------------------------------------
|
3 |
+
// Open wp-admin folder
|
4 |
+
|
5 |
+
Put:
|
6 |
+
------------------------------------------------------------------
|
7 |
+
useronline-install.php
|
8 |
+
------------------------------------------------------------------
|
9 |
+
|
10 |
+
|
11 |
+
// Open wp-content/plugins folder
|
12 |
+
|
13 |
+
Put:
|
14 |
+
------------------------------------------------------------------
|
15 |
+
useronline.php
|
16 |
+
------------------------------------------------------------------
|
17 |
+
|
18 |
+
|
19 |
+
// Open root Wordpress folder
|
20 |
+
|
21 |
+
Put:
|
22 |
+
------------------------------------------------------------------
|
23 |
+
wp-useronline.php
|
24 |
+
------------------------------------------------------------------
|
25 |
+
|
26 |
+
|
27 |
+
// Activate useronline plugin
|
28 |
+
|
29 |
+
|
30 |
+
// Run wp-admin/useronline-install.php
|
31 |
+
|
32 |
+
|
33 |
+
// Open wp-content/themes/<YOUR THEME NAME>/sidebar.php
|
34 |
+
|
35 |
+
Add:
|
36 |
+
------------------------------------------------------------------
|
37 |
+
<?php if (function_exists('useronline')): ?>
|
38 |
+
<li>
|
39 |
+
<h2>UserOnline</h2>
|
40 |
+
<ul>
|
41 |
+
<li><a href="<?php echo get_settings('home'); ?>/wp-useronline.php"><?php get_useronline(); ?></a></li>
|
42 |
+
</ul>
|
43 |
+
</li>
|
44 |
+
<?php endif; ?>
|
45 |
+
------------------------------------------------------------------
|
readme-upgrade.txt
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> Upgrade Instructions For Version 1.0x To Version 2.00
|
2 |
+
------------------------------------------------------------------
|
3 |
+
// Open wp-content/plugins folder
|
4 |
+
|
5 |
+
Put:
|
6 |
+
------------------------------------------------------------------
|
7 |
+
useronline.php
|
8 |
+
------------------------------------------------------------------
|
9 |
+
|
10 |
+
|
11 |
+
// Open root Wordpress folder
|
12 |
+
|
13 |
+
Put:
|
14 |
+
------------------------------------------------------------------
|
15 |
+
wp-useronline.php
|
16 |
+
------------------------------------------------------------------
|
17 |
+
|
18 |
+
|
19 |
+
// Remove Previous Traces Of UserOnline Code In Your Theme
|
20 |
+
|
21 |
+
|
22 |
+
// Open wp-content/themes/<YOUR THEME NAME>/sidebar.php
|
23 |
+
|
24 |
+
Add:
|
25 |
+
------------------------------------------------------------------
|
26 |
+
<?php if (function_exists('useronline')): ?>
|
27 |
+
<li>
|
28 |
+
<h2>UserOnline</h2>
|
29 |
+
<ul>
|
30 |
+
<li><a href="<?php echo get_settings('home'); ?>/wp-useronline.php"><?php get_useronline(); ?></a></li>
|
31 |
+
</ul>
|
32 |
+
</li>
|
33 |
+
<?php endif; ?>
|
34 |
+
------------------------------------------------------------------
|
readme.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-> UserOnline Plugin For WordPress 2.0
|
2 |
+
--------------------------------------------------
|
3 |
+
Author -> Lester 'GaMerZ' Chan
|
4 |
+
Email -> lesterch@singnet.com.sg
|
5 |
+
Website -> http://www.lesterchan.net/
|
6 |
+
Demo -> http://www.lesterchan.net/wp-useronline.php
|
7 |
+
Updated -> 1st January 2006
|
8 |
+
--------------------------------------------------
|
9 |
+
|
10 |
+
|
11 |
+
// Version 2.00 (01-01-2006)
|
12 |
+
- NEW: Compatible With WordPress 2.0
|
13 |
+
- NEW: Better Installer
|
14 |
+
- NEW: GPL License Added
|
15 |
+
- NEW: Page Title Added To wp-useronline.php
|
16 |
+
- NEW: Added Extra Bots, Credit To Greg Perry (http://www.gregrperry.com/)
|
17 |
+
- FIXED: Cleaner Codes
|
useronline-install.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
+----------------------------------------------------------------+
|
4 |
+
| |
|
5 |
+
| WordPress 2.0 Plugin: WP-UserOnline 2.00 |
|
6 |
+
| Copyright (c) 2005 Lester "GaMerZ" Chan |
|
7 |
+
| |
|
8 |
+
| File Written By: |
|
9 |
+
| - Lester "GaMerZ" Chan |
|
10 |
+
| - http://www.lesterchan.net |
|
11 |
+
| |
|
12 |
+
| File Information: |
|
13 |
+
| - Install WP-UserOnline 2.00 |
|
14 |
+
| - wp-admin/useronline-install.php |
|
15 |
+
| |
|
16 |
+
+----------------------------------------------------------------+
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
### Require Config
|
21 |
+
require('../wp-config.php');
|
22 |
+
|
23 |
+
### Variables, Variables, Variables
|
24 |
+
$current_timestamp = current_time('timestamp');
|
25 |
+
$create_table = array();
|
26 |
+
$error = '';
|
27 |
+
|
28 |
+
### Create Tables (3 Tables)
|
29 |
+
$create_table[] = "CREATE TABLE $wpdb->useronline (".
|
30 |
+
" timestamp int(15) NOT NULL default '0',".
|
31 |
+
" username varchar(50) NOT NULL default '',".
|
32 |
+
" ip varchar(40) NOT NULL default '',".
|
33 |
+
" location varchar(255) NOT NULL default '',".
|
34 |
+
" url varchar(255) NOT NULL default '',".
|
35 |
+
" PRIMARY KEY (timestamp))";
|
36 |
+
|
37 |
+
### Check Whether There Is Any Pre Errors
|
38 |
+
$wpdb->show_errors = false;
|
39 |
+
$check_install = $wpdb->query("SHOW COLUMNS FROM $wpdb->useronline");
|
40 |
+
if($check_install) {
|
41 |
+
$error = __('You Had Already Installed WP-UserOnline.');
|
42 |
+
}
|
43 |
+
if(empty($wpdb->useronline)) {
|
44 |
+
$error = __('Please Define The useronline in wp-settings.php.');
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
|
48 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
49 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
50 |
+
<head>
|
51 |
+
<title>WordPress › <?php _e('Installing'); ?> › <?php _e('WP-UserOnline 2.00'); ?></title>
|
52 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
53 |
+
<style type="text/css" media="screen">
|
54 |
+
@import url( wp-admin.css );
|
55 |
+
</style>
|
56 |
+
</head>
|
57 |
+
<body>
|
58 |
+
<div class="wrap">
|
59 |
+
<h2><?php _e('Install WP-UserOnline 2.00'); ?></h2>
|
60 |
+
<p><?php _e('This install script will install WP-UserOnline 2.00 for your Wordpress'); ?>.</p>
|
61 |
+
<p>
|
62 |
+
<?php _e('This install script will be doing the following:'); ?><br />
|
63 |
+
<b>»</b> <b>1</b> <?php _e('tables will be created namely <b>useronline</b>.'); ?><br />
|
64 |
+
<b>»</b> <b>1</b> <?php _e('tables will be optimized namely <b>useronline</b>.'); ?><br />
|
65 |
+
</p>
|
66 |
+
<?php
|
67 |
+
if(empty($error)) {
|
68 |
+
if(!empty($_POST['install'])) {
|
69 |
+
// Create Tables
|
70 |
+
$create_table_count = 0;
|
71 |
+
echo "<p><b>".__('Creating Tables:')."</b>";
|
72 |
+
foreach($create_table as $createtable) {
|
73 |
+
$wpdb->query($createtable);
|
74 |
+
}
|
75 |
+
$check_useronline = $wpdb->query("SHOW COLUMNS FROM $wpdb->useronline");
|
76 |
+
if($check_useronline) {
|
77 |
+
echo "<br /><b>»</b> Table (<b>$wpdb->useronline</b>) created.";
|
78 |
+
$create_table_count++;
|
79 |
+
} else {
|
80 |
+
echo "<br /><b>»</b> <font color=\"red\">Table (<b>$wpdb->useronline</b>) table NOT created.</font>";
|
81 |
+
}
|
82 |
+
echo "<br /><b>»</b> <b>$create_table_count / 1</b> Tables Created.</p>";
|
83 |
+
// Optimize Tables
|
84 |
+
$optimize_table_count = 0;
|
85 |
+
echo "<p><b>".__('Optimizing Tables:')."</b>";
|
86 |
+
$optimize_tables = $wpdb->query("OPTIMIZE TABLE $wpdb->useronline");
|
87 |
+
if($optimize_tables) {
|
88 |
+
echo "<br /><b>»</b> Tables (<b>$wpdb->useronline</b>) optimized.";
|
89 |
+
$optimize_table_count = 1;
|
90 |
+
} else {
|
91 |
+
echo "<br /><b>»</b> <font color=\"red\">Tables (<b>$wpdb->useronline</b>) NOT optimized.</font>";
|
92 |
+
}
|
93 |
+
echo "<br /><b>»</b> <b>$optimize_table_count / 1</b> Tables Optimized.</p>";
|
94 |
+
// Check Whether Install Is Successful
|
95 |
+
if($create_table_count == 1) {
|
96 |
+
echo '<p align="center"><b>'.__('WP-UserOnline 2.00 Installed Successfully.').'</b><br />'.__('Please remember to delete this file before proceeding on.').'</p>';
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
?>
|
100 |
+
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
101 |
+
<div align="center"><input type="submit" name="install" value="<?php _e('Click Here To Install WP-UserOnline 2.00'); ?>" class="button"></div>
|
102 |
+
</form>
|
103 |
+
<?php
|
104 |
+
}
|
105 |
+
} else {
|
106 |
+
echo "<p align=\"center\"><font color=\"red\"><b>$error</b></font></p>\n";
|
107 |
+
}
|
108 |
+
?>
|
109 |
+
</div>
|
110 |
+
</body>
|
111 |
+
</html>
|
useronline.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP-UserOnline
|
4 |
+
Plugin URI: http://www.lesterchan.net/portfolio/programming.php
|
5 |
+
Description: Adds A Useronline Feature To WordPress
|
6 |
+
Version: 2.0
|
7 |
+
Author: GaMerZ
|
8 |
+
Author URI: http://www.lesterchan.net
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/* Copyright 2005 Lester Chan (email : gamerz84@hotmail.com)
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation; either version 2 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27 |
+
*/
|
28 |
+
|
29 |
+
|
30 |
+
### UserOnline Table Name
|
31 |
+
$wpdb->useronline = $table_prefix . 'useronline';
|
32 |
+
|
33 |
+
### Function: Get IP
|
34 |
+
function get_IP() {
|
35 |
+
if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
|
36 |
+
$ip_address = $_SERVER["REMOTE_ADDR"];
|
37 |
+
} else {
|
38 |
+
$ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
|
39 |
+
}
|
40 |
+
if(strpos($ip_address, ',') !== false) {
|
41 |
+
$ip_address = explode(',', $ip_address);
|
42 |
+
$ip_address = $ip_address[0];
|
43 |
+
}
|
44 |
+
return $ip_address;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
### Function: Process UserOnline
|
49 |
+
add_action('wp_head', 'useronline');
|
50 |
+
function useronline() {
|
51 |
+
global $wpdb;
|
52 |
+
// Search Bots
|
53 |
+
$bots = array('Google Bot' => 'googlebot', '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');
|
54 |
+
|
55 |
+
// Useronline Settings
|
56 |
+
$timeoutseconds = 300;
|
57 |
+
$timestamp = current_time('timestamp');
|
58 |
+
$timeout = ($timestamp-$timeoutseconds);
|
59 |
+
$ip = get_IP();
|
60 |
+
$url = addslashes(urlencode($_SERVER['REQUEST_URI']));
|
61 |
+
|
62 |
+
// Check For Members
|
63 |
+
if(!empty($_COOKIE['comment_author_'.COOKIEHASH])) {
|
64 |
+
$memberonline = addslashes(trim($_COOKIE['comment_author_'.COOKIEHASH]));
|
65 |
+
$where = "WHERE username='$memberonline'";
|
66 |
+
// Check For Admins
|
67 |
+
} elseif(!empty($_COOKIE['wordpressuser_'.COOKIEHASH])) {
|
68 |
+
$memberonline = addslashes(trim($_COOKIE['wordpressuser_'.COOKIEHASH]));
|
69 |
+
$where = "WHERE username='$memberonline'";
|
70 |
+
// Check For Guests
|
71 |
+
} else {
|
72 |
+
$memberonline = 'Guest';
|
73 |
+
$where = "WHERE ip='$ip'";
|
74 |
+
}
|
75 |
+
// Check For Bot
|
76 |
+
foreach ($bots as $name => $lookfor) {
|
77 |
+
if (stristr($_SERVER['HTTP_USER_AGENT'], $lookfor) !== false) {
|
78 |
+
$memberonline = addslashes($name);
|
79 |
+
$where = "WHERE ip='$ip'";
|
80 |
+
}
|
81 |
+
}
|
82 |
+
// Check For Page Title
|
83 |
+
$make_page = wp_title('»', false);
|
84 |
+
if(empty($make_page)) {
|
85 |
+
$make_page = get_bloginfo('name');
|
86 |
+
} elseif(is_single()) {
|
87 |
+
$make_page = get_bloginfo('name').' » Blog Archive '.$make_page;
|
88 |
+
} else {
|
89 |
+
$make_page = get_bloginfo('name').$make_page;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Update User First
|
93 |
+
$update_user = $wpdb->query("UPDATE $wpdb->useronline SET timestamp = '$timestamp', ip = '$ip', location = '$make_page', url = '$url' $where");
|
94 |
+
|
95 |
+
// If No Such User Insert It
|
96 |
+
if(!$update_user) {
|
97 |
+
$insert_user = $wpdb->query("INSERT INTO $wpdb->useronline VALUES ('$timestamp', '$memberonline', '$ip', '$make_page', '$url')");
|
98 |
+
}
|
99 |
+
|
100 |
+
// Delete Users
|
101 |
+
$delete_users = $wpdb->query("DELETE FROM $wpdb->useronline WHERE timestamp < $timeout");
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
### Function: Display UserOnline
|
106 |
+
function get_useronline($user = 'User', $users = 'Users', $display = true) {
|
107 |
+
global $wpdb;
|
108 |
+
// Count Total Users Online
|
109 |
+
$useronline = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->useronline");
|
110 |
+
if($display) {
|
111 |
+
if($useronline > 1) {
|
112 |
+
echo "<b>$useronline</b> $users ".__('Online');
|
113 |
+
} else {
|
114 |
+
echo "<b>$useronline</b> $user ".__('Online');
|
115 |
+
}
|
116 |
+
} else {
|
117 |
+
return $useronline;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
?>
|
wp-useronline.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
+----------------------------------------------------------------+
|
4 |
+
| |
|
5 |
+
| WordPress 2.0 Plugin: WP-UserOnline 2.00 |
|
6 |
+
| Copyright (c) 2005 Lester "GaMerZ" Chan |
|
7 |
+
| |
|
8 |
+
| File Written By: |
|
9 |
+
| - Lester "GaMerZ" Chan |
|
10 |
+
| - http://www.lesterchan.net |
|
11 |
+
| |
|
12 |
+
| File Information: |
|
13 |
+
| - Useronline Page |
|
14 |
+
| - wp-useronline.php |
|
15 |
+
| |
|
16 |
+
+----------------------------------------------------------------+
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
### Require WordPress Header
|
21 |
+
require(dirname(__FILE__).'/wp-blog-header.php');
|
22 |
+
|
23 |
+
### Function: UserOnline Page Title
|
24 |
+
add_filter('wp_title', 'useronline_pagetitle');
|
25 |
+
function useronline_pagetitle($useronline_pagetitle) {
|
26 |
+
return $useronline_pagetitle.' » UserOnline';
|
27 |
+
}
|
28 |
+
|
29 |
+
### Search Bots Array
|
30 |
+
$bots = array('Google Bot' => 'googlebot', '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');
|
31 |
+
|
32 |
+
### Reassign Bots Name
|
33 |
+
$bots_name = array();
|
34 |
+
foreach($bots as $botname => $botlookfor) {
|
35 |
+
$bots_name[] = $botname;
|
36 |
+
}
|
37 |
+
|
38 |
+
### Get The Users Online
|
39 |
+
$usersonline = $wpdb->get_results("SELECT * FROM $wpdb->useronline");
|
40 |
+
|
41 |
+
### Type Of Users Array
|
42 |
+
$bots = array();
|
43 |
+
$guests = array();
|
44 |
+
$members = array();
|
45 |
+
|
46 |
+
### Users Count
|
47 |
+
$total = array();
|
48 |
+
$total['bots'] = 0;
|
49 |
+
$total['guests'] = 0;
|
50 |
+
$total['members'] = 0;
|
51 |
+
|
52 |
+
### Process Those User Who Is Online
|
53 |
+
if($usersonline) {
|
54 |
+
foreach($usersonline as $useronline) {
|
55 |
+
if($useronline->username == 'Guest') {
|
56 |
+
$guests[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url)));
|
57 |
+
$total['guests']++;
|
58 |
+
} elseif(in_array($useronline->username, $bots_name)) {
|
59 |
+
$bots[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url)));
|
60 |
+
$total['bots']++;
|
61 |
+
} else {
|
62 |
+
$members[] = array('username' => stripslashes($useronline->username), 'timestamp' => $useronline->timestamp, 'ip' => $useronline->ip, 'location' => stripslashes($useronline->location), 'url' => stripslashes(urldecode($useronline->url)));
|
63 |
+
$total['members']++;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
### Nice Text For Bots, Guest And Members
|
69 |
+
$nicetext = array();
|
70 |
+
if($total['bots'] > 1) { $nicetext['bots'] = __('Bots'); } else { $nicetext['bots'] = __('Bot'); }
|
71 |
+
if($total['guests'] > 1) { $nicetext['guests'] = __('Guests'); } else { $nicetext['guests'] = __('Guest'); }
|
72 |
+
if($total['members'] > 1) { $nicetext['members'] = __('Members'); } else { $nicetext['members'] = __('Member'); }
|
73 |
+
|
74 |
+
### Function: Check IP
|
75 |
+
function check_ip($ip) {
|
76 |
+
if(isset($_COOKIE['wordpressuser_'.COOKIEHASH])) {
|
77 |
+
return "(<a href=\"http://ws.arin.net/cgi-bin/whois.pl?queryinput=$ip\" target=\"_blank\" title=\"".gethostbyaddr($ip)."\">$ip</a>)";
|
78 |
+
}
|
79 |
+
}
|
80 |
+
?>
|
81 |
+
<?php get_header(); ?>
|
82 |
+
<div id="content" class="narrowcolumn">
|
83 |
+
<p><?php _e('There Are A Total Of'); ?> <b><?php echo$total['members'].' '.$nicetext['members']; ?></b>, <b><?php echo$total['guests'].' '.$nicetext['guests']; ?></b> <?php _e('And'); ?> <b><?php echo$total['bots'].' '.$nicetext['bots']; ?></b> <?php _e('Online Now'); ?>.<b></b> </p>
|
84 |
+
<table width="100%" border="0" cellspacing="1" cellpadding="5">
|
85 |
+
<?php
|
86 |
+
if($total['members'] > 0) {
|
87 |
+
echo '<tr><td><h2 class="pagetitle">'.$total['members'].' '.$nicetext['members'].' '.__('Online Now').'</h2></td></tr>'."\n";
|
88 |
+
}
|
89 |
+
?>
|
90 |
+
<?php
|
91 |
+
$no=1;
|
92 |
+
if($members) {
|
93 |
+
foreach($members as $member) {
|
94 |
+
echo '<tr>'."\n";
|
95 |
+
echo '<td><b>#'.$no.' - <a href="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>]</td>'."\n";
|
96 |
+
echo '</tr>'."\n";
|
97 |
+
$no++;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
// Print Out Guest
|
101 |
+
if($total['guests'] > 0) {
|
102 |
+
echo '<tr><td><h2 class="pagetitle">'.$total['guests'].' '.$nicetext['guests'].' '.__('Online Now').'</h2></td></tr>'."\n";
|
103 |
+
}
|
104 |
+
$no=1;
|
105 |
+
if($guests) {
|
106 |
+
foreach($guests as $guest) {
|
107 |
+
echo '<tr>'."\n";
|
108 |
+
echo '<td><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>]</td>'."\n";
|
109 |
+
echo '</tr>'."\n";
|
110 |
+
$no++;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
// Print Out Bots
|
114 |
+
if($total['bots'] > 0) {
|
115 |
+
echo '<tr><td><h2 class="pagetitle">'.$total['bots'].' '.$nicetext['bots'].' '.__('Online Now').'</h2></td></tr>'."\n";
|
116 |
+
}
|
117 |
+
$no=1;
|
118 |
+
if($bots) {
|
119 |
+
foreach($bots as $bot) {
|
120 |
+
echo '<tr>'."\n";
|
121 |
+
echo '<td><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>]</td>'."\n";
|
122 |
+
echo '</tr>'."\n";
|
123 |
+
$no++;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
if($total['members'] == 0 && $total['guests'] == 0 && $total['bots']) {
|
127 |
+
echo '<tr><td><h2 class="pagetitle">'.__('No One Is Online Now').'</h2></td></tr>'."\n";
|
128 |
+
}
|
129 |
+
?>
|
130 |
+
</table>
|
131 |
+
</div>
|
132 |
+
<?php get_sidebar(); ?>
|
133 |
+
<?php get_footer(); ?>
|