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.

eZ debug

Timing: Jan 18 2025 19:07:37
Script start
Timing: Jan 18 2025 19:07:37
Module start 'layout'
Timing: Jan 18 2025 19:07:37
Module start 'content'
Timing: Jan 18 2025 19:07:38
Module end 'content'
Timing: Jan 18 2025 19:07:38
Script end

Main resources:

Total runtime0.8244 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 589.1797152.6406
Module start 'layout' 0.00740.0033 741.820339.4766
Module start 'content' 0.01060.8124 781.2969522.2188
Module end 'content' 0.82300.0014 1,303.51568.1250
Script end 0.8244  1,311.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4384160.0002
Check MTime0.00140.1753160.0001
Mysql Total
Database connection0.00150.177310.0015
Mysqli_queries0.773593.8258540.0143
Looping result0.00050.0659520.0000
Template Total0.785695.320.3928
Template load0.00330.405620.0017
Template processing0.782294.884020.3911
Template load and register function0.00030.031310.0003
states
state_id_array0.00130.161910.0013
state_identifier_array0.00310.373520.0015
Override
Cache load0.00280.3391180.0002
Sytem overhead
Fetch class attribute can translate value0.00090.103520.0004
Fetch class attribute name0.00200.247330.0007
XML
Image XML parsing0.00060.075420.0003
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00160.1993160.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs