Jump to content

[SOLVED] User Agent Reader


wintallo

Recommended Posts

Hey, I was wondering if anyone knew of a script that checked a user's browser user agent and either let them onto a page, or didn't let them onto a page. I mean, say I required a user to have the user agent:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

How would I make it so only people with this user agent could access a page. If you have no idea what i'm talking about, I want something that works like this website. (except not for PSP)

http://www.geneonanimation.com/psp/

Thanks!

Joel
wintallo.com
Link to comment
Share on other sites

reliance on the user agent string is not bullet proof, because it is of course dependant on the user agent broadcasting it in the first place.

FireFox allows the user to change their user agent string quite easily for example.

In other words.. make your site accessible to all browsers.

Should also use a keyword search rather than standard comparison:
[code]<?php

if (stripos('mozilla', $_SERVER['HTTP_USER_AGENT']) === false) {
    die('Get firefox.');
}

?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.