IP Address Redirect Based On Country
I'm looking for a solution to redirect a user based on his/her IP. I have servers in Asia and servers in the US. A few of my pages are on a US based server which is the primary or root domain name if you will. However when these pages are accessed from China for example, I would like to serve them pages from my China server (my subdomain). by having the page detect their IP and knowing whether it is based out of China or the US. Is this possible?
View Complete Forum Thread with Replies
Related Forum Messages:
Redirect By Country
I want to create a simple header redirect in php that will redirect the end user to a certain URL when they click on it based on their country of origin. What is the best way to go about this? I tried looking through the code examples but couldn't find anything.
View Replies !
Possible To Calculate Localtime Based On Country/State?
Does anyone know of a script or package that will allow me to calculate the localtime given a country code (and optional state/province for US/Canada)? It should factor in daylight saving time when applicable. If there are special cases where country + state isn't enough that's ok, a solution that's correct 95% of the time would be better than no solution at all.
View Replies !
Mask The Redirect Address?
so besides the following <?php Header ("Location: <new page>"); ?> You can also use the redirect meta tag if you do not run PHP. <META HTTP-EQUIV=refresh CONTENT="n; URL=somewhere"> what addition would I place to mask the redirect address? I know I could do this in Frames but there must be another way with PHP or another language/script.
View Replies !
URL Based Redirect Script
I've parked 3 domains on one hosting account. I'm fairly sure that to have the domains pointed to their own separate directories, the host would charge me extra, so what I've done is set up separate index pages for each domain, and am now trying to create a page that will redirect the user based on what URL they typed in or clicked on to get to the site. The Problem is Nothing seems to work! At first I was going to just use $HTTP_REFERER, but some browsers don't use that (mine included). Then I was going to use $HTTP_HOST, but it doesn't seem to match up with the strings I'm using. I read another thread where someone mentioned installing PEACH or Apache modules to do this, but since I'm using a virtual host and am kind of trying to avoid paying extra fees, I don't know how keen they'd be on that. Is there something I'm doing wrong with the HTTP_HOST variable that I don't know about? Does anyone have any suggestions on a better way to do this? Php code:
View Replies !
Redirect Based On What They Typed In
Imagine your web hosting provider just permitted you to type *.mydomain.com and you still get to the mydomain.com website that they host for you. Imagine you want to setup websites for your family like dad.mydomain.com, mom.mydomain.com, etc. Well, this is a request and some information for you. First, here's how you could use PHP to react to what they type in the URL: <!-- save as index.php in /var/www/html on Linux Apache: --> <?php $headers = getallheaders(); if (in_array('dad.mydomain.com', $headers)) { header('Location: http://www.mydomain.com/dad/'); exit; } if (in_array('mom.mydomain.com', $headers)) { header('Location: http://www.mydomain.com/mom/'); exit; } ?> So imagine your workstation is where you're developing and testing this. What changes would you make to /etc/hosts, Apache, or something else on your Linux system so that it accepts *.mydomain.com? So, the request -- the reason I ask is I want to inform my web hosting provider of the changes they can make to their Linux system so that I can start using this PHP index.php script to redirect to various websites under mydomain.com. For now, in experiment mode, I had to add dad.mydomain.com and mom.mydomain.com to /etc/hosts for 127.0.0.1 to get this to work. But I wish I could do something dynamically.
View Replies !
Redirect Based On Domain Url
I've got multiple domain names parked on my site, and want to redirect domain1 to domain/specific page and domain2 to /other page, etc. I would prefer it to happen automatically, before the page loads. Is anything available in PHP? What browser issues will I have with a PHP redirect, if any?
View Replies !
Redirect Requests Based
I have two domains pointing to the same ISP hosted web site. How can I redirect request for www.domain2.com to a sub-folder using header field "host".
View Replies !
CSV File-based Address Book Code Snippet?
Since I'm a PHP newbie and the only address book apps I found through Google require MySQL or PostgreSQL, I figured I'd ask if someone has come code handy. I'd just like to keep a list of addresses in a CSV file (ie. columns last name, first name, e-mail, office #, etc.) so as to ease backing up, and read/update this list from a PHP script. I guess it's pretty much just a loop to read + parse, and a form to update, but if someone has the code handy, I'm interested :-)
View Replies !
Serving A Website Based On Source Internet Address ?
Based on the source internet address a different version of the website should be presented/served to the user/browser. I would like to keep the script as simple as possible and it should replace the index.php. The script could look something like this in pseudo code: if SourceAddress = â¸.3.5.1' then begin ShowBlueWebsite; // load/show BlueIndex.htm end else if SourceAddress = ït.5.15.7' then begin ShowRedWebsite; // load/show RedIndex.htm end; Is this possible with php ?
View Replies !
PHP Page That Displays Html Based On The Address Enterd
I would like to have a PHP page that displays html based on the address enterd. For example: index.php?example=a would show a page with <body>Example1234</body> whereas index.php?example=b would show a page with <body>Example5678</body>. I've done this before, but I can't remember the code I used.
View Replies !
Redirect Different Ip Address Range To Different Server
I am de WD at a local ISP. I have my site on one server. But we want to save some bandwith, so we have a copy of the site on a remote host (different IP). I need a script that checks the IP of the visitor. If it's in my address range, the visitor gets transferred to URL Else it redirects to the remote server (URL) I need some pointers in writing such a script. Can anyone give me some hints, or links where I can find something similar? One other thing, I already have a ASP version of this script, but i need a PHP script, since the remote server is running Apache.
View Replies !
Redirect Successful Login To Url Address
I want to redirect a successful login to a url address held in the mySQL database. I have no problem validating the user name and password, but am unable to find a way to redirect to the a specific address held in the database. Each user will have a specific address asigned. Code:
View Replies !
Headers - Redirect Based On The URL String.
I am trying to redirect based on the URL string. I cant seem to get this working. Here is my code. Code: <?php $pr = $_GET['r']; if ($pr=="yes") { header("Location: addproject.php"); } else { header("Location: clients.php"); } ...........................
View Replies !
PHP Based Email Address Obfuscator For Website Mailto: Tags
I found a PHP based email obfuscator for use in websites, where the source HTML (PHP, actually) file doesn't contain the actual email address in the Mailto tag, but generates it and that generated page (containing a full and conventional Mailto: tag) is what is ultimately presented to the user. The intent is to thwart Spam bots and spiders, by NOT having the email address in the original HTML Source, but ultimately presenting it to the person browsing the site. But here's my question.... Even though the program works exactly as advertised, isn't this a case of flawed logic on the part of this scripts author? PHP runs server-side, so won't the PHP be interpreted, whether it's requested by a bot, a spider, or a legit website visitor? (and thereby, presenting the bot with the full Mailto: tag and email address anyway)? Or is there something basic I'm missing here?
View Replies !
Displaying An Image Based On URL Origination-URL Redirect
I have several domains that use splash pages that point to my main site: i.e. http://www.mysite.com/index.php. How do I replace an image, named "Logo.gif" on the main page "http://www.mysite.com/index.php" with the image named "logo.gif" from the URL splashpage, " http://www.mysite.com/SanDiego/" Both images are named logo.gif because the PHP script references logo.gif through the script in too many places...It is just easier to keep the name logo.gif Problem: If a user is on the San Diego page and clicks to the main page I want the user to feel that the site is all about SanDiego. If a user is on the Los Angeles page and clicks to the main page I want the user to feel that the site is all about Los Angeles. Hence the site and database will still be the same..I just want them to feel the experience is personalized for their city and this will be determined by changing the logo.gif. I am using an image named logo.gif that will display SanDiego for the San Diego page I am using an image named logo.gif that will display Los Angeles for the Los Angeles page I have seen some PHP code that uses php echo $picture I am not sure if this will work....
View Replies !
Sendmail Redirect Based On Form Content
I want to use sendmail to send me form data, and then redirect to different URLs (in this specific case different Paypal buy now buttons) with the click of one button, based on which radio button is selected. I have the form set up and working, but I can't work out what I need to edit to change the way the form is handled based on which 1 of 3 radio buttons is selected... I still want to receive the contents of the form (Name, Address, etc.) to the specified email address, but I want it to appear to seamlessly move to the correct page once the "submit" button is clicked. Code:
View Replies !
REdirect Users Based On Their Access Level To The Appropriate Page.
I'm trying to direct users based on their access level to the appropriate page. If admin_access = 1; these users should go to welcome.php. If admin_access = 2; these users should go to index.html. When I test the accounts with the levels, the users all go to welcome.php. Can someone help me out in redirecting the users to the proper location? Code:
View Replies !
How To Redirect Based On $_SERVER["HTTP_REFERER"]?
I have a page that I don't want anyone to be able to link directly to. The page should only be accessed from gatepage.php. I tried this code, but keep getting errors - "header info already sent", or something like that... Am I missing something, or is there a better way to do this? <?php $ref = $_SERVER["HTTP_REFERER"]; //echo $ref; if ( $ref == 'http://www.mydomain.com/gatepage.php' ) { //record visit } else { //send to gatepage.php header("Location:http://www.somegatepage.com"); exit; } ?>
View Replies !
IP-2-Country
I have downloaded IP-2-Country script from Hotscripts.com and followed the readme file but there is some problems when I open dump.php to install the script, it says that there is an error in line 20 in config.php file and I didn't change anything there instead of dbuser,dbpass and dbname. I need your help to get this script installed in my website.
View Replies !
How To Get The User's Country?
I have a site that I would like to update the members country automatically.. for example if the member 01 was in the USA then the the user 01 browse the site in CANADA i want it to be automatically update to CANADA.. that's why I wanted to knwow how to get the user's country?
View Replies !
IP Filtering By Country
Does anyone know of some good ways to filter traffic by country? I can only monetize US, UK, and Canada traffic, but must send them to a different thing for each country. All other countries I would like to send somewhere else.
View Replies !
PHP Country Blocking
I run an english site - www.i-fm.net (which has as lock content to licensed users) and we intend to now also do a version for U.A.E.... As it's an old system originally, i will be feeding the content through to the new site. which isn't a problem.... Anyway to get to the point. Is it possible to block viewers from the uk accessing certain pages/content for the new site, or another would be to block everyone from certain pages/content unless they are in UAE.
View Replies !
Converting IP To Country
Is there any function/pre-made scripts in php which can tell me the name of country based on IP? For example: If I supply an IP 132.162.138.139 then the script would echo "India" .
View Replies !
Cookie Based Script To Session Based
PMsys is a script that based on Cookies rather sessions(what are people thinking in 2003?) To intergrate this system to mine website, I got to change all the cookies to sessions. So, I think 1st replace all the: $_COOKIE into $_SESSION and then write a function that search and find a line that contains: setcookie('a', 'b', $whateverthetime); into session_start() $_SESSION['a'] = 'b' will that work? is there anymore things I have to think about? anyone can write a function to do that? I just can't get a hold on regular expressions.
View Replies !
MySQL Country Database
Is there anyone out there willing to donate their country table fora web database. I have been looking all over for a sql script to create a country table populated with recent data, but I just can't seem to find one. People must do this ALL the time.
View Replies !
Identify Visitor's Country
Is there any (preferably free) PHP script that will identify the country of a visitor, thus allowing one page to be delivered to those from A, B and C, and another to those from X, Y and Z?
View Replies !
Select Country From Second Table
I have a form with a standard text box that i would like to turn into a drop down box that is populated from a mysql table. How do I change the code of the text box so that it looks at the table and populates the list? Here is the code for the text box <input type="text" name="country" size="20" maxlength="20"> The mysql table has the following fields in it:
View Replies !
Country Visitors Counter
I want to have a counter in my site showing number of visitors dispalying both COUNTRY and # of visitors in that company ? Any body have an idea how can that be done ? or is there any ready made script to perform this function ?
View Replies !
How To Determine What Country Viewer Is From
i'm rather new to php and would like to know how to determine where the viewer is from. ie. what country. so if they have a .ca i can display canadian funds, .com/.us american funds, and .uk for pounds. is there a function that can be used for this or is there a way to set the domain to a variable and extract it from there.
View Replies !
IP Identify Country Modules.
Have u all developed an modules that to show country located by using IP address? where can i get updated IP address listing? i found out this web site, not really true on the listing. This was because i was try in my country which i access from my hostel yo my company. The IP was not listed in the listing.
View Replies !
Country Drop Down Boxes
On one of my pages I have a form with a country dropdown box, with every country in the world, so obviously it is quite big. if there is an easy to have the particular country that the user selected re-selected, if the user is returned back to the form based on an error on the rest of the form. For example, if they have accidently submitted a blank field somewhere on the rest of the form and they are returned to the same form to correct the problem, I would like the country dropdown box to have what they previously selected, re-selected. Is there some way to do this with the country dropdown box without about 250 'if' statements?
View Replies !
Divide User By Country
Today I design a website and I wanna add a feature: let everyone know how many users access from any country but one problem appears to me: if I have IP of an user, what's can I do to know which country user living? I search on internet but still don't have a solution!
View Replies !
Displaying Country Of Origin
I wasn't sure what category to post this under, so I just put it here in php since my application thus far has been written in php. I have written a registration/login system which captures the IP address of the visitor whenever he/she logs in. I'm now writing my admin tools for the site. What I need to do is build an app where I can type in the member's account number, and it will retrieve the IP address from MySql and use it to find the country of origin for the user, then echo it to the page. This is important to prevent fraud on my site. I know how to build queries to get the IP address from the database. But is there function or script that can use it to get the user's location
View Replies !
Finding Which Country The User Is From
I have seen many sites where they 'guess' the country you are from, presumably from your IP address, and then display this somewhere on the page, or indeed to determine which language to display the page in. Is there a central location anywhere which lists the IP addresses that a country starts with?
View Replies !
Setting Default Country
I have a form that uses a dropdown menu to display countries. Upon selection, the user will be taken to the relevant url. I'm building the dropdown menu options via a query to mysql, and I'm trying to get it to default to 'selected' for the 'United States.
View Replies !
|