There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware missing monitor network networking outlook outlook 2003 outlook 2007 outlook express password popups problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: How do you display the version of IE in PHP?


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
05-Feb-2006, 01:20 PM #1
Solved: How do you display the version of IE in PHP?
I'm trying to see if I can display certain content depending on which version of IE someone is using.

I'm trying to modify this IF statement:
PHP Code:
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE
But I don't seem to be doing it right, this is what I tried out, but didn't work:
PHP Code:
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE7') !== FALSE) {
echo 
"You're using IE7";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE6') !== FALSE) {
echo 
"You're using IE6";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE5') !== FALSE) {
echo 
"You're using IE5";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE4') !== FALSE) {
echo 
"You're using IE4";
}
?>
Any help?
__________________
------------------------
| 404: Name Not Found |
------------------------
PLEASE NOTE: If I happen to help you in a post, or just simply reply to it, doesn't mean I want to be bombarded with PMs. I answer all questions in posts, not in PMs. Thank you, and have a good day.

<?php $h = 'Hello '; $w = 'World'; echo $h.$w; ?>

My Favorite Editors:
Windows: Crimson Editor
Mac: Taco HTML Edit
Linux: gPHPEdit
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
05-Feb-2006, 02:52 PM #2
What I want to use it for, it has to be processed on the server before it gets to the browser.

That's why I can't just use the IE conditional comments
php guy's Avatar
Computer Specs
Senior Member with 512 posts.
 
Join Date: Dec 2004
Location: Bowlaro Lanes, WA
Experience: That's Mr. Clueless to you
05-Feb-2006, 03:00 PM #3
Add a space between MSIE and version number, like so:
PHP Code:
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== FALSE) {
echo 
"You're using IE7";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== FALSE) {
echo 
"You're using IE6";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5') !== FALSE) {
echo 
"You're using IE5";
}

else if (
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 4') !== FALSE) {
echo 
"You're using IE4";
}
?>
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
05-Feb-2006, 03:06 PM #4
Awesome thanks

I got it to say I have IE6

Can someone with a version of IE *other* than 6 view my test page and tell me if your version comes up?
http://www.clifford.excelitehost.com...ieversions.php
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:02 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.