@@ -548,83 +548,6 @@ public static function getClientIp() {
548
548
return $ ipaddress ;
549
549
}
550
550
551
- /**
552
- * Get your browser's info
553
- * @return stdClass returns the object containing the info of your browser
554
- */
555
- public static function getBrowserInfo () {
556
- $ u_agent = isset ($ _SERVER ['HTTP_USER_AGENT ' ]) ? $ _SERVER ['HTTP_USER_AGENT ' ] : 'UNKNOWN ' ;
557
- $ bname = 'Unknown ' ;
558
- $ platform = 'Unknown ' ;
559
- $ ub = 'Unknown ' ;
560
- $ version = "" ;
561
- //First get the platform?
562
- if (preg_match ('/linux/i ' , $ u_agent )) {
563
- $ platform = 'linux ' ;
564
- } elseif (preg_match ('/macintosh|mac os x/i ' , $ u_agent )) {
565
- $ platform = 'mac ' ;
566
- } elseif (preg_match ('/windows|win32/i ' , $ u_agent )) {
567
- $ platform = 'windows ' ;
568
- }
569
- // Next get the name of the useragent yes seperately and for good reason
570
- if (preg_match ('/MSIE/i ' , $ u_agent ) && !preg_match ('/Opera/i ' , $ u_agent )) {
571
- $ bname = 'Internet Explorer ' ;
572
- $ ub = "MSIE " ;
573
- } elseif (preg_match ('/Firefox/i ' , $ u_agent )) {
574
- $ bname = 'Mozilla Firefox ' ;
575
- $ ub = "Firefox " ;
576
- } elseif (preg_match ('/Chrome/i ' , $ u_agent )) {
577
- $ bname = 'Google Chrome ' ;
578
- $ ub = "Chrome " ;
579
- } elseif (preg_match ('/Safari/i ' , $ u_agent )) {
580
- $ bname = 'Apple Safari ' ;
581
- $ ub = "Safari " ;
582
- } elseif (preg_match ('/Opera/i ' , $ u_agent )) {
583
- $ bname = 'Opera ' ;
584
- $ ub = "Opera " ;
585
- } elseif (preg_match ('/Netscape/i ' , $ u_agent )) {
586
- $ bname = 'Netscape ' ;
587
- $ ub = "Netscape " ;
588
- }
589
- // finally get the correct version number
590
- $ known = [
591
- 'Version ' ,
592
- $ ub ,
593
- 'other '
594
- ];
595
- $ pattern = '#(?<browser> ' . join ('| ' , $ known ) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)# ' ;
596
- if (!preg_match_all ($ pattern , $ u_agent , $ matches )) {
597
- // we have no matching number just continue
598
-
599
- } else {
600
- // see how many we have
601
- $ i = count ($ matches ['browser ' ]);
602
- if ($ i != 1 ) {
603
- //we will have two since we are not using 'other' argument yet
604
- //see if version is before or after the name
605
- if (strripos ($ u_agent , "Version " ) < strripos ($ u_agent , $ ub )) {
606
- $ version = $ matches ['version ' ][0 ];
607
- } else {
608
- $ version = $ matches ['version ' ][1 ];
609
- }
610
- } else {
611
- $ version = $ matches ['version ' ][0 ];
612
- }
613
- }
614
- // check if we have a number
615
- if ($ version == null || $ version == "" ) {
616
- $ version = "? " ;
617
- }
618
-
619
- return [
620
- 'user_agent ' => $ u_agent ,
621
- 'name ' => $ bname ,
622
- 'version ' => $ version ,
623
- 'platform ' => $ platform ,
624
- 'pattern ' => $ pattern
625
- ];
626
- }
627
-
628
551
/**
629
552
* Returns an base64 encoded encrypted string
630
553
*/
0 commit comments