|
Searching for a specific phrase in a variable?
Ok, I'm trying to make this script for my gaming site right? Yes well I want it the script I'm developing to find the users browser and then make it into a variable. Next, I want to search that variable for the browser the user has, such as Opera or IE. The reason I want to search is because the $_SERVER['HTTP_USER_AGENT'] code ends up to look something like this: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.23 [en] if you're using Opera. I want to search that string for the Opera, and if that user has that browser, than it will bring them to an error page saying my site is incompatible with that browser.
So, you guys got any ideas?
This is what I got so far, but it's not working lol:
[code:1:5e416bd534]<?php
$browser = $_SERVER['HTTP_USER_AGENT'];
if($browser == "Mozilla/4.0 (compatible/; MSIE 6.0/; Windows NT 5.1) Opera 7.23 [en]") {
echo("Sorry, Masters Gaming does not support your browser!");
}
?>[/code:1:5e416bd534]
__________________
█ Izzmo
█ Coding Guru Extraordinaire
█ ZeroWeb Hosting & Design - Customizable hosting for every type of user!
|