News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Location Mod

Started by Gobalopper, November 19, 2004, 01:43:12 AM

Previous topic - Next topic

haktanir2

#820
The flags are already in the main mod. This one is a whois add-on which shows flags in the whois area according to IP.

There's a 1.6 MB csv file there which is what gets stuck.

haktanir2

Quote// populate the ip2country table
$fp = fopen($boarddir . '/Packages/temp/ip-to-country.csv', 'r');
while (list($ip_from, $ip_to, $c2code) = fgetcsv($fp, 1000, ','))
{
   $c2code = strtolower($c2code);
   db_query("
      INSERT INTO {$db_prefix}location_ip2country
      VALUES ('$ip_from', '$ip_to', '$c2code')", __FILE__, __LINE__);
}
fclose($fp);

and that csv file is being called in the code.

Gobalopper

Yes it stores the IP addresses in the database and then checks against that to find out what country they are from. You need to have that there in order for it to work.

chinny

sorry to bother you all,
but i have the following problem :

i have installed the Location-Mod in 1.0.5 (English) and it works perfekt !,
when i change the language to German, it does'nt work at all.

i did a new install of 1.0.5 and first changed the language to German,
then i tried to install the Location-Mod which did'nt work.

does anybody know which files have to be edited, so that i can install it with a German 1.0.5



thanks in advance

Gobalopper

You would have to translate it to German first.

chinny

got it working without having to translate it, now that it's working i can set about translating the English text.

all i did was the following :
copied the contents of Modifications.english.php into Modifications.german.php
and copied mm.gif into ./themes/default/images/german

Gobalopper

Ok let me know when you do and I will include it with the next release.

beemer

Quote from: beemer on January 28, 2006, 10:37:18 AM
Anyone had problems with RC2

Upgraded my test site from RC1 reinstalled mods and clicking on member map gives me the following

"Unknown column 'p.country' in 'on clause'
File: C:\Program Files\xampp\htdocs\xampp\bmw7resource.co.uk\forum\Sources\MemberMap.php
Line: 101"

Line 101

ORDER BY c.name, mem.realName", __FILE__, __LINE__);


Just me getting this error trhen?
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

Gobalopper

Can you post that entire query?

beemer

#829
Gobalopper I will do so when I get home later!

What do you want?

// get all the pins
$request = db_query("
SELECT p.ID_MAP, p.ID_MEMBER, p.xPin, p.yPin, p.country, p.city, mem.gender, mem.realName, c.name
FROM {$db_prefix}mm_pins AS p, {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}location_country AS c ON c.c2code = p.country
WHERE (p.xPin BETWEEN {$context['maps'][$ID_MAP]['xStart']} AND {$context['maps'][$ID_MAP]['xEnd']})
AND (p.yPin BETWEEN {$context['maps'][$ID_MAP]['yStart']} AND {$context['maps'][$ID_MAP]['yEnd']})
AND p.ID_MEMBER = mem.ID_MEMBER
ORDER BY c.name, mem.realName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$context['pins'][$row['ID_MEMBER']] = array
(
'ID_MAP' => $row['ID_MAP'],
'xPin' => round(($row['xPin'] - $context['maps'][$ID_MAP]['xStart']) * $context['maps'][$ID_MAP]['scale']) - 4,
'yPin' => round(($row['yPin'] - $context['maps'][$ID_MAP]['yStart']) * $context['maps'][$ID_MAP]['scale']) - 4,
'ccode' => $row['country'],
'country' => $row['name'],
'city' => $row['city'],
'gender' => $row['gender'],
'name' => $row['realName'],
'text' => (!empty($row['city']) ? $row['city'] . ', ' : '') . implode(', ', array($row['name'], $row['realName'])),
);
}

obExit();
}
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

Gobalopper

Do you have a mm_pins table? Maybe try re-installing the mod if you don't.

beemer

Quote from: Gobalopper on February 02, 2006, 01:44:00 PM
Do you have a mm_pins table? Maybe try re-installing the mod if you don't.

Yep populated with 70 records

Thinking it may be related to the php 5.0.5 & mysql 5.0.15 on my test pc will try it on older versions at the weekend

I like dirt  ;D
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

haktanir2

Quote from: Gobalopper on January 31, 2006, 04:01:02 PM
Yes it stores the IP addresses in the database and then checks against that to find out what country they are from. You need to have that there in order for it to work.
Gobalooper do you think you could come up with a solution for that add-on? Isn't there some way the csv file could be shrunk or a liter version could be created?

Gobalopper

The CSV file is already shrunk down from its original size. Basically if you want to be accurate it has to be that big.

You could try loading the csv file into MySQL using a query browser instead but that would depend on what sort of access you have to your database.


beemer

Quote from: haktanir2 on February 04, 2006, 11:33:03 AM
How can I edit or remove a pin put by someone?

You will have to use phpmyadmin
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

haktanir2

#836
Quote from: beemer on February 04, 2006, 01:01:59 PM
Quote from: haktanir2 on February 04, 2006, 11:33:03 AM
How can I edit or remove a pin put by someone?

You will have to use phpmyadmin
Ok and what would I look for? I mean what's the table name?
Figured it out.

BillyBobRob

Hi Gobalopper

Sorry to hassle you but can you advise if this mod works on 1.0.6 ?

I have had mega hassles upgrading to 1.0.6, and with other mods working I don't want to install it again if it will cause problems.

Rob
World Peace by 2020

haktanir2

Gobalopper, how could additional maps you have not provided me added, such as a large map of Turkey?

Gobalopper

I've updated the package-info.xml file so the install works under 1.0.6, no code changes were needed.

I will see what I can do for a Turkey map.

Advertisement: