-1

I need a php function which will help me to detect that user is logged-in from his mobile phone or from his computer? Is there a way to detect this?

I have tried with $_SERVER['HTTP_USER_AGENT'] but It returns a string with browser name and mobile name with specification. for exampe for website it returns :- Mozilla/5.0 (Windows NT 6.2; rv:32.0) Gecko/20100101 Firefox/32.0

ʰᵈˑ
  • 10,738
  • 2
  • 20
  • 45
user3913769
  • 21
  • 1
  • 6

1 Answers1

1

Have a look this library - MobileDetect

You can then use it like :

// These lines are mandatory.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Basic detection.
$detect->isMobile();
$detect->isTablet();
Boris
  • 802
  • 1
  • 10
  • 13