View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
Thanks very much for detailed and informative reply.
 
I will explain the situation , I have three frames in one page (mymainpage.fwx), one frame in the top of the page, that holds  the information about my company, company logo, login button ,logout button. in the left hand side frame I am going to have one tree view menu(I have not got the menu yet, still looking for one). To operate any of the menu item user has to login with a valid user name(Auth.userid) and password, after the successful login the top frame should display the username, it should get refreshed whenever user changes his ID, The third frame in the middle of the page is for the data entry, based on the menu selection(left hand side form).
 
 hope my requirement is clear , pls advice me how can I do that?
 
Thanks
 
jijo
 
Sent by FoxWeb Support on 05/09/2004 09:53:21 PM:
What do you mean by "global" variable?  Are you referring to a public variable?  You should never use public variables to hold user-specific information.  Here's some information on this topic:

Private VFP memory variables are not preserved between hits on the same channel and definitely not between hits across channels.  Each channel is a separate instance of VFP and there is no way to know which channel will serve the next request.  Variables and objects defined in your scripts will not be available in the next request unless they are defined as public.  You should NEVER use public variables to save user-specific information between hits.  Whenever you declare a variable as public, this variable remains in memory ONLY for that particular channel, even after the request is processed.  This means that:

  1. Public variables only persist in the channel they were declared in.  They will not be available if the next request for a particular user is served by a different channel.
  2. Public variables are shared by all users on the same channel so they can not be used to maintain state information.

Also, public variables are cleared from a specific channel if a run-time script error occurs.

In order to pass information between hits you need to use one of the techniques outlined in the "Session Management" topic of the FoxWeb documentation (http://www.foxweb.com/document/state.htm).  Some of these techniques are illustrated in the ContactMine example.

The only situation where public memory variables can be used is if they contain information that is not specific to a particular user or application.  For example, you should define your objects as public if their startup code takes too long and you do not want to define them at the beginning of every hit.  If you chose to define your objects as public you should make no assumptions about the state of these objects (or even about whether they exist).  Before using the objects your code should first check for their existence (IF TYPE('ObjectName') = 'O') and then, either create them, or re-initialize all properties.

In this particular case I don't understand why you would even want to store the userid in a variable.  If you want, you can simply always use Auth.UserID to display the user id:

AuthMessage = "User:" + Auth.UserID

The Auth.UserID property is populated in subsequent requests as long as the user remains logged in.

FoxWeb Support Team
support@foxweb.com email

Sent by jijo david on 05/09/2004 07:24:04 AM:
sorry for troubling with this type of silly requirement, pls excuse me, I am a beginner
 
I am declared one  global variable called 'mGuserid' in my main form 'myform.fwx', I am calling Auth.Authenticate function to get user id and stores in to the global variable mGuserid
by using
mguserid=auth.userid
In myform.fwx I will display the login user name, what I want to do is whenever I change the value of  mguserid, 'myform.fwx' should display the latest name
 
I am displaying the user id in 'myform.fwx' is as follows.
 
<%
AuthMessage = "User:" +mguserid
%>
<p font color="red" style="font-size: 8pt; font-family: Arial" ><i> <%=AuthMessage%></font></i><p>
<%
 
thanks
jijo
 
Sent by FoxWeb Support on 05/08/2004 11:13:12 PM:
The userid is contained in Auth.UserID.
 
Please refer to the documentation of the Auth object for details on how to use a table to hold your user list.  We will be glad to answer specific questions you may have.

FoxWeb Support Team
support@foxweb.com email

Sent by jijo david on 05/08/2004 10:08:46 PM:
Dear All,
I tried to modify Authenticate.fwx of sample to add a login screen to my application , pls clarify the following
 
1.After sucsesfull login how can I display the user name in my banner.htm (banner is common thru out my application)
 
2.How can I take user name and password from Vfp Table (field name is name c(10),pass c(10))
 
thanks in advance
 
Jijo