Manu limited visibility from some IP adresess

Author Message

Marek Woda

Thursday 12 January 2006 12:29:39 am

I'd like to have two versions of navigation menu (both are in header section)

1. Complete one - visible only from one static IP adress
2. Without one menu position - for the rest IPs

I tried to modify existing pagelayout.tpl in order to make visible menu by insertion of similar code, given below (copmarison of IP adress and then generate apropriate page version)

$adress="172.30.34.123";
//------
  $ip = gethostbyname("$REMOTE_ADDR");
  $OK=false;
  $OK=(strncmp($adress,$ip,strlen($adress))==0);

etc.etc.

But it seems not to be good idea, cause it doesn't work corretly

Could you advise how to do it?

Felix Laate

Thursday 12 January 2006 2:17:02 am

Hi Marek!

Can you use SSI? If yes, then you could get the IP with:

var ip = '<!--#echo var="REMOTE_ADDR"-->'

if (ip == '172.30.34.123') {
   document.write(' _NAVIGATION_FULL_CODE_');
}
else {
  document.write(' _NAVIGATION_LIMITED_CODE_'); 
}

You could e.g. have two tpl-files of which you include the right one.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.