Forum Moderators: coopster & phranque

Message Too Old, No Replies

$REMOTE_USER value

         

wizpl

11:31 am on Sep 25, 2005 (gmt 0)

10+ Year Member



I use this SSI code to include extended version of menu for authenticated user "admin". It works well on all pages inside protected directory, but outside this area the $REMOTE_USER returns value "none" so the code no longer recognizes an authenticated user.

Is it possible to make it work both for protected and unprotected areas, so that after logging with user name "admin" all pages start displaying extended menu.

I don't want to make protected duplicates of all unprotected pages.


<!--#if expr="$REMOTE_USER = 'admin'" -->
<!--#include virtual="/members/private/menu_bottom.inc" -->
<!--#else -->
<!--#include virtual="/library/menu_bottom.inc" -->
<!--#endif -->

Moby_Dim

2:39 pm on Sep 25, 2005 (gmt 0)

10+ Year Member



In any case the task name is "session tracking".

You can see that the variable you've choosed does not work in ordinary pages. So, it can not be used.

I'd suggest the following. The moment the next user identified himself, take his ip, os, and user agent + time(). Assume this combination is unique (in fact it does not but for the limited period of time it is OK.) Write this combination to a text file (= simple flat db). Insert in each page SSI of cgi exec type. Let this script control the session : open the db file, look through the array of values for the combination of ip, os, ua and check this for the time. E.g. if the current time - control time is more than 3600 (one hour), let him to login (again), else show him the page for registered users.

May be this solution is not perfect but I can not offer the better one in a minute ;)