1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest Last month we upgraded BlackHatWorld.com to a new platform - . If you notice anything that requires attention please start a new thread here.
    Dismiss Notice

HTML and Java Q, Different content for different countries??

Discussion in 'BlackHat Lounge' started by elecsho, Jan 24, 2013.

  1. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    Just a quick question. I am trying to use html codes under the <head> tag that would be different according to each country. I will be using this java script plugin take a look:
    Code:
    http://www.geoplugin.com/examples
    .

    If you know how please show an example here. So what I am trying to do for example is: If a visitor is from the US show html code #1. Otherwise show html code #2.

    Help is very appreciated!
     
  2. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    come on someone please help
     
  3. FJX

    FJX Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 13, 2011
    Messages:
    344
    Likes Received:
    184
    Location:
    0x90
  4. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    You can just use the sample code provided in the url you gave. I have replaced some stuff so it looks like this. I've not tested it but I think this should work.


    PHP:
    <?php 

    $geoPlugin_array 
    unserializefile_get_contents('http://www.geoplugin.net/php.gp?ip=' $_SERVER['REMOTE_ADDR']) ); 

    if ( 
    $geoPlugin_array['geoplugin_countryName'] == 'US' 
    {  
    // do your stuff for US}

    else{    // do stuff for other country's} 

    ?>
     
    • Thanks Thanks x 1
    Last edited: Jan 24, 2013
  5. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    Thank you for this. But I suck at coding how can I use html code in the "Do your stuff for US here"
     
  6. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    There are many ways to go. But you have to explain wat you want to do. Give a example of the US part you want to show and the Other Country part. And what is your source ? Are you getting the text from a database or is it all just plain html ?
     
  7. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    Okay this is exactly what I am trying to do. I am using content locker pro. I want to show different lockers according to the country. So if visitor is from the us, Use html code #1 which is for locker #1. Otherwise use html code #2 which for content locker #2.
     
  8. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    If I'm not mistaken, content locker pro has that build in. I think you can set it in the admin panel.
    I'm not sure because I don't have content locker pro. Maybe someone who owns content locker pro can tell you or maybe they have a support forum.

    Otherwise maybe this would help (not the most elegant solution but it should work):


    PHP:
    <?php 
    $geoPlugin_array 
    unserializefile_get_contents('http://www.geoplugin.net/php.gp?ip=' $_SERVER['REMOTE_ADDR']) ); 
    if ( 
    $geoPlugin_array['geoplugin_countryName'] == 'US' ) {?>
    //paste the code (html) from your content locker for US below this text and before <?}else{?>

    <?}else{?>
    //paste the code (html) from your content locker for Other Country's below this text and before <?}?>

    <?}?>
    Let me know if that's working
     
    • Thanks Thanks x 1
  9. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    I dont know if it is working. How can I use this code on a free blog. Lets say I host this script on my own domain and want to use it on blogger.
     
  10. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    oh and I did not find this option in clp. Geo-targeting is only for the offers not for the whole lockers
     
  11. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    Well I think, for safety reasons, you cannot use php code in blogger. I think what you want is not possible with php. Maybe with javascript. But than you have to write a custom script for this. I'm not very good at javascript, so I cannot really help you with that.

    php code is a server based language which means that the code is processed on the server. After that it can output it's results to the user (browser)

    However, you can use this code on any free hosting site that allows you to add your own files.
    For example www.[B]000[/B]webhost.com

    p.s. I have never used this hosting service
     
  12. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    Yes, you right.
    That makes sense :)
     
  13. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    I know blogger was just an example. I mentioned that I will host the script on my own server or I will use weebly to upload the php file. But what is the html code to load this script when using something like weebly or 000webhost
     
  14. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    I think it's kinda hard to do this. This is because of safety issues. You have to upload the files from content locker pro to each website you want to use it on. I'm sorry but that's the only thing I can think of. Maybe someone else has a other idea about this ?
     
  15. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    No no you dont understand. All I am asking is how to use the script you gave me on a free hosting like weebly.
     
  16. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    Well if you can use php on weebly than you could just paste the code between the body tags <body> </body> on a certain page.

    By the way, do you know anything about html ?
    Because if you don't this may be all to overwhelming and you better follow a basic html course online or if you don't have the time, pay someone to do this for you.
     
    • Thanks Thanks x 1
  17. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    How can I use the code by uploading it. Because I can't put php code directly in weebly.
     
  18. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    Than you need to have access to the server via ftp. But I don't think you can do that on weebly.
    Try 000webhost
    After signing up you have access to ftp. In the control panel you can see your ftp credentials
     
  19. elecsho

    elecsho Power Member

    Joined:
    Apr 21, 2012
    Messages:
    544
    Likes Received:
    132
    okay but what will be the html code.
     
  20. Crapper

    Crapper Junior Member

    Joined:
    Sep 28, 2011
    Messages:
    126
    Likes Received:
    14
    Home Page:
    Well I cannot tell you that because I don't have content locker pro. So I don't know what content locker outputs, if you know what I mean