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

 On Logout custom code [SOLVED]

Print topic Send  topic

Author Message
karen

Posts: 99
Posted: 12/04/2011, 7:28 PM

Hi all,

I think this could be a very simple thing but I just can't find it anywhere. I would like to be able to add some code to delete tables when a user logs out. I would not like to customise CCLogoutUser function in Common.php. But Logout is only a link so does not have any event to it except Before Show. Do I place this code somewhere in the Login form with some parameters?

Any advice would be much appreciated. Thanks!

Cheers,
Karen
View profile  Send private message
datadoit
Posted: 12/05/2011, 5:30 AM

Logout links created by CodeCharge simply add a parameter to the URL
(Logout=True) and redirect to a page of your choice. On that page of
your choice, you must also have a Logout Action, which looks for that
URL parameter and calls CCLogoutUser().

So, on your page where you have your Logout Action, add Custom Code
where your Logout Action is (typically in the page's Before Initialize
event).
karen

Posts: 99
Posted: 12/06/2011, 7:39 PM

You're exactly right, datadoit! Thanks for steering me in the right direction. No need to modify common.php. Just had to add custom code to the page After Initialize event of the login page.

Thanks!
View profile  Send private message
lgalocgoc2

Posts: 35
Posted: 01/14/2013, 11:05 PM

what specific code i have to add? please help.
View profile  Send private message
karen

Posts: 99
Posted: 01/15/2013, 12:56 AM

It depends on what you are trying to do. If you want to reset your session variables, you could set to them to blank here. Or you could put some database statements here to run.

Perhaps you could provide more info about what you are trying to do.
View profile  Send private message
dzulishak

Posts: 12
Posted: 04/19/2013, 8:02 AM

hello karen..can you give the code so i can try at my system?
View profile  Send private message
karen

Posts: 99
Posted: 04/19/2013, 10:27 AM

Hi,

If you are wanting to clear the session variables, then I added to the Page After Initialize even of the login page something like this:

CCSetSession("session_var", "");

You should see this code appear in the Login_events.php if your login page is named "Login".

If you need to delete tables, open a new connection, setup the SQL statement and then execute the statement as you normally would and the close connection.

$db = new someconnection();  
$SQL_drop = "DROP TABLE sometable;";  
$db->query($SQL_drop);  
$db->close();

Don't forget to test for Logout action with something similar like that:
if(strlen(CCGetParam("Logout", "")))
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.

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.