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
https://forums.phpfreaks.com/topic/19629-solved-user-agent-reader/
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.