CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Logging Users

Print topic Send  topic

Author Message
Anothersledhead


Posts: 44
Posted: 03/08/2004, 9:53 PM

I would like to be able to log users in an event log when they login and logout. What is the best way to do this. Currently I am using a record with text areas for user name, password, and hidden fields for date, time, ip address. I put a login action on the Add button to both submit the record and login. This seems like a mixed up way of doing things. Any suggestions? How would I handle the logout aspect of things?
View profile  Send private message
peterr


Posts: 5971
Posted: 03/09/2004, 2:23 AM

Since you were able to do this using hidden fields, possibly you may want to adapt this ASP solution:
http://forums.codecharge.com/posts.php?post_id=42883

As for the logout, see: http://forums.codecharge.com/posts.php?post_id=43670

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Anothersledhead


Posts: 44
Posted: 03/09/2004, 12:05 PM

View profile  Send private message
Anothersledhead


Posts: 44
Posted: 03/09/2004, 12:07 PM

I see what is being done with these examples but don't know how to convert them to php. I am relativly new to php and newer to asp. My table structure is this authentication is done via a table called 'members' with fields 'member_id' 'name' 'email' 'member_login' and 'member_password' the event logging is done through a table called 'event_log' with the fields ' event_id' 'member_login' 'ip_address' 'date' 'time' and ' action'. to achieve the logging of events I created a record with the 'event_log' table added a password field (everything but 'member_login' and 'password' is hidden) and created a login action on the on click event of the add/login button. Like I said this works but not without some issues. Does anybody have any suggestions or code examples on how to clean up my structure.
View profile  Send private message
Michael Mikkelsen
Posted: 03/09/2004, 3:29 PM

See this post for some ideas

http://forums.codecharge.com/posts.php?post_id=43670

Michael Mikkelsen
peterr


Posts: 5971
Posted: 03/09/2004, 10:24 PM

Hi,

Here is sample PHP code that should be used in step 3 at http://forums.codecharge.com/posts.php?post_id=42883 :
	if ($Login_DoLogin_OnClick) {  
		//Create new database connection object  
  		$db = new clsDBkb();  
  		$formatted_date = CCFormatDate(time(), $db->DateFormat);  
  		$db->query("UPDATE users SET date_login=" . $db->ToSQL($formatted_date, ccsDate) . " WHERE user_id=" . CCGetUserID());  
	}

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
acapp


Posts: 31
Posted: 11/22/2004, 12:43 PM

Hi, I've modified your code to suit my database, but it doesn't put the date in the database.. I'm using Solaris UNIX. Does this introduce an issue I'm not aware of? If so how would I modify the code?

if ($Login_DoLogin_OnClick) {
$db = new clsDBTrainingDB();
$formatted_date = CCFormatDate(time(), $db->DateFormat);
$db->query("UPDATE employee SET date_login=" . $db->ToSQL($formatted_date, ccsDate) . " WHERE emp_id=" . CCGetUserID());
}

TIA
Andrew
View profile  Send private message
acapp


Posts: 31
Posted: 11/24/2004, 4:42 AM

I was able to get this working in another piece of custom code just as it is, but it will not work with the Server Side on click?? Anyway, what I have works for me.

Thanks Anyway.
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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