Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

[solved] metamod not recognizing country after domain transfer

[solved] metamod not recognizing country after domain transfer

Hi
I recently transferred my domain to a new registrar. Metamod was working fine until then.
Now it is no longer recognizing the country.

It's a simple PHP which shows two different modules according to the originating country.
if($fromCountryId=='IT') {return 367;}
else  if($fromCountryId!='IT') {return 344;}

Any idea why?
Is there a way to print out the valur of the $fromCountryID var?

nick2011
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

Hi, yes it's nice and easy to view the fromCountryId. Just enter this in your MetaMod:

echo "I think your country is: $fromCountryId<br>";
echo "here are the server variables: <pre>" . print_r($_SERVER) . "</pre>";

Take a look at the server variables that are there. One of them will contain your actual IP address and it's possible that some of the others contain the IP address of your new server / proxy system at your host. Could you post the results of this back on here again, noting which one actually contains your real client IP address, and I'll check to see if MetaMod is interpreting these correctly. Just today I came across a new hosting system that was messing up IP detection in Chameleon (which uses the same code as MetaMod) so it's possible yours is a similar situation.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

Hi
I've add already tried to output the variable with the echo instruction.
It returns nothing.

However, using another PHP file called GeoIP.php with GeoIP.day, correctly returns "IT" as my country.

nick2011
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

oops I got that a bit wrong:

echo "I think your country is: $fromCountryId<br>";
echo "here are the server variables: <pre>";
print_r($_SERVER);
echo "</pre>";

Also if you have found another GeoIP system that gives the correct result, it's possible that your GeoIP.dat file is out of date - I would suggest re-downloading and installing it and trying again.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

sorry, but it outputs nothing.
sad
geoip.dat is always updates btw.

nick2011
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

Ok this is getting a bit confusing!

1 - have you installed a recent copy of GeoIP.dat into a folder called geoip in the root of your web folder?
Note that you have to uncompress the file you download from http://geolite.maxmind.com/download/geo … oIP.dat.gz don't just rename it.

2 - copy and paste the code from the forum directly from the web (not from any e-mail notification you received about the post).

echo "I think your country is: $fromCountryId<br>";
echo "here are the server variables: <pre>";
print_r($_SERVER);
echo "</pre>";

3 - ensure that in the MetaMod you have "Enable GeoIP/GeoCity" set to "GeoIP Country (free or commercial)"

4 - ensure the MetaMod is published, set to "all pages" (or a selection of pages that will actually display) and set to a valid module position. Otherwise you definitely won't see anything appear!

5 - turn on "advanced debug" mode in the MetaMod just to hep to force it to display something, then test again from front-end

6 - if you're still not seeing anything appear, remove all the PHP from the code box and test again. If you still don't see any output then you haven't assigned the module correctly.

Let me know how you get on with that. We're just getting the obvious stuff out of the way first.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

hi
1) geoip.dat is in the root, where it has always been and it is correctly recognized by Metamod in the geoip tab.

3 and 4) geoip is enabled and metamod is correctly published (as it was on the other registrar/hosting

2) this is the result I get copying the code and pasting it into the pho section of metamod
(I changed the URL to mysite.com and hidden my IP)
***

Array
(
    [CONTEXT_DOCUMENT_ROOT] => /home/italians/public_html
    [CONTEXT_PREFIX] =>
    [DOCUMENT_ROOT] => /home/italians/public_html
    [GATEWAY_INTERFACE] => CGI/1.1
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
    [HTTP_AUTHORIZATION] =>
    [HTTP_CACHE_CONTROL] => max-age=0
    [HTTP_COOKIE] => jcemediabox_aHR0cDovL3d3dy5pdGFsaWFu_0=1; 7c3c811ca1420059937d5e1b30a3b4d7=d87adcb6b2a6c36e73c62618fe33d0ad; 53b27565f369e471e45e5221093b3242=06f673cac371d13ce711522dc424c99f; 65fbc4122ff71027210030b9d1185ab8=it-IT; http://www.mysite.com/it/=1,1
    [HTTP_HOST] => www.mysite.com
    [HTTP_REFERER] => http://www.mysite.com/disclaimer_it.php
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36
    [HTTP_X_FORWARDED_FOR] => 5.77.56.25
    [HTTP_X_FORWARDED_HOST] => www.mysite.com
    [HTTP_X_FORWARDED_SERVER] => www.mysite.com
    [HTTP_X_REAL_IP] => xx.xx.xx.xx
    [HTTP_X_VARNISH] => 1710750196
    [PATH] => /bin:/usr/bin
    [PHPRC] => /home/italians/.php/
    [QUERY_STRING] =>
    [REDIRECT_HTTP_AUTHORIZATION] =>
    [REDIRECT_STATUS] => 200
    [REDIRECT_UNIQUE_ID] => Viic7wVNOBkADEfoBpIAAAAA
    [REDIRECT_URL] => /it/
    [REMOTE_ADDR] =>  xx.xx.xx.xx
    [REMOTE_PORT] => 40053
    [REQUEST_METHOD] => GET
    [REQUEST_SCHEME] => http
    [REQUEST_URI] => /it/
    [SCRIPT_FILENAME] => /home/italians/public_html/index.php
    [SCRIPT_NAME] => /index.php
    [SERVER_ADDR] => 5.77.56.25
    [SERVER_ADMIN] => This e-mail address is being protected from spambots. You need JavaScript enabled to view it
    [SERVER_NAME] => www.mysite.com
    [SERVER_PORT] => 80
    [SERVER_PROTOCOL] => HTTP/1.0
    [SERVER_SIGNATURE] =>
Apache/2.4.12 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 Server at www.mysite.com Port 80


    [SERVER_SOFTWARE] => Apache/2.4.12 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
    [UNIQUE_ID] => Viic7wVNOBkADEfoBpIAAAAA
    [PHP_SELF] => /index.php
    [REQUEST_TIME_FLOAT] => 1445502191.95
    [REQUEST_TIME] => 1445502191
    [argv] => Array
        (
        )

    [argc] => 0
)

nick2011
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

Hi,

thanks for that info - perfect.

What is happening is that your web server is doing something non-standard with the way it proxies the web request from the client.  The HTTP_X_FORWARDED_FOR header is supposed to identify the client's IP address but your proxy is instead using it to put the Proxy's IP address. Therefore MetaMod is picking up the wrong IP address - the address of the proxy instead of the IP address of the client. The client's IP address is instead appearing in a new non-standard header HTTP_X_REAL_IP. This is the second such case I have seen recently, though using a different header entirely. I don't know why people create new headers when the standard ones would work perfectly well!

I will need to issue an update to MetaMod that detects these 2 new headers. Would Monday be ok for you for the new version?

Thanks,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

thank you
I'll wait for the new release  then smile

nick2011
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [solved] metamod not recognizing country after domain transfer

Hi Nick - all released and ready to go :-) Please try out MetaMod 3.24 and let me know how you get on.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1674
Total Polls:
6
Total Posts:
5917
Total Posts Today:
5
User Info:
 
Total Users:
11540
Newest User:
caron5112
Members Online:
1
Guests Online:
151

Online: 
caron5112

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked