driz Posted July 11, 2008 Share Posted July 11, 2008 Hello,I need to make some code that when the user uses Internet Explorer they are directed to a page like /browser_not_supported/this redirect should be instant and you should NOT see any part of the website beforehand.On this NEW page, I need to be able to STILL go to the website even so they are using IE, so like I can warn them, but they CAN still visit the page if they really insist on using IE. I take it this would be done using cookies?Thanks. xnote: this is how I intend the page to work like: Link to comment Share on other sites More sharing options...
Lonig Posted July 11, 2008 Share Posted July 11, 2008 found this script for general browser detection... but I dont have access to a php server or even IE7 to test at the moment. Perhaps if you change the IF where the output is, and have an ELSE setup otherwise.ie: just direct to the continue page in the IF of an IE7, and the else would be to just continue on. <?phpecho ( browser_detection( 'number' ) .'<br>'. browser_detection( 'browser' ) .'<br>'. browser_detection( 'os' ) .'<br>'. browser_detection( 'os_number' ) ); ?> Outputs (browser version, browser, os, os number): 1.5moznt5.1 <?phpif ( ( browser_detection( 'browser' ) == 'ie' ) && ( browser_detection( 'number' ) >= 5 ) ){echo 'it is Internet Explorer ' . browser_detection( 'number' );// or anything else you want to happen of course}?> Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 11, 2008 Share Posted July 11, 2008 Yes, cookies would probably be the best way to keep track of the IE users. See http://www.quirksmode.org/js/detect.html (EDIT: Oops, wrong language...) for the actual detection and http://www.w3schools.com/PHP/php_cookies.asp for the cookies.Where did you find that PHP browser_detection function? I only know about http://www.php.net/manual/en/function.get-browser.php, but that requires browscap.ini. Link to comment Share on other sites More sharing options...
driz Posted July 11, 2008 Author Share Posted July 11, 2008 You have both just confused me!basically domain.com needs to KNOW if your using IE, and then direct to domain.com/browser/ if you are using IE, if not it should just load the site like normal. The browser page should have a continue button that will all access to the site EVEN SO your using IE, so this decision must be stored using a cookie. Thanks. x Link to comment Share on other sites More sharing options...
jeffman Posted July 11, 2008 Share Posted July 11, 2008 browser_detection() is in a library you'd have to include. The key bit would look like this:strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") Link to comment Share on other sites More sharing options...
driz Posted July 11, 2008 Author Share Posted July 11, 2008 meh im so so lost :Scan someone show the code that needs adding to the page that checks, eg. the main site!and then the code for the page that has the continue button that will be ALLOWING access to the site even so your using the IE browser. x Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 11, 2008 Share Posted July 11, 2008 Can we try to work through your confusion? Throw us some questions and let us teach you... A page built to a customer's order is what I would expect from someone who gets paid, but that's irresponsible in our case. We're doing this on our free time and building your knowledge is more important than building your page. Link to comment Share on other sites More sharing options...
driz Posted July 11, 2008 Author Share Posted July 11, 2008 Well I learn from things like this! I'm very good at xhtml/css but would never have learned from a book or stuff like that, I learned by ripping sites tweaking that until eventually I had enough knowledge I could do it myself. The same with PHP I prefer working with working stuff and learning how its working etc, rather than reading all the functions and trying to figure out what goes where.So basically I was looking for the code, I dont want you to build the page im gonna do that, I just need to php code (which i will probably modify anyways). xTHANK YOU FOR HELPING! Link to comment Share on other sites More sharing options...
Jesdisciple Posted July 12, 2008 Share Posted July 12, 2008 So getting questions answered isn't an effective way for you to learn? You're making me curious... (how ironic, lol)You want to warn all versions of IE, right? Not just the latest few?So far as I can tell (from running a makeshift IE on Linux), this works: <?php$warned = isset($_COOKIE['warned']) ? $_COOKIE['warned'] : $_GET['warned'];if(strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") && $warned != 'true'){ ?><html> <head> <title></title> </head> <body> This site is not fully compatible with Internet Explorer! But, if you want to <a href="<?php echo $_SERVER['PHP_SELF']; ?>?warned=true">go in anyway</a>, be our guest. </body></html> <?php}else{ if(!isset($_COOKIE['warned'])){ setcookie('warned', 'true'); } ?><html> <head> <title></title> </head> <body> Here's our regular content... </body></html> <?php}?> My only gripe with this is that Lobo spoofs itself as IE (with the "MSIE" string) so IE-only sites will let it in.On a side note, I wasn't intending to give myself kudos in my last post (or maybe my subconscious actually was); I'm trying to correct errors I've made in the past where I operated like a vending machine. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.