![]() | ![]() |
| ||||
| Hi guys, I have the following script which should redirect a user if they are using a Polish browser to a specific page. I have asked a Polish friend to test it using his Polish version of Firefox but he said he didn't work. Here is the code: PHP Code: Can anyone spot the problem? Last edited by Cormac; 26-03-2008 at 05:52 PM. |
| ||||
| did you try echo the result to see what's going on? PHP Code:
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| ||||
| the echoed result is - pl,en-us;q=0.7,en;q=0.3 That agent seems a bit odd. I downloaded the Polish version of Firefox myself to test. I opened a browser-language.php file in the browser and it displayed the following information - Mozilla/5.0 (Macintosh; U; Intel Mac OS X; pl; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13 I'm stumped! |
| ||||
| I tired some alternative code and it works: PHP Code: |
| ||||
| of course it does because ereg looks for the match (in this case "pl") and if found returns true. You can also use preg_match which is faster as it's Perl-compatible.
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| Thread Tools | |
| Display Modes | |
|
|
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ruby on Rails VS PHP Code Igniter | gav240z | Coding Help | 10 | 03-02-2008 11:04 PM |
| Browser based calling ... | dbee | The Business Aspects of Web Work | 1 | 21-09-2007 11:01 AM |
| Updating a php based site from any computer | ciller | Webmaster Discussion | 4 | 19-06-2007 06:56 PM |