ColdEdge Posted July 27, 2009 Share Posted July 27, 2009 Aye, okay I am wondering what to do for my index.php I wish to add a PHP code that will redirect unsupported browsers to a sorry page.Well only browsers that is being g** is IE7. So lets say some one goes to my site domain http://www.mydomain.ltd/ and this person is using any IE be it 6, 7, 8 he or she will be send tohttp://www.mydomain.ltd/sorry.php?idx=ie the strings at the end of sorry.php are just there for fun they will not do anything, however if the user is using FF, FF2, FF3, Opera, Safari, Chrome anything else they will not be send to sorry.php but stay on the index.php page.What is the bit of PHP code that can handle this job? Link to comment Share on other sites More sharing options...
Ingolme Posted July 27, 2009 Share Posted July 27, 2009 I believe the HTTP_USER_AGENT server variable has information about the browser. However, it can easily be modified by the client, or be used wrongly.Browser Vendors tend to cheat and put "Mozilla" or "MSIE" in the User Agent string even if they're not either of those. Link to comment Share on other sites More sharing options...
ColdEdge Posted July 27, 2009 Author Share Posted July 27, 2009 But still even so isent there any script that will not allow IE uses to enter my site rather they will be redirected Link to comment Share on other sites More sharing options...
Ingolme Posted July 27, 2009 Share Posted July 27, 2009 But still even so isent there any script that will not allow IE uses to enter my site rather they will be redirectedYou can make one. Here's the manual for $_SERVER variables in PHP: http://php.net/manual/en/reserved.variables.server.phpThe HTTP_USER_AGENT will give you a string that identifies the browser that is currently visiting your site. You can use a Location header to redirect users after that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.