Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

User agent string containing "+" - _ss_enviroment.php


Go to End


3 Posts   1173 Views

Avatar
vwd

Community Member, 166 Posts

5 October 2011 at 7:10pm

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.

Avatar
(deleted)

Community Member, 473 Posts

5 October 2011 at 7:54pm

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.

Avatar
vwd

Community Member, 166 Posts

5 October 2011 at 10:03pm

Great - thanks for that explanation Simon.

VWD.