PHP client location based page loading


 
Thread Tools Search this Thread
Top Forums Web Development PHP client location based page loading
# 1  
Old 03-11-2012
PHP client location based page loading

Hi,

I am new to PHP and at first got a task where I need some clues and help.
So I am here.. The server is build to provide customized access for modules
as per location. If client location is US then it shows modules and pages
specific to US and if location is UK then it shows UK specific things.

My task is to switch a default unique location for administration access in server.

For example
If client is browsing from UK or Austria or France or from anywhere the server should provide
pages specific to US.

The location is determined by IP address. I found something $__SERVER{'REMOTE_ADDRESS'}
can I set this to the IP address specific to USA? Please give me some ideas & links.

Thanks...
# 2  
Old 03-11-2012
You can use geoip....

Check out the geoip apis for PHP here:
Quote:
There are three methods of querying the GeoIP databases from PHP. The easiest to setup is the Pure PHP API. The setup for the high performance PHP extension and mod_geoip APIs is more advanced.

Pure PHP module

Download pure PHP module. Free GeoLite Country and GeoLite City databases are available.

A port to PHP5 of the PHP API is available from PEA
R.

The Pure PHP API is cross-platform, works on Windows as well as Linux, and does not require Apache, nor does it require the C API.

PHP Extension on PECL

Download a PHP extension that allows you to embed the GeoIP C Library inside PHP for improved performance. There is a new fork with a more complete implementation.

Using mod_geoip with PHP

For improved performance, you can access the mod_geoip from PHP. There is a trade-off between performance and ease of installation - the Apache module is faster (benchmark), but the pure PHP module is much easier to install.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Loading Animation for Large Man Page Repositories

Should have done this 10 years ago, so better late than never: Just added a "loading" animation to the the man page repositories when they load, especially since some are very large and take many seconds to load. See for example: https://www.unix.com/man-page-opensolaris-repository.php ... (1 Reply)
Discussion started by: Neo
1 Replies

2. Red Hat

/usr/bin/rhgb-client -- error while loading shared libraries: libpopt.so.0

Hi All, I have RHEL 5 installed in my system. Something must has happened because when i reboot the server, it came with many error.. /usr/bin/rhgb-client -- error while loading shared libraries: libpopt.so.0. Can't open shared object files. No such file/directory It finnaly ends with the... (6 Replies)
Discussion started by: IgnitedMind
6 Replies

3. Shell Programming and Scripting

Parse based on location

I do have a big text file >A1 ACFGTSDCHG_GDF DGHA >A2 A_FGGSD_HG_GSF DGTA >A3 AC_GSDD_TU_GDF DGH_ .. ... there are equal number of characters within all the sub-headers. I want to parse out all the characters under each sub-header from user specified locations. For example, I want... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

4. Web Development

HTML/PHP show IMG based on location

HI guys/gals, I like to add some personal touches to a welcome image on our mediawiki site, and have the welcome be displayed in the, presumed, language of the visitor. Standard would be English, but if the IP or browser or OS is set to be in India, I want to display the message in Urdu for... (5 Replies)
Discussion started by: lawstudent
5 Replies

5. Shell Programming and Scripting

How to pass data from server (CGI script) to client (html page)

Hi I know how to pass data from client side (html file) to server using CGI script (POST method). I also know how to re-create the html page from server side after receiving the data (using printf). However I want to write static pages on client side (only the structure), and only to pass... (0 Replies)
Discussion started by: naamabm
0 Replies

6. Shell Programming and Scripting

background image not loading in newly thrown html page by shell script

I m trying to throw back html page when a file is found.While throwing back html page, the background image is not coming. I am using Apache server.Please suggest how to resolve... #!/bin/ksh echo -e "Content-type: text/html\n\n" echo "<html><head></head><body background=\"/asc/ppp.jpg\">"... (10 Replies)
Discussion started by: ravi18s
10 Replies

7. Shell Programming and Scripting

how to detect ip address based location using PHP

I am interested in finding out if there is a reliable and economical way for extracting user's location based on his ip address, using php I tried to get the job done using ip2location.com, but I am not happy how it deals with result inconsistently. (2 Replies)
Discussion started by: siftin-com
2 Replies
Login or Register to Ask a Question