CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 login - where to add code to record who logged in?

Print topic Send  topic

Author Message
Jer

Posts: 25
Posted: 04/19/2008, 11:44 PM

Hi,

I've got code that records who is logging in. (userid, date and IP) I'd like to record this information just before the user is redirected.

I don't see an event that would handle this.

Any suggestions?

Thanks,

Jer
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 04/22/2008, 8:08 PM

Jer
You are going to have to use a custom sql statement to add the information to the specific table. Try this link: http://docs.codecharge.com/studio40/html/ProgrammingTec...tomSQL.html?toc
View profile  Send private message
Jer

Posts: 25
Posted: 04/22/2008, 11:52 PM

Thanks.

I've written the code and it works. I placed it in the "unload" event. However I had to due a check to make sure that the code is executed only when username and password have a value. Otherwise the code executes when the page loads.

It would be handy if there were a "Before Redirect" event.

Jer
View profile  Send private message
tonyk

Posts: 163
Posted: 04/24/2008, 3:45 PM

I have a custome sql sequence that I run as part of the login comparison procedure.
In the before_show event I have
$Container->log_in_from->SetValue($_SERVER["REMOTE_ADDR"]);
to pick up the ip address.

Here is an example that logs all successful and unsuccesful log-in attempts and records the apparent originating ip address. The user is unaware it is active.

function Login_Button_DoLogin_OnClick(& $sender)
{
$Login_Button_DoLogin_OnClick = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $Login; //Compatibility
//End Login_Button_DoLogin_OnClick

//Login @4-64D52AAF
global $CCSLocales;
global $Redirect;
if ($Container->autoLogin->Value != $Container->autoLogin->CheckedValue) {
CCSetCookie("NewProject4Login", "");
}
if ( !CCLoginUser( $Container->login->Value, MD5($Container->password->Value))) {
$Container->Errors->addError($CCSLocales->GetText("CCS_LoginError"));
$Container->password->SetValue("");
$Login_Button_DoLogin_OnClick = 0;
CCSetCookie("NewProject4Login", "");
$success="0";
$db= new clsDBConnection1;
$access_name=$Container->login->GetValue();
$pw=MD5($Container->password->GetValue());
$from=$Container->log_in_from->Getvalue();
$sql="INSERT INTO `access_file` (`access_dt`,`access_from`, `access_name`, `access_pw`, `access_success`) VALUES
( NOW(),'".$from."','".$access_name."', '".$pw."', '".$success."');";
$db->query($sql);
unset($db);
} else {
global $Redirect;
$success="1";
$db= new clsDBConnection1;
$access_name=$Container->login->GetValue();
$pw=MD5($Container->password->GetValue());
$from=$Container->log_in_from->Getvalue();
$sql="INSERT INTO `access_file` (`access_dt`,`access_from`, `access_name`, `access_pw`, `access_success`) VALUES
( NOW(),'".$from."','".$access_name."', '".$pw."', '".$success."');";
$db->query($sql);
unset($db);
if ($Container->autoLogin->Value == $Container->autoLogin->CheckedValue) {
$ALLogin = $Container->login->Value;
$ALPassword = $Container->password->Value;
CCSetALCookie($ALLogin, $ALPassword);
}
$Redirect = CCGetParam("ret_link", $Redirect);
$Login_Button_DoLogin_OnClick = 1;
}
//End Login

//Close Login_Button_DoLogin_OnClick @3-0EB5DCFE
return $Login_Button_DoLogin_OnClick;
}
//End Close Login_Button_DoLogin_OnClick
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.