Redirect mac and pc to different places

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ojsimon
    New Member
    • May 2007
    • 59

    Redirect mac and pc to different places

    Hi
    Bassically what i want to do is check the user agent and if it is a mac redirect to /mac if it is a pc redirect to /pc if it is another or unknown to /unknown does anyone know how to do this?

    Thanks
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Have a look at the $_SERVER variable. More specifically, the HTTP_USER_AGENT index.

    Comment

    • ojsimon
      New Member
      • May 2007
      • 59

      #3
      yeah how do i use this for a redirect?

      thanks

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Well, if the name of the OS is contained within the HTTP_USER_AGENT string, for example Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.78 Safari/532.5, then what function do you think you could use to check whether the string contains the text "Windows"? Hint: maybe you want to find the position of the str.

        Then you want to look at the header() function to sent a redirect-header to the browser.

        I won't do the work for you :)

        Comment

        • ojsimon
          New Member
          • May 2007
          • 59

          #5
          thank you for your help

          Comment

          Working...