CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 updating a last login date/time upon success login

Print topic Send  topic

Author Message

Posts: 87
Posted: 06/26/2008, 5:20 PM

In the event code for the Login button created by the CCS login builder, and immedaietly below the PHP code:
$Redirect = CCGetParam("ret_link", $Redirect);
$Login_Button_DoLogin_OnClick = 1;

add the code:
//custom code: update the lastlogin date & time
//It assumes a datetime field 'lastlogin' on your user / clients table.

$db =new clsDBMyAccountantsDB(); \\creates a pointer to the database

//set up the sql statement to execute using the sql funciton now() to provide the current
// date / time, sql takes care of using the right datetime format for your table
// Userid in my case is the users/clients email address

$SQL="UPDATE clients SET `LastLogin`=now() WHERE `Email`='".
.$Container->login->Value."'"; //$Container->login->Value is your users userid

$db->query($SQL); //execute the sql
$db->close(); //close the connection to the database

Hope this helps someone...
View profile  Send private message

Posts: 9
Posted: 09/03/2008, 4:29 AM

I have a Similar problem, but your codes above may not help.

In my case, I want to update a hidden field on update of another using editable grid. The hidden field updatedby should equal current user as soon as a particular field is changed.

Please, bail me out.

View profile  Send private message

Posts: 87
Posted: 09/09/2008, 3:51 PM

Actually I have the same problem in editable as you do at the moment.

I usually assign the field used to store the userid of th euser who has changed a record in the 'custom update' config (one of the properties for the editgrid form you are working on) to equal a session variable UserID (which Codecharge maintains with its authuntication login wizard). However I hae discovered that if a user changes just one record in a editable grid all the grid records get resaved even if they are unchanged.

Yessoftware will say this is not a bug but I think it is (and this has been discussed elsewhere along the lines of other areas of codecharge don't get triggered if an change is not made so why should unchanged editable grid records).

So you have to tie it to an event trigger when your 'watched' field changes to then update the userid field with the session variable UserID. Sadly the server side doesn't have a trigger event for changing a field (natually) so you need to store what the value was before displaying it and then check to see if it has changed during the after submit trigger.

No magic code snippit can be used - it is quite application dependant as I see it. But I am not an expert on CCS so the usual expert prowlers on this forum might jump in here to set you and I straight....hopefully ;-)
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

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

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