The following code validates the user agent accessing the site however I am getting the error. What do I need to update to accommodate scenarios where there is no user agent
use isset:
if( !isset( $_SERVER['HTTP_USER_AGENT'])){ $name = "none"; }else{ $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); if (preg_match('/opera/', $userAgent)) { $name = 'opera'; } [... yourcode ...] }