Advertisement:

Author Topic: How to show a warning text into header only for Visitors from Turkey  (Read 1605 times)

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
How to show a warning text into header only for Visitors from Turkey?

As you know Turkey is banned booking.com for all hotel bookings for peoples who living / being in Turkey.
therefore BOOKING.COM has added a warning into header as you see at the attachment.

This warning text only shown for visitors from Turkey. If you visit page from other countries, it does not shown...
How to do this?

_carlison

  • Full Member
  • ***
  • Posts: 134
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #1 on: July 23, 2017, 05:28:06 pm »
Hi,

If you want banned any particular country then you will banned country from your cpanel then that country will be banned and those country will not open your site  .

or you can buy GEO Location Plugin may be that plugin developer will use that block option and message option.

or

Code: [Select]
<?
$ip=$_SERVER['REMOTE_ADDR'];
require_once('geoplugin.class.php');

// check country

$geoplugin = new geoPlugin();
$geoplugin->locate($ip);

$hitfrom=$geoplugin->countryCode;

if ($hitfrom=="US"){
//shows content to US...
} else if ($hitfrom=="CA"){
// shows content to Canada...
}
?>

use this code for showing message..

Thanks

tito

  • issues
  • Sr. Member
  • *
  • Posts: 397
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #2 on: July 23, 2017, 08:24:28 pm »
Where do you buy geo plugin? I dont know that plugin?

@mrsoftware   You can download here for free and modify at your needs:  http://www.geoplugin.com/examples

_carlison

  • Full Member
  • ***
  • Posts: 134
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #3 on: July 24, 2017, 10:31:53 am »
Hi,

I am not confirm that plugin name. or you can search on google

i have download from :
Code: [Select]
https://forums.osclass.org/plugins/new-plugin(geo-location-installer)/msg32265/#msg32265
and i have do manually changes from plugin files and mentioned messge for particular country . So i have suggest you. you can ask developer or if you can do edit some files so you will do changes and mention that message for turkey country.

Sorry for my english.
Thanks

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #4 on: July 25, 2017, 09:10:18 am »
I do not want to ban whole site for visitors from Turkey, BOOKING.COM did also not ban whole site in Turkey.. they just put a "warning text " into header , and query does not show any hotel/room results from Turkey...

But this is happening only for visitors from Turkey.

If you visit BOOKING.COM from other countries, visitors can not see " warning text " on header and visitors can see all hotels from Turkey and can book it.

I want visitors from Turkey may also visit web page , but they must read a " warning text " into all pages....But this warning text should shown only for visitors from Turkey, not for visitors from other countries...

Who can help for such things?
May be a plugin? I am ready to pay...



_carlison

  • Full Member
  • ***
  • Posts: 134
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #5 on: July 25, 2017, 11:27:55 am »
Hi,

Sorry , you can search on google for this message, or Other osclass developer may be help you.
« Last Edit: July 25, 2017, 12:40:13 pm by _Carlison »

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #6 on: July 25, 2017, 12:52:58 pm »
try this in the funtions.php of your theme...


Code: [Select]

function getGeoDataByIP() {
    $location = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
    if ($location['geoplugin_countryCode'] == 'TR') {
        echo 'YOUR OUTPUT';
    }   
}


osc_add_hook('before_html', 'getGeoDataByIp');




SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #7 on: July 25, 2017, 09:26:54 pm »
Please keep in mind any visitors using a proxy.... you COULD be warning visitors from around the world if proxy is used hosted in Turkey. Due to the existence of proxies it is impossible to be 100% sure your visitors originate from the IP address used visiting your website.

Just out of curiousity, why warn people from Turkey?

try this in the funtions.php of your theme...


Code: [Select]

function getGeoDataByIP() {
    $location = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
    if ($location['geoplugin_countryCode'] == 'TR') {
        echo 'YOUR OUTPUT';
    }   
}


osc_add_hook('before_html', 'getGeoDataByIp');

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #8 on: July 30, 2017, 01:50:26 pm »
Why to warn peoples from Turkey? Actually same reason as " BOOKING.COM "... Can you imagine? BOOKING.COM is world's numberone room booking system, but It is banned in Turkey. What do you think? or whole world are stupid because they have not banned booking.com or Turkey is very clever? Which one?

Anyway,

To avoid from legal problems in Turkey like booking.com, I would like to warn visitors from Turkey.
Turkey is becoming very strange country about internet and blocking / banning web pages because of a nonsense / funny reasons.

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #9 on: July 30, 2017, 01:57:13 pm »
Thank you for code, I am unable to test code now because I am not in Turkey.
When I come back to Turkey, I will add this code and I will test it, of course I will let to know result...
Thanks


try this in the funtions.php of your theme...


Code: [Select]

function getGeoDataByIP() {
    $location = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
    if ($location['geoplugin_countryCode'] == 'TR') {
        echo 'YOUR OUTPUT';
    }   
}


osc_add_hook('before_html', 'getGeoDataByIp');

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #10 on: July 30, 2017, 09:33:41 pm »
I understand.... I disagree though, Turkey is great but mr. E. is a bit "strange" I think, to say the least 8)

Why to warn peoples from Turkey? Actually same reason as " BOOKING.COM "... Can you imagine? BOOKING.COM is world's numberone room booking system, but It is banned in Turkey. What do you think? or whole world are stupid because they have not banned booking.com or Turkey is very clever? Which one?

Anyway,

To avoid from legal problems in Turkey like booking.com, I would like to warn visitors from Turkey.
Turkey is becoming very strange country about internet and blocking / banning web pages because of a nonsense / funny reasons.

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #11 on: July 30, 2017, 10:05:58 pm »
I tell you worse situation;
World's numberone encyclopedia WIKIPEDIA is also banned in Turkey at this moment...
Now, WIKIPEDIA is banned only in Turkey all around the world...
There is no a second country ...




SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #12 on: July 30, 2017, 10:08:37 pm »
Sounds a bit like China....
Good news, despite their efforts to ban websites many people now a way around this by simply using a proxy or something similar. 8)

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #13 on: July 30, 2017, 11:06:27 pm »
Turkish population's  tech education level is % 30 and everybody has no knowledge about proxy and how to use it...
Proxy is not always comfortable to visit a web page as normal surfing...It becomes very slow surfing...
A proxy is not always % 100 solution for every country.

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show a warning text into header only for Visitors from Turkey
« Reply #14 on: July 31, 2017, 02:24:39 am »
True, best is a free/normal country and free internet.

Turkish population's  tech education level is % 30 and everybody has no knowledge about proxy and how to use it...
Proxy is not always comfortable to visit a web page as normal surfing...It becomes very slow surfing...
A proxy is not always % 100 solution for every country.