![]() |
|
Welcome to Talk Directories forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! |
| |||||||
| Modifications A place to discuss directory modifications. Members may post new mods, offer support, and help others with mods for directories. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I've made this mod for The Directory Zone for grab all users and spiders/bots. You may use/share this mod but you are forbidden to remove the comments from code. Create the SQL table: Code: -- -- Table structure for table `PLD_WHOS_ONLINE` -- CREATE TABLE `PLD_WHOS_ONLINE` ( `id` bigint(20) NOT NULL auto_increment, `timestamp` int(15) NOT NULL default '0', `ip` varchar(40) NOT NULL default '', `isbot` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `ip` (`ip`), KEY `timestamp` (`timestamp`), KEY `isbot` (`isbot`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; Code: ?> Code: //START - Who's online mod for PHPLD v3.2
// Writtem by Paulo Matoso - The Directory Zone - http://www.thedirectoryzone.com/
//
//Fetch Time
$time_stamp = time();
$time_limit = $time_stamp - 900; //900=15 minutes :: 86400=24h
$the_ip = get_client_ip(); //Get user IP
$ispider = is_spider(); // See if is a spider. return true if is a spider
//Insert User in MySQL
$result = mysql_query("INSERT INTO ".TABLE_PREFIX."WHOS_ONLINE (timestamp, ip, isbot) VALUES('$time_stamp','$the_ip','$ispider')");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
//Delete Users online greater than $time_limit
$result = mysql_query("DELETE FROM ".TABLE_PREFIX."WHOS_ONLINE WHERE timestamp<$time_limit");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
//Fetch online users
$result = mysql_query("SELECT DISTINCT ip,isbot FROM ".TABLE_PREFIX."WHOS_ONLINE WHERE isbot=0");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$online_users = mysql_num_rows($result);
//Fetch online spiders
$result = mysql_query("SELECT DISTINCT ip,isbot FROM ".TABLE_PREFIX."WHOS_ONLINE WHERE isbot=1");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$online_spiders = mysql_num_rows($result);
$tpl->assign('online_users' , $online_users);
$tpl->assign('online_spiders' , $online_spiders);
$tpl->assign('total_online' , ($online_users+$online_spiders));
//END - Who's online mod Code: ?> Code: /*
is_spider()
- Function for testing if a useragent matches that of a spider
- Returns useragent string if true
Copyright (c) 2006, Takeshi Media
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function is_spider()
{
global $_SERVER;
static $isspider = 'init';
if( $isspider != 'init' )
{
// its set so don't do anything
} else {
// don't know if this is a spider or not yet
$spiders = array(
"almaden.ibm.com" ,
"gigabot" ,
"appie 1.1" ,
"architext" ,
"ask jeeves",
"asterias2.0",
"augurfind" ,
"baiduspider" ,
"bannana_bot" ,
"bdcindexer" ,
"crawler" ,
"crawler@fast" ,
"docomo" ,
"fast-webcrawler",
"fluffy the spider",
"frooglebot",
"geobot",
"googlebot",
"mediapartners-google",
"gulliver",
"henrythemiragorobot",
"ia_archiver",
"infoseek",
"kit_fireball",
"lachesis",
"lycos_spider",
"mantraagent",
"mercator",
"msnbot",
"moget" ,
"muscatferret" ,
"nationaldirectory-webspider" ,
"naverrobot" ,
"ncsa beta" ,
"netresearchserver" ,
"ng/1.0" ,
"osis-project" ,
"polybot" ,
"pompos" ,
"scooter" ,
"seventwentyfour" ,
"sidewinder" ,
"sleek spider" ,
"slurp" ,
"steeler" ,
"szukacz" ,
"t-h-u-n-d-e-r-s-t-o-n-e" ,
"teoma" ,
"turnitinbot" ,
"ultraseek" ,
"vagabondo" ,
"voilabot" ,
"w3c_validator" ,
"zao" ,
"zyborg"
);
$useragent = strtolower( $_SERVER["HTTP_USER_AGENT"] );
$isspider = 0;
while( $pattern = array_pop( $spiders ))
{
$isspider = strpos( $useragent, $pattern);
if( is_integer( $isspider ) )
{
$isspider = 1;
break;
}
}
}
return $isspider;
} Code: Currently Active Users: {$total_online} {if $online_users eq 0 and $online_spiders eq 1}({$online_spiders} spider){elseif $online_users eq 1 and $online_spiders eq 0}({$online_users} user){elseif $online_users eq 1 and $online_spiders eq 1}({$online_users} user and {$online_spiders} spider){elseif $online_users gt 1 and $online_spiders eq 0}({$online_users} users){elseif $online_users eq 0 and $online_spiders gt 1}({$online_spiders} spiders){elseif $online_users gt 1 and $online_spiders eq 1}({$online_users} users and {$online_spiders} spider){elseif $online_users eq 1 and $online_spiders gt 1}({$online_users} user and {$online_spiders} spiders){elseif $online_users gt 1 and $online_spiders gt 1}({$online_users} users and {$online_spiders} spiders){/if} I?m not a PHP ?expert? (far from it), but I learn quickly, and I love to learn, so any comments/critics' are always accepted :-) | |||
| | |
| | #4 | ||
| Any idea if that could work with 3.1 version ? | |||
| | |
| | #5 | ||
| Thanks for this mod!
__________________ Welcome to TalkDirectories - a great place to discuss Search Engines, Web Directories and other webmaster issues. Fell free to join our community today and start talking! Turnkey Websites | Turnkey Websites | |||
| | |
| | #6 | ||
| great mod. it will help us a lot.
__________________ Web Resource::Red11Rock:: Web Guide::$1 Link::phpLD Template Coder::1 Dollar Look::Bangladesh Gift | |||
| | |
| | #7 | ||
| Great Mod ![]() Thanks for sharing it!
__________________ | |||
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Online Marketing | shreya | General Marketing | 6 | 09-03-2008 05:13 AM |
| How much time do you spend online? | mikey1090 | Off Topic | 33 | 07-29-2008 08:29 AM |
| What do you do when you aren't online? | mikey1090 | Off Topic | 13 | 04-24-2008 08:05 AM |
| Integrated online marketing and lead generation | Lazarus | General Marketing | 0 | 03-28-2008 01:53 AM |
| Online Marketing Strategy | pauljun | Search Engine Optimization | 2 | 03-14-2008 03:16 AM |