Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-06-2010, 09:28 PM   PM User | #1
ShadowIce
Regular Coder

 
Join Date: Apr 2009
Posts: 264
Thanks: 24
Thanked 1 Time in 1 Post
ShadowIce can only hope to improve
PLEASE HELP! Detect safari browser with php GOING INSANE! ><

Can someone please tell me how I can fix this so it detects ONLY the string "Safari" from within the user agent string
and not "Safari/REPLACE THIS PART OF THE STRING WITH THE VERSION HERE"?

PHP Code:
<?php
function is_safari(){
if(
strstr($_SERVER['HTTP_USER_AGENT'], "Safari")){
return 
true;
}else{
return 
false;
}
}
if(! 
is_safari()){
echo 
"<td>\r\n";
}else{
echo 
"hello!\r\n";
}
?>
ShadowIce is offline   Reply With Quote
Old 02-06-2010, 09:59 PM   PM User | #2
JAY6390
Regular Coder

 
Join Date: Dec 2009
Location: UK
Posts: 495
Thanks: 0
Thanked 58 Times in 58 Posts
JAY6390 is on a distinguished road
have you tried using the get_browser() function?
__________________
My site: JayGilford.com
Resources:
PHP Pagination Class | Getting all page links | Handling PHP Errors properly
If you like a users help, show your appreciation with the rep and thanks buttons :)
JAY6390 is offline   Reply With Quote
Old 02-06-2010, 10:50 PM   PM User | #3
ShadowIce
Regular Coder

 
Join Date: Apr 2009
Posts: 264
Thanks: 24
Thanked 1 Time in 1 Post
ShadowIce can only hope to improve
Nvm, solved
ShadowIce is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:56 AM.


Advertisement
Log in to turn off these ads.