[thelist] ASP question - User List Update

Robert robert at thewhitehousegroup.com
Wed Nov 5 12:07:12 CST 2003


I was able to answer my own question after doing a little research. I'm
posting the finalized script for anyone who has a similar need:

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

'find out this particular users name
name=request.Cookies("name")

'find out this particular users Color
color=request.Cookies("color")

Set fs = server.CreateObject("Scripting.FileSystemObject")

Set wfile = fs.OpenTextFile(server.mappath("users.dat"))

do while not wfile.AtEndOfStream
filecontent=wfile.ReadLine
if filecontent="<font face=Verdana size=2 color="& color &">"& name &"<br>"
then
filecontent=" "
end if
finalcontent=finalcontent & filecontent
loop

wfile.close
Set wfile=nothing
Set fs=nothing

' Open the data file for reading
Set objFS = Server.CreateObject ("Scripting.FileSystemObject")
set objFile = objFS.GetFile(server.mappath("users.dat"))

'write the new data to the file
set objFile = objFS.CreateTextFile(server.mappath("users.dat"), true)
objFile.WriteLine(finalcontent)
objFile.close
%>

<html>
<head>
<title>Logoff</title>
</head>
<body bgcolor="#FFFFFF" onLoad=window.close()>

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


Thanks!

~Qixsilver



More information about the thelist mailing list