Get operating system

Source: Internet
Author: User
Tags ereg
<无详细内容>
  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 (' + ', $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 (' NetBSD ', $agent))
  40. $os = ' NetBSD ';
  41. else if (eregi (' BSD ', $agent))
  42. $os = ' BSD ';
  43. else if (ereg (' OSF1 ', $agent))
  44. $os = ' OSF1 ';
  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. }
Copy Code
  • 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.