Get operating system

Source: Internet
Author: User
Get operating system
<无详细内容>

  1. // Operating system
  2. Public function getOS (){
  3. $ Agent = $ _ SERVER ['http _ USER_AGENT '];
  4. $ OS = false;
  5. If (eregi ('win', $ agent) & strpos ($ agent, '95 '))
  6. $ OS = 'Windows 95 ';
  7. Else if (eregi ('win 9x', $ agent) & strpos ($ agent, '4. 90 '))
  8. $ OS = 'windows me ';
  9. Else if (eregi ('win', $ agent) & ereg ('98 ', $ agent ))
  10. $ OS = 'windows 98 ';
  11. Else if (eregi ('win', $ agent) & eregi ('nt 5.1 ', $ agent ))
  12. $ OS = 'Windows XP ';
  13. Else if (eregi ('win', $ agent) & eregi ('nt 5', $ agent ))
  14. $ OS = 'windows 2000 ';
  15. Else if (eregi ('win', $ agent) & eregi ('nt 6.1 ', $ agent ))
  16. $ OS = 'windows 7 ';
  17. Else if (eregi ('win', $ agent) & eregi ('nt 6', $ agent ))
  18. $ OS = 'windows Visita ';
  19. Else if (eregi ('win', $ agent) & eregi ('nt ', $ agent ))
  20. $ OS = 'windows NT ';
  21. Else if (eregi ('win', $ agent) & ereg ('32', $ agent ))
  22. $ OS = 'windows 32 ';
  23. Else if (eregi ('Linux ', $ agent ))
  24. $ OS = 'Linux ';
  25. Else if (eregi ('unix ', $ agent ))
  26. $ OS = 'unix ';
  27. Else if (eregi ('sun', $ agent) & eregi ('OS', $ agent ))
  28. $ OS = 'sunos ';
  29. Else if (eregi ('IBM ', $ agent) & eregi (' OS ', $ agent ))
  30. $ OS = 'IBM OS/2 ';
  31. Else if (eregi ('Mac', $ agent) & eregi ('PC', $ agent ))
  32. $ OS = 'Macintosh ';
  33. Else if (eregi ('powerpc', $ agent ))
  34. $ OS = 'powerpc ';
  35. Else if (eregi ('aix ', $ agent ))
  36. $ OS = 'aix ';
  37. Else if (eregi ('hpux ', $ agent ))
  38. $ OS = 'hpux ';
  39. Else if (eregi ('netsd', $ agent ))
  40. $ OS = 'netsd ';
  41. Else if (eregi ('bsd', $ agent ))
  42. $ OS = 'bsd ';
  43. Else if (ereg ('oss1', $ agent ))
  44. $ OS = 'oss1 ';
  45. Else if (ereg ('irix ', $ agent ))
  46. $ OS = 'irix ';
  47. Else if (eregi ('freebsd ', $ agent ))
  48. $ OS = 'freebsd ';
  49. Else if (eregi ('teleport ', $ agent ))
  50. $ OS = 'teleport ';
  51. Else if (eregi ('flashget', $ agent ))
  52. $ OS = 'flashget ';
  53. Else if (eregi ('webzip ', $ agent ))
  54. $ OS = 'webzip ';
  55. Else if (eregi ('offline', $ agent ))
  56. $ OS = 'offline ';
  57. Else
  58. $ OS = 'unknown ';
  59. Return $ OS;
  60. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.