Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   I Sell Pagerank   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 01-02-2004, 05:30 PM   #1 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,067
iTrader: 0 / 0%
Latest Blog:
Moved In!

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
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!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 01-02-2004, 05:56 PM   #2 (permalink)
Possible Terrorist
 
kwvarga's Avatar
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
iTrader: 0 / 0%
Latest Blog:
A+ Certification

kwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web pro
Send a message via AIM to kwvarga
http://us2.php.net/manual/en/function.strstr.php
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
kwvarga is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-02-2004, 06:07 PM   #3 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,067
iTrader: 0 / 0%
Latest Blog:
Moved In!

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Damn... I swear I looked all over for it on PHP.NET... I did about a million search's too... errr thanks man
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-02-2004, 06:08 PM   #4 (permalink)
Possible Terrorist
 
kwvarga's Avatar
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
iTrader: 0 / 0%
Latest Blog:
A+ Certification

kwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web pro
Send a message via AIM to kwvarga
no problem.. thats a tough one. strstr looks like some advanced thing until u think about it.
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
kwvarga is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-02-2004, 06:15 PM   #5 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
better off using the php sniff class

http://sourceforge.net/projects/phpsniff/
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-20-2006, 01:55 PM   #6 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,067
iTrader: 0 / 0%
Latest Blog:
Moved In!

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Nice, I'll look into that niceguy
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-21-2006, 02:07 PM   #7 (permalink)
Contributing Member
 
lordspace's Avatar
 
Join Date: 05-30-06
Location: Canada
Posts: 458
iTrader: 0 / 0%
lordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nice
Send a message via ICQ to lordspace Send a message via Skype™ to lordspace
try this:

PHP Code:
$browser $_SERVER['HTTP_USER_AGENT'];

// match Opera and IE 
// "Mozilla/4.0 (compatible/; MSIE 6.0/; Windows NT 5.1) Opera 7.23 [en]"
if (preg_match('#MSIE|Opera#si'$browser)) {
  echo(
"Sorry, Masters Gaming does not support your browser!");

Svet

Last edited by lordspace : 11-21-2006 at 02:08 PM. Reason: trim whitespace
lordspace is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-27-2006, 12:20 PM   #8 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,067
iTrader: 0 / 0%
Latest Blog:
Moved In!

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Thanks

Lordspace, if you notice, this is like one of my first topics (ever), on Webmasters Forums Lol.. it's almost 3 years old.

__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-27-2006, 12:49 PM   #9 (permalink)
Contributing Member
 
lordspace's Avatar
 
Join Date: 05-30-06
Location: Canada
Posts: 458
iTrader: 0 / 0%
lordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nicelordspace is just really nice
Send a message via ICQ to lordspace Send a message via Skype™ to lordspace
This may be useful for others who are asking the same question as you were

Last edited by lordspace : 11-27-2006 at 12:56 PM.
lordspace is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-27-2006, 12:50 PM   #10 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,067
iTrader: 0 / 0%
Latest Blog:
Moved In!

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
hehehe

I don't even know how I found this, but it's coo
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



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

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to pass a php variable to asp code white10 Coding Forum 4 04-20-2007 05:11 AM
Directing specific users to a specific folder Kenny Fix Coding Forum 3 03-19-2006 08:57 AM
Trouble with using variable bytech Coding Forum 3 03-17-2005 11:57 PM
How to grab a variable from the URL Pipeline-Webdesign Coding Forum 3 08-31-2004 10:25 AM
1 variable, mod rewrite help MrMean Coding Forum 6 07-07-2004 03:02 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 06:33 AM.
© Copyright 2008 V7 Inc