Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing out a DB after user logs out?

Status
Not open for further replies.

SteelDragon

Programmer
Feb 1, 2001
134
US
I have a CF chat site that users log in and out of, my problem is two parts, 1) How can I write something in to the logout page so that when the LAST user logs out the database that holds all of their chat is cleared? and 2) How can I set it up, or can I, so that when their text scrolls beyond the visble area it is removed from the database (for example, only allowing it to store 50 lines of text before deleting the oldest text, OR only allowing 50 lines of text to be displayed on the screen at once)? Any suggestions would be greatly appreciated!!!!

SteelDragon
 
Trie using session variables. You can call them anytime on any page in the directory the user works during the users session. Trie the following:

Create a page named application.cfm and save in the root of your working directory. In this page write
<cfapplication name=&quot;appie&quot;
sessionmanagement=&quot;yes&quot;
sessiontimeout=&quot;#CreateTimespan(1, 0, 0, 0)#&quot;>

Now you can set session variables in a page named for example sessions.cfm :
<cfoutput><cfset session.login_name = #form.login_name#
<cfset session.password = #form.password#></cfoutput>

On any page you can now call <cfoutput>#session.login_name#</cfoutput>
Hope this helps
 
Cold, I already have session variables, and at this point, that would be a good idea, but every time ANY user logs out it clears the DB. The problem here is that when it does that, even if it only deletes that users entries, when the chat window refreshes (it does this so you can see new chat text) that user's text is gone, and you cannot read what they typed. I want to set it up so that it checks to see if any other users are logged in, if so then no delete, if not delete. Make any sence?

Thanks,
SteelDragon
 
Sorry. Read to fast. We had a simmilar problem with our chat as well and didn't use session variables.

After breaking our heads over our chat for weeks we finally visited Here we downloaded and purchased an amazing piece of programming. A chat that works with no database at all!

greetings
 
I guess what I really need to know is, how do you check to see if there are any sessions active? and if there are not then perform the delete function.

SteelDragon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top