br />

Go Back   PTCPay.Com > Offtopic > Freebies

Notices

Freebies Want to give something away for free? We all like freebies.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-28-2010, 05:47 PM
Stefan
Guest
 
Posts: n/a
Thumbs up Free GeN4 addon: countrymembers

Here's a free addon for all GeN4 0.92 owners,
it shows current online members of your sites with countryflags,
it has a popup tooltip which shows the country name.
example is on WinnerBux.com



(note: tooltip requires: Jquery, VTIP to be installed download: http://www.vertigo-project.com/projects/vtip]here)

How to make it work:

Open your index.php page or whatever page you want to put it on
1) add in the PHP code below under: if(!defined('GEN4_PROCESS')) { exit(); }

Code:
$result = mysql_query("SELECT * FROM users WHERE lastaction >= unix_timestamp() - 60*5"); 
$countryvisitors = '';

$tnum = '0';
while($row = mysql_fetch_array( $result )) { 
	
	$tnum = $tnum + 1;

	if ($tnum == 7) 
	// Number of Users to show per row.
	{
		$countryvisitors = $countryvisitors . '<br />';  
		$tnum = '0';
	}

	$ip = $row['lastip'];
	$ip_number = sprintf("%u", ip2long($ip));

	$country = mysql_query("SELECT `country_code` FROM `ip2country` WHERE `begin_ip_num`<='$ip_number' AND `end_ip_num`>='$ip_number'")
		or die(mysql_error());

	$countryname = mysql_query("SELECT `country_name` FROM `ip2country` WHERE `begin_ip_num`<='$ip_number' AND `end_ip_num`>='$ip_number'")
		or die(mysql_error());

	$countryname = mysql_fetch_array($countryname);
	$countryname = strtolower($countryname['country_name']);

	$country = mysql_fetch_array($country);
	$country = strtolower($country['country_code']);
	$country = "flags/{$country}.png";


	if ($country == 'flags/.png') {
		$country = 'flags/earth.png';
		$countryname = 'earth';
	
	}

	$countryvisitors = $countryvisitors . '<img src="forum/'. $country . '" align="absmiddle" class="vtip" title="' . $countryname . '" vspace="5" hspace="5">" . $row['username']  

. '<br />';


}
2. In the content code of your site add to show count of members followed by names & flags:
<b>Online members ({$online}):</b><br />{$countryvisitors}<br />

or just {$countryvisitors}
for names & flags without header.

3. Upload attached earth.png to forum/flags to
show earth flag for members whose location cannot be determined.

Enjoy!
Attached Images
File Type: png earth.png (366 Bytes, 127 views)

Last edited by Stefan; 08-28-2010 at 05:55 PM.
Reply With Quote
  #2 (permalink)  
Old 08-28-2010, 06:18 PM
PTCPay Owner
 
Join Date: Dec 2008
Posts: 1,634
Default

Thanks for the contribution .
__________________
PTCPay Administrator.
Click here to order GeN4.
Reply With Quote
  #3 (permalink)  
Old 08-29-2010, 04:08 PM
Coder
 
Join Date: May 2010
Location: brasil
Posts: 186
Default

Thanks for sharing!
Reply With Quote
  #4 (permalink)  
Old 09-02-2010, 09:48 PM
Junior Member
 
Join Date: Feb 2010
Posts: 18
Default

very cool system, thanks
Reply With Quote
Reply

Tags
countries, flags, gen4, members, online

Thread Tools
Display Modes

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 07:54 PM.
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.