It is possible to method to conditionally execute php_flag claims inshtaccess? Listed here are a couple of things I am attempting to do:

Turn error confirming on when the client's Ip matches the Ip I personally use:

if %{REMOTE_ADDR} == '12.34.56.78' then
   php_flag error_reporting 1
else
   php_flag error_reporting 0

Switch off register_globals when the Ip matches mine, to ensure that I'm able to debug any issues triggered through the code expecting this switched on.

if %{REMOTE_ADDR} == '12.34.56.78' then
   php_flag register_globals on
else
   php_flag register_globals on

Thank you for reading through!

kerry,

I suspect the trouble with the first attempt is your regular expression is "^192\.168\.0$". This can never match any possible Remote_Addr since you've only got 3 parts towards the Ip, having a forced "^" start and "$" finish.

Possibly you meant to make use of the regular expression "^192\.168\.0\." ?

Observe that I have excluded the "$" in the finish, to ensure that it does not matter the way the Ip finishes. Which I have incorporated an additional "\." steered clear of period to ensure that you'll pressure the matching IP addresses with an actual "0" and never something similar to "012", "001", etc (not too these zero-filled parts should trouble any Ip).

SetEnv does not appear to dedicate yourself me. I attempted this during my .htaccess:

SetEnvIf Remote_Addr ^192\.168\.0$ ip_ok
<IfDefine !ip_ok>
  AuthName "Guest Login"
  AuthType Basic
  AuthUserFile /opt/lampp/lib/ok_users/guests.users
  require valid-user
</IfDefine>

and that i needed to provide username/password qualifications despite the fact that my ip is 192.168..10 and also the server (centos5 / xampp for linux 1.6.8a) is 192.168..1

And So I attempted this:

SetEnv ip_ok
<IfDefine !ip_ok>
  AuthName "Guest Login"
  AuthType Basic
  AuthUserFile /opt/lampp/lib/ok_users/guests.users
  require valid-user
</IfDefine>

but setenv doesn't set ip_ok, and that i get challenged.

I Quickly attempted this:

SetEnv ip_ok
<IfDefine ip_ok>
  AuthName "Guest Login"
  AuthType Basic
  AuthUserFile /opt/lampp/lib/ok_users/guests.users
  require valid-user
</IfDefine>

and that i do not get challenged. Therefore IfDefine is working.

Any ideas why I can not get SetEnv and SetEnvIf to operate?? I have researched and browse but can't crack it.