PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Thu May 10, 2007 6:45 pm
This was my attempt but go figure, it does not work...
Code: Select all
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (!eregi("Opera/7") || !eregi("Opera 7")) {include("includes-noscript.php");}
nickvd
DevNet Resident
Posts: 1027 Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:
Post
by nickvd » Thu May 10, 2007 6:56 pm
Is it really worth supporting the .001% that are still using Opera 7?
Edit: You're not testing your regex against anything....
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Thu May 10, 2007 7:00 pm
The shares of people using Opera 7 are off-topic to this thread.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu May 10, 2007 7:01 pm
You passed only the pattern but not the subject to ereg().
You want it to not match
Opera/7 and to not match
Opera 7 -> !ereg() && !ereg()
You could use a pattern but you didn't. The pattern would be: Opera
/ or space 7
ereg is deprecated, use preg_match instead.
try
Code: Select all
if ( !preg_match('!Opera[/\s]7!', $_SERVER['HTTP_USER_AGENT']) ) {
require 'includes-noscript.php';
}
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Thu May 10, 2007 7:10 pm
Thank you volka, this works great!
My site works great in Opera 7+, works good enough in Opera 4/5, and only currently has a menu issue with absolute positioning in Opera 3.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu May 10, 2007 7:13 pm
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Thu May 10, 2007 7:57 pm
I have a little code snippet in either coding critique or code snippets that might be helpful to you as well. If not, there is always phpSniff.
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Thu May 10, 2007 9:09 pm
Thanks Everah, go ahead and post it or message it (whichever is fine). I'm dealing with such specific issues that scripts don't usually help but I'll still take a look.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu May 10, 2007 9:16 pm
Don't be lazy JAB, using the search function you'll be able to find it in 10 seconds.
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Fri May 11, 2007 1:03 pm
Oh well I've got all the issues on my mind browser-related covered thus far. I just have to document what I've done to deal with those issues. Thanks though...