Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Yesterday at 12:41 PM
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Oct 14, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
PHP
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Ayeshlive" data-source="post: 12266281" data-attributes="member: 363439"><p>Write a PHP script to detect the type of browser used to display the script. The </p><p>information about the browser being used can be found in the value of a special </p><p>reserved PHP variable (more accurately an array element)</p><p>$_SERVER['HTTP_USER_AGENT'] . You need to use a built-in PHP string </p><p>function to check for three keywords in $_SERVER['HTTP_USER_AGENT']: </p><p>„MSIE‟, „Firefox‟ and „Chrome‟. If „MSIE‟ is found, output “you are using Microsoft </p><p>Internet Explorer”; If „Firefox‟ is found, output “you are using Mozilla Firefox”; If </p><p>„Chrome‟ is found, output “you are using Google Chrome”; If none of the three is</p><p>found, output “you are using a browser other than Microsoft Internet Explorer, </p><p>Mozilla Firefox and Google Chrome”. See </p><p><a href="http://www.useragentstring.com/pages/useragentstring.php" target="_blank">http://www.useragentstring.com/pages...gentstring.php</a> for a list of User Agent </p><p>Strings for different browsers.</p><p></p><p></p><p>---------</p><p>Use strpos() instead of preg matches.</p><p></p><p><?php</p><p>/*$hay is user agent of the request and if strpo returned true, print the text.</p><p>*/</p><p>$hay = $_SERVER['HTTP_USER_AGENT'];</p><p>if strpos('MSIE', $hay) {</p><p>print "You are using IE";</p><p>}</p><p>elseif strpos('Firefox', $hay) {</p><p>print "firefox";</p><p>}</p><p>elseif strpos('Opera'. $hay) {</p><p>print "opera";</p><p>}</p><p>...</p><p>?></p></blockquote><p></p>
[QUOTE="Ayeshlive, post: 12266281, member: 363439"] Write a PHP script to detect the type of browser used to display the script. The information about the browser being used can be found in the value of a special reserved PHP variable (more accurately an array element) $_SERVER['HTTP_USER_AGENT'] . You need to use a built-in PHP string function to check for three keywords in $_SERVER['HTTP_USER_AGENT']: „MSIE‟, „Firefox‟ and „Chrome‟. If „MSIE‟ is found, output “you are using Microsoft Internet Explorer”; If „Firefox‟ is found, output “you are using Mozilla Firefox”; If „Chrome‟ is found, output “you are using Google Chrome”; If none of the three is found, output “you are using a browser other than Microsoft Internet Explorer, Mozilla Firefox and Google Chrome”. See [URL="http://www.useragentstring.com/pages/useragentstring.php"]http://www.useragentstring.com/pages...gentstring.php[/URL] for a list of User Agent Strings for different browsers. --------- Use strpos() instead of preg matches. <?php /*$hay is user agent of the request and if strpo returned true, print the text. */ $hay = $_SERVER['HTTP_USER_AGENT']; if strpos('MSIE', $hay) { print "You are using IE"; } elseif strpos('Firefox', $hay) { print "firefox"; } elseif strpos('Opera'. $hay) { print "opera"; } ... ?> [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom