Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:14:55+00:00 2026-06-14T01:14:55+00:00

Alright, so Im working on some code in my companies repo, and I stumbled

  • 0

Alright, so Im working on some code in my companies repo, and I stumbled across this bit of browser detection in the login checks. That pretty much searches for MSIE specifically, and wants to decline the login if the browser version is <= 6 however. This is a rather flawed concept at the moment. Seeing as the method takes the user agent string and removes everything but the version number, however the version number in this case is a single digit which works great for version 1-9 detection. However with Internet explorer 10, the result is 1, thus breaking the logic and making it useless.

So right now I am stuck trying to keep this logic for the most part the same, but in essence compensating for versions that would need 2 digits, such as 10+

its been a long while since I’ve done any browser detection thats version specific. So Im hoping someone can either help me tweak this little bit, or point me towards some better / newer functionality I might be able to use in the same manor.

if (isset($_SERVER['HTTP_USER_AGENT'])) {
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if (strstr($ua,'MSIE') && substr($ua,strpos($ua,'MSIE')+5,1) <= 6 ) {
        return $this->renderMessage(
            self::TEXT_LOGIN_FAILED,
            'It seems that your browser is currently unsupported. We apologize for any inconveniences. Please switch to another browser and try again.'
            );
    }
}

Above is what I am currently working with, as you can see its a bit messy, the person who made it originally didn’t think to far a head. And Im stuck not wanting to break it, as I want to keep it similar but not if that makes any sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:14:57+00:00Added an answer on June 14, 2026 at 1:14 am

    How about something like this:

    $ua_array = explode(' ', $_SERVER['HTTP_USER_AGENT']);
    $msie_key = array_search('MSIE', $ua_array);
    if($msie_key !== false) { // you found MSIE browser
        $msie_version_key = $msie_key + 1;
        $msie_version = intval($ua_array[$msie_version_key]);
        if ($msie_version <= 6) {
            // reject user
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, when I compile this bit of code to test: <?php require('index.inc'); $page =
Alright, I have received some helpful information on this personal site I am working
Alright, some of you might have noticed I've been working on this problem off
Alright so I'm working on a program written in c++ that is running as
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, I've been working on a userscript that redirects when a specific page is
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright, this may take a moment or two to explain: I'm working on creating
Alright, I'm at my wit's end on this issue. First, backstory. I'm working on
In Flash 10/AS3, I added some sound and it seems to be working alright,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.