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
Power Lifting Lever Belt
SkullVamp
Updated:
Saturday at 10:32 PM
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Saturday at 3:55 PM
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Thursday at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Thursday at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Jun 10, 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
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom