Jump to:

4878 Posts in 7074 Topics by 1474 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » User agent string containing "+" - _ss_enviroment.php

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 468 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    User agent string containing "+" - _ss_enviroment.php Link to this post

    Hi,

    I'm just wondering what is the purpose of the condition in "An Example" checking if the user agent string contains the "+" sign?

    It's in line 16 of the code...

    if(isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || ($_SERVER['REMOTE_ADDR'] == '<MyIP>'
    && strpos($_SERVER['HTTP_USER_AGENT'], '+') !== false)))
    define('SS_ENVIRONMENT_TYPE', 'dev');
    else
    define('SS_ENVIRONMENT_TYPE', 'live');

    Thanks very much,
    VWD.

  • simon_w
    Avatar
    Forum Moderator
    467 Posts

    Re: User agent string containing "+" - _ss_enviroment.php Link to this post

    That check was so I was put into dev mode while other people, including those from the same IP as me, weren't. As I was using a custom WebKit build, there was a + in the user agent that any normal browser wouldn't have.

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: User agent string containing "+" - _ss_enviroment.php Link to this post

    Great - thanks for that explanation Simon.

    VWD.

    468 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.