Doug
|
Posted: 08/25/2003, 12:36 PM |
|
I want to set a session variable from the login page. The variable is from a field from a MS SQL database. I have a requesting form that is protected and it needs this variable.
How can i do a look up to get this after i have validated the login information?
Doug
|
|
|
glerma
|
Posted: 08/25/2003, 2:43 PM |
|
A suggestion would be to always include the Programming Language and Product being used for all of your posts.
Example:
Language: PHP
Product: Codecharge Studio (CCS)
This will help expedite the process of getting a possible answer to your questions. Thanks.
To answer your question...
Assuming you use CCS, you should use the CCSetSession() function or method provided by Codecharge Studio's API. Also assuming PHP, it would be called like this:
CCSetSession("myvar", "value");
Example:
CCSetSession("UserID", "jdoe");
The inverse function to this is CCGetSession, which as the name implies, will allow you to retrieve a value from a particular Session Variable.
ASP should have a similar method.
Let me also point out the fact that there are coding examples on how to use this function/method in the CCS Help Pages. Just do a search on "Session" and you will find an article entitled "Create Custom Session Variables". In addtion to this, there is much more valuable information you will be able to find in these help pages.
Regards.
george
|
|
|
Doug
|
Posted: 08/25/2003, 6:22 PM |
|
Thank you for your response. I have indeed read the manual, but for some reason my code will not work correctly.
I am using ASP with MSSQL.
I am attempting to do a lookup to my db to a fill a value in a form. This code looks good to me, but I must be missing something.
I have placed this code in the before show of page that needs the variable:
Function Page_BeforeShow() 'Page_BeforeShow @1-653D685B
'Custom Code @18-73254650
' -------------------------
LoginInfo.memberid.value = CCDLookUp("member_id", "TAB_MEMBER", "sysid="&GetUserID(), ch_connect)
' -------------------------
'End Custom Code
Doug
|
|
|
RonB
|
Posted: 08/26/2003, 2:40 AM |
|
Ok first of I know almost nothing about asp but i do seem to remember that it is very strict about declaring stuf before you can use it. With php you have to declare a global for the connection object or instantiate a new connection class.
Your code does not seem to declare the connection so maybe that's the problem?
'Custom Code @18-73254650
' -------------------------
LoginInfo.memberid.value = CCDLookUp("member_id", "TAB_MEMBER", "sysid="&GetUserID(), ch_connect)
Again, I dont know much about asp but maybe this will help you in some way.
Ron
' -------------------------
'End Custom Code
|
|
|
|