Find the user browser type using PHP

By Webdevelopmentlogics


public function getBrowserType(){

$sUserBrowserAgent = '';

if (ereg('OPERA(/| )([0-9].[0-9]{1,2})', strtoupper($_SERVER["HTTP_USER_AGENT"]), $log_version)) {
$sUserBrowserAgent = 'OPERA';
} else if (ereg('MSIE ([0-9].[0-9]{1,2})', strtoupper($_SERVER["HTTP_USER_AGENT"]), $log_version)) {
$sUserBrowserAgent = 'IE';
} else if (ereg('OMNIWEB/([0-9].[0-9]{1,2})', strtoupper($_SERVER["HTTP_USER_AGENT"]), $log_version)) {
$sUserBrowserAgent = 'OMNIWEB';
} else if (ereg('MOZILLA/([0-9].[0-9]{1,2})', strtoupper($_SERVER["HTTP_USER_AGENT"]), $log_version)) {
$sUserBrowserAgent = 'MOZILLA';
} else if (ereg('KONQUEROR/([0-9].[0-9]{1,2})', strtoupper($_SERVER["HTTP_USER_AGENT"]), $log_version)) {
$sUserBrowserAgent = 'KONQUEROR';
} else {
$sUserBrowserAgent = 'OTHER';
}

return $sUserBrowserAgent;

}

 

MYSQL - LEFT JOIN Example

By Webdevelopmentlogics


SELECT U.username, U.user_id, SR.section_id, U.access, count( DISTINCT SR.section_id ) AS section_count
FROM `users` U
LEFT JOIN `survey_replies` SR ON ( U.user_id = SR.user_id )
WHERE U.access >1
GROUP BY U.user_id
ORDER BY SR.section_id