NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Location of Visitor

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 04-10-2005, 09:31 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
food_consult's Avatar
Join Date: Feb 2003
Posts: 950
food_consult is on a distinguished road
 



Location of Visitor


How canI determine if my visitor is From UK or US ?

Since I need the page to contain a specific content for UK and a different Content for US?
food_consult is offline  
Old 04-10-2005, 10:00 AM   #2 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 703
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
Originally Posted by food_consult
How canI determine if my visitor is From UK or US ?
????: NamePros.com http://www.namepros.com/programming/81648-location-of-visitor.html

Since I need the page to contain a specific content for UK and a different Content for US?
IMO The best way would be to ask the user when they first visit the page and set a cookie. Whenever they visit your site, you check if the cookie exists and what value it has.


Example:
switch($_COOKIE['location'])
{
case "uk":
header("Location: http://blah.com/uk");
break;
case "us":
header("Location: http://blah.com/us");
break;
default:
// ask the user what location he is...and set a cookie according to that
break;
}
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 04-10-2005, 10:09 AM   #3 (permalink)
NamePros Member
Join Date: Apr 2005
Location: Canada
Posts: 108
datalinks is on a distinguished road
 



I sell a tool that shows you the country a visitor is coming from and if you like displays a flag of that country on my site.

It is called AddressTrackerIP It has been built to help determine Credit Card fraud, but once you know where they are from, you can decide what to do with that information. It is written in ASP and PHP.

www.dlss.ca/products.html
datalinks is offline  
Old 04-10-2005, 11:01 AM   #4 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,267
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Hello,
????: NamePros.com http://www.namepros.com/showthread.php?t=81648

I have copyed a tutorial from a site this script redirects based on country they are from.. You can edit it to do what ever you like.

First go to http://trialware.techrepublic.com/ab...px?docid=89130 and get a copy of it.

PHP Code:
<html>
<head></head>
<body>

<?php

// include functions
include("geoip.inc");

// read GeoIP database
$handle geoip_open("GeoIP.dat"GEOIP_STANDARD);

// get country code mapping for client IP address
$cc geoip_country_code_by_addr($handlegetenv('REMOTE_ADDR'));

// close database handler
geoip_close($handle);

// use country code to select ad banner from MySQL database
// set server access variables
$host "localhost";
$user "joe";
$pass "hf3jfg";
$db "ads";

// open connection to database
$connection mysql_connect($host$user$pass) or die ("Unable to connect!");

// select database to use
mysql_select_db($db) or die ("Unable to select database!");

// create SQL query string
$query "SELECT id, path FROM ads WHERE cc = '$cc' ORDER BY RAND() LIMIT 0, 1";

// execute query and obtain result set
$result mysql_query($query) or die ("Error in query: $query. " mysql_error());

// are there any rows in the result?
if (mysql_num_rows($result) > 0)
{
    
// yes
    
$row mysql_fetch_object($result);
       
$id $row->id;
    
$path $row->path;
}
else
{
    
// no, use defaults
    
$id 0;
    
$path "placeholder.gif";
}

// close connection
mysql_close($connection);

// insert image path into <img> tag
?>

<a href="tracker.php?id=<?=$id?>"><img src="<?=$path?>" align="center" alt="banner ad"></a>
????: NamePros.com http://www.namepros.com/showthread.php?t=81648

</body>
</html>
__________________
I feel old.
iNod is offline  
Old 04-10-2005, 07:04 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
food_consult's Avatar
Join Date: Feb 2003
Posts: 950
food_consult is on a distinguished road
 



THANKS !!!!

food_consult is offline  
Old 04-11-2005, 03:08 AM   #6 (permalink)
Account Suspended
 
Mystic's Avatar
Join Date: Feb 2005
Location: England
Posts: 1,169
Mystic is just really niceMystic is just really niceMystic is just really niceMystic is just really nice
 



awww, love, hehe, thanks, i was looking for a tutorial like that
Mystic is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Script for Total Download Limit per/day. Also, to hide file location. Jed K Website Development 4 04-07-2005 08:35 PM
apache server and SQL location RickyG Web Hosting Discussion 2 03-26-2005 12:30 PM
Free link exchange with 400+ visitor a day Harley Davidson website! selfmindead PPC / CPC / CPM Programs 0 03-08-2005 03:27 PM
How to make a page accessible only after visitor forwarded my site to 10 friends? iecwillow Marketing Techniques 1 10-19-2004 02:39 PM
Geographical Location & Real Estate Domains On Sale Duke Domains For Sale - Make Offer 0 09-22-2003 02:57 PM

 
All times are GMT -7. The time now is 02:52 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger