[ABD] TULIP: Tiny User Locator by IP

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
User avatar
Marcus Wendel
Registered User
Posts: 534
Joined: Sun Mar 10, 2002 5:58 pm
Location: Sweden
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Marcus Wendel » Sun Nov 21, 2010 10:18 am

Very good idea with the caching. I tested the cache code on one of my 3.0.8 boards (created the new directory, chmod to 777 and then replaced the content of the functions_tulip.php file) and the cache files were created but I got the below error messages:

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4518: Cannot modify header information - headers already sent by (output started at /includes/functions_tulip.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4520: Cannot modify header information - headers already sent by (output started at /includes/functions_tulip.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4521: Cannot modify header information - headers already sent by (output started at /includes/functions_tulip.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4522: Cannot modify header information - headers already sent by (output started at /includes/functions_tulip.php:1)
/Marcus

User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by dpaanlka » Sun Nov 21, 2010 4:49 pm

The "headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>). Verify you didn't accidentally add some when you changed the functions_tulip.php.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today

User avatar
Marcus Wendel
Registered User
Posts: 534
Joined: Sun Mar 10, 2002 5:58 pm
Location: Sweden
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Marcus Wendel » Sun Nov 21, 2010 6:42 pm

dpaanlka wrote:The "headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>). Verify you didn't accidentally add some when you changed the functions_tulip.php.
You were right, there was a space before the php-tag, thanks.

I suggest not caching non-results, either international or where no ip-address is listed, such as on old users.

/Marcus

orbit_
Registered User
Posts: 2
Joined: Tue Nov 30, 2010 10:18 pm

Re: [DEV] TULIP: Tiny User Locator by IP

Post by orbit_ » Tue Nov 30, 2010 10:24 pm

Great work with the mod... love it, easy to install and good instructions!
Quick question though; you mentioned the query fetches the users IP opposed to the post ID. I'm not sure whether your original script did use the post ID and you changed it later on? Is there a way you could provide the SQL for this? I want to alter the file so even guest posters will show a country flag, and this can only be done by getting the IP from the post. Right?

Thank you :)

orbit_
Registered User
Posts: 2
Joined: Tue Nov 30, 2010 10:18 pm

Re: [DEV] TULIP: Tiny User Locator by IP

Post by orbit_ » Wed Dec 01, 2010 3:47 am

Don't worry, I worked it out myself.

Thanks anyways!

User avatar
Marcus Wendel
Registered User
Posts: 534
Joined: Sun Mar 10, 2002 5:58 pm
Location: Sweden
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Marcus Wendel » Sun Dec 05, 2010 4:22 pm

I recommend adding the same .htaccess and index.html files to the new cache directory as in the standard phpbb cache directory.

/Marcus

User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by dpaanlka » Tue Feb 22, 2011 1:17 am

that1dude wrote:anyway to get this mod to list a state flag and the city of a poster? I notice maxmind offers a geocitylite.dat
Yes, it would require very minimal tweaking. MaxMind's free city finder module is much less reliable than the country module, and may be just a tad little creepy :D
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today

Athomis
Registered User
Posts: 18
Joined: Mon Feb 14, 2011 7:31 pm

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Athomis » Sat Feb 26, 2011 3:28 pm

Solved...

Athomis
Registered User
Posts: 18
Joined: Mon Feb 14, 2011 7:31 pm

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Athomis » Sun Mar 06, 2011 2:46 pm

orbit_ wrote:Great work with the mod... love it, easy to install and good instructions!
Quick question though; you mentioned the query fetches the users IP opposed to the post ID. I'm not sure whether your original script did use the post ID and you changed it later on? Is there a way you could provide the SQL for this? I want to alter the file so even guest posters will show a country flag, and this can only be done by getting the IP from the post. Right?

Thank you :)
Here's how to do it, it's quite simple actually:

in viewtopic.php

Find: ''post_edit_user' => $row['post_edit_user'],

Add after: 'poster_ip' => $row['poster_ip'],


And for the tulip MOD part, change:

'POSTER_COUNTRY' => iptocountry($poster_id),
'POSTER_COUNTRY_FULL' => iptocountryname($poster_id),

To:

'POSTER_COUNTRY' => iptocountry($row['poster_ip']),
'POSTER_COUNTRY_FULL' => iptocountryname($row['poster_ip']),

And in functions_tulip, comment out/delete the DB queries and assign $the_id to $ip (or use $the_id in the code):

/*$sql = 'SELECT user_ip
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $the_id;
$result = $db->sql_query($sql);*/

$ip = $the_id;
//$ip = $db->sql_fetchfield('user_ip');

Seems to work...
Last edited by Athomis on Wed Apr 13, 2011 7:21 pm, edited 2 times in total.

User avatar
Marcus Wendel
Registered User
Posts: 534
Joined: Sun Mar 10, 2002 5:58 pm
Location: Sweden
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Marcus Wendel » Sun Mar 06, 2011 3:53 pm

dpaanlka wrote:I can rewrite it to never cache a non-result (i.e. "UN" or "International") lest it returns a true result with a future update to GeoIP.dat. Let me know if either of these are things you guys want to see happen.
Any news on this update? At the moment I manually have to delete the cached "international" files to get a recheck of the nationality but that is unnecessary work in my opinion.

/Marcus

Gazeta
Registered User
Posts: 5
Joined: Tue Feb 08, 2011 2:27 am
Location: UK

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Gazeta » Sun Apr 10, 2011 8:58 pm

Yes, when changing this stuff as advised above - also see just UN flags. Is there any chance to sort it out please? Desperately need a mode to display posters IP (ath the time of posting, not registration). Thanks in advance for your attention to this message!

Athomis
Registered User
Posts: 18
Joined: Mon Feb 14, 2011 7:31 pm

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Athomis » Wed Apr 13, 2011 7:20 pm

Gazeta wrote:Yes, when changing this stuff as advised above - also see just UN flags. Is there any chance to sort it out please? Desperately need a mode to display posters IP (ath the time of posting, not registration). Thanks in advance for your attention to this message!
Forgot to add this part in my post (updated in my comment now):

in viewtopic.php

Find: ''post_edit_user' => $row['post_edit_user'],

Add after: 'poster_ip' => $row['poster_ip'],

Gazeta
Registered User
Posts: 5
Joined: Tue Feb 08, 2011 2:27 am
Location: UK

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Gazeta » Wed Apr 13, 2011 7:45 pm

Fantastic, thanks! Great mod!.. Works perfect!..

P.S. This must be quoted two times:

/*$sql = 'SELECT user_ip
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $the_id;
$result = $db->sql_query($sql);*/

$ip = $the_id;
//$ip = $db->sql_fetchfield('user_ip');

User avatar
PandoraBox_2007
Registered User
Posts: 2
Joined: Mon Apr 28, 2008 7:32 am
Location: Ukraine
Name: Denis [skype:Robert.Sperring1]
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by PandoraBox_2007 » Thu Aug 11, 2011 3:08 am

Very many SQL query topic generation

maybe used ip

Code: Select all

$row['user_ip']
:D

Code: Select all

<?php

/**
* This mod includes GeoLite data created by MaxMind,
* available from http://www.maxmind.com/.
*/

function iptocountry($ip)
{
   global $db;

   if (!$ip) return;

   include_once("{$phpbb_root_path}includes/geoip.php");
   $gi = geoip_open("{$phpbb_root_path}includes/GeoIP.dat",GEOIP_STANDARD);
   $two_letter_country_code = geoip_country_code_by_addr($gi, $ip);
   geoip_close($gi);
   if ($two_letter_country_code == '') {
      $two_letter_country_code = 'UN';
   }
   return $two_letter_country_code;
}

function iptocountryname($ip)
{
   global $db;

   if (!$ip) return;

   include_once("{$phpbb_root_path}includes/geoip.php");
   $gi = geoip_open("{$phpbb_root_path}includes/GeoIP.dat",GEOIP_STANDARD);
   $country_name = geoip_country_name_by_addr($gi, $ip);
   geoip_close($gi);
   if ($country_name == '') {
      $country_name = 'International';
   }
   return $country_name;
}

?>

Code: Select all

########## BEGIN TULIP ##########
'POSTER_COUNTRY'   => iptocountry($row['user_ip']),
'POSTER_COUNTRY_FULL'   => iptocountryname($row['user_ip']),
########## END TULIP ##########

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25230
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [DEV] TULIP: Tiny User Locator by IP

Post by Paul » Sun Feb 12, 2012 7:11 pm

This topic has been marked as [ABD] - Abandoned as the mod author has not been active recently. If the MOD author wishes to continue development, please PM anyone on the MOD Team to request this topic be unlocked.

Thank you,
The phpBB Modifications Team
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Locked

Return to “[3.0.x] Abandoned MODs”