[thelist] ASP question - User List Update

Robert robert at thewhitehousegroup.com
Tue Nov 4 10:37:01 CST 2003

I have a question regarding a chat page that I have in it's final stages of
completion. It is .asp driven, and I'm pleased with the way it works, except
for one feature that wont seem to work properly. The page keeps a simple
text log in html code of each user who signs onto the page. I want it set up
so that when a user unloads the page, a javascript onUnload command launches
a final .asp alerting the user that they have logged off the page.
Additionally, the script will delete that particular user from the user log.
I use cookies to keep track of the user and their color selection, but for
some reason the code I'm using is deleting ALL users from the user database.
HELP! The following is the script I'm trying to use for the "logoff":


'Set Constants
Const ForReading = 1, ForWriting = 2, ForAppending = 8

'find out this particular users name

'find out this particular users Color

'Open the user database into memory
Set objFS = Server.CreateObject ("Scripting.FileSystemObject")
set objFile = objFS.GetFile(server.mappath("users.dat"))
set textstream = objFile.OpenAsTextStream(ForReading, -2)

'set up the loop that will compare the files and set variables
do while not textstream.AtEndOfStream
singleline = textstream.ReadLine

'Comparison line that works no matter the user name or color
if singleline="<font face=Verdana size=2 color=""& color &"">"& name &"<br>"
user=" "
end if
set relog = objFS.CreateTextFile(server.mappath("users.dat"), true)
relog.WriteLine(""& user &"")

'close the file


<font face=Verdana size=2 color=000000>User Logged Off Of Chat Server</font>

I'm VERY new to .asp (less than a week working with it as the code above
probably shows in it's sloppiness!) and have no idea why this isn't working
properly. Another route I've tried is simply doing a line by line and
dumping each line into a variable that would then be written all at once,
but I'm fuzzy on the way .asp allows concatenation of strings vs. numeric

Thanks for ANY help!


More information about the thelist mailing list