CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 This is not my day! Problem with user_name as session var.

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 02/16/2005, 9:53 AM

In my login page, I want to store the user name as a session variable. I use the following code:

//Login_DoLogin_OnClick @7-096B22C1
function Login_DoLogin_OnClick()
{
$Login_DoLogin_OnClick = true;

//(TCR) Added 16 Feb 2005 to store user's name **************************************************************************
if ($Login_DoLogin_OnClick == true) {
$db = new clsDBessa();
CCSetSession("User_Name", CCDLookUp("name","users","user_id=".$db->ToSQL(CCGetUserID(),ccsInteger), $db) );
$db->close();
}
//*******************************************************************************************************************
//End Login_DoLogin_OnClick


In another page I display the user name. The problem is that the first time I log is as name1, I get nothing. I log out and back in as name2. It now displays name 1. Continually logging out and then as different users I keep getting the previous user's name. The code I use to display the user name is:

//(TCR)15 Feb 2005
// Check if records for this participant have already been created.
$userid = CCGetSession("UserID","");
$user_name = CCGetSession("User_Name","");
//echo $userid;
//echo $user_name;
// -------------------------

Is this s known bug in CCS or wha? Any guidence would be so good.

Thanks, Trevor
?
View profile  Send private message
saseow

Posts: 744
Posted: 02/16/2005, 8:26 PM

I have got no answer from this. Can anyone even tell me if they have experienced the same hassle?

Thanks,

Trevor
View profile  Send private message
peterr


Posts: 5971
Posted: 02/16/2005, 8:39 PM

Looks you added your code in a wrong place, before the user session is created. You would need to move your code to after the login is verified and UserID session is created.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
saseow

Posts: 744
Posted: 02/17/2005, 5:37 PM

I have sorted it all out now.

Thanks for the help Peter!

Trevor
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.