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 -> Java

 I want to have code Log out

Print topic Send  topic

Author Message
traixuhan
Posted: 09/10/2004, 2:07 AM

I do my project Quesion bank, you can help me. I don't have log out jsp
Anton Hinxman
Posted: 09/20/2004, 2:06 AM

I do not understand your question but think that you need a logout function to be like:

(Note: I have a datetime lastedit column in my user table and reset it to null)

/* Logout feature used in Default jsp
*/
public void logoutUser(com.codecharge.components.Page targetPage) {
if( Utils.getUserLogin(targetPage) != null ) {
com.codecharge.db.JDBCConnection conn = com.codecharge.db.JDBCConnectionFactory.getJDBCConnection("YOURDBCONN");
try {
if(conn instanceof com.codecharge.db.JDBCConnection) {
String sql = "Update users SET lastedit = null WHERE userlogin = "+
conn.toSql(Utils.getUserLogin(targetPage),JDBCConnection.TEXT);
CCLogger.getInstance().info("Logging off via: "+ sql);
conn.executeUpdate(sql);
} else {
CCLogger.getInstance().error("Unable to logout due to bad connection");
}
} catch (Exception ex) {
com.codecharge.util.CCLogger.getInstance().error(".logout has error:"+ ex.getMessage());
ex.printStackTrace();
}
if(conn instanceof com.codecharge.db.JDBCConnection) {
CCLogger.getInstance().info("Proper logout close of connection");
conn.closeConnection();
}
// SessionStorage.getInstance(targetPage.getRequest()).removeAttribute("LogOffUser");
} else {
CCLogger.getInstance().info("Unable to find user name for session (not logged in) "+ Utils.getUserLogin(targetPage));
}
com.codecharge.util.Authenticator auth = com.codecharge.util.AuthenticatorFactory.getAuthenticator( targetPage.getRequest() );
auth.setRequest( targetPage.getRequest() );
auth.setResponse( targetPage.getResponse() );
auth.invalidate();
}


Regards

Anton

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.

Web Database

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.