home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
WinFiles.com 1998 June
/
WF0698_3.ISO
/
servers-websrv
/
websuite.exe
/
USERS.AP_
/
USERS.AP
Wrap
Text File
|
1998-04-01
|
7KB
|
257 lines
<[
// WINC - User
// (c) 1997-98 SmartDesk, Inc., All Rights Reserved
CLASS ChatUser
PUBLIC:
local session, basedir, id, userid, password, name, alias, email, pglen, refreshRate
local picture, utype, lastused
METHOD new( session, basedir )
::session = session
::basedir = basedir
::utype = ""
::picture = ""
return( 1 )
end
METHOD load( id, newflag )
local data
::id = id
if ( type( newflag ) != "N" )
newflag = 0
end
if ( ! fileExists( ::file ) )
if ( ! newflag )
return( 0 )
end
data = ::session.var( "userid" ) + "|" + ::session.var( "pass" ) + "||||25|20|||" + date( "YYYY-MM-DD " ) + time( ) + "|"
else
data = fileReadASCII( ::file )
end
::userid = strextract( data, "|", 1 )
::password = strextract( data, "|", 2 )
::name = strextract( data, "|", 3 )
::alias = strextract( data, "|", 4 )
::email = strextract( data, "|", 5 )
::pglen = 0 + strextract( data, "|", 6 )
::refreshRate = 0 + strextract( data, "|", 7 )
::picture = strextract( data, "|", 8 )
::utype = 0 + strextract( data, "|", 9 )
::lastused = strextract( data, "|", 10 )
return( 1 )
END
METHOD save( )
local hfile, str
hfile = fcreate( ::file, 0 )
if ( hfile < 1 )
return( 0 )
end
::lastused = date( "YYYY-MM-DD " ) + time( )
str = ::userid + "|" + ::password + "|" + ::name + "|" + ::alias + "|" + ::email + "|" + ::pglen + "|" + ::refreshRate + "|"
str += ::picture + "|" + ::utype + "|" + ::lastused
fwriteline( hfile, str )
fclose( hfile )
return( 1 )
END
ACCESS file
return( ::basedir + "\\users\\" + ::id + ".dat" )
END
METHOD profile( channel, alias )
local str
str = "<font size=5>U S E R P R E F E R E N C E S</font><br>\r\n"
str += "<form action=sdchat.htm method=get>\r\n"
str += " <table border=0 width=450 colspacing=0 cellspacing=0>\r\n"
str += " <tr><td width=40% align=right>User-Id: </td><td width=60%><input type=text name=userid value=" + ::userid + "></td></tr>\r\n"
str += " <tr><td></td></tr>\r\n"
str += " <tr><td align=right>Password: </td><td><input type=text name=pass value=" + ::password + "></td></tr>\r\n"
str += " <tr><td> </td></tr>\r\n"
str += " <tr><td align=right>Full Name: </td><td><input type=text name=name value=" + ::name + "></td></tr>\r\n"
str += " <tr><td align=right>Chat Alias: </td><td><input type=text name=alias value=" + ::alias + "></td></tr>\r\n"
str += " <tr><td align=right>Email Address: </td><td><input type=text name=email value=" + ::email + "></td></tr>\r\n"
// str += " <tr><td align=right>Picture: </td><td><input type=text name=picture value=" + ::picture + "></td></tr>"
str += " <tr><td> </td></tr>\r\n"
str += " <tr><td align=right>Display Page Length: </td><td><input type=text name=pglen size=10 value=" + ::pgLen + "></td></tr>\r\n"
str += " <tr><td align=right>Refresh Rate: </td><td><input type=text name=refreshrate size=10 value=" + ::refreshRate + "></td></tr>\r\n"
// str += " <tr><td> </td></tr>"
// str += " <tr><td align=right>Last Used: </td><td>" + ::lastused + "</td></tr>"
str += " </table>\r\n"
str += " <br><input type=submit name=action value=\"Update User Information\">\r\n"
str += " <input type=submit name=action value=\"Do Not Update\">\r\n"
str += " <input type=hidden name=cmd value=\"UpdateUser\">\r\n"
str += " <input type=hidden name=id value=\"" + ::id + "\">\r\n"
str += " <input type=hidden name=channel value=\"" + channel + "\">\r\n"
str += " <INPUT TYPE=hidden NAME=alias VALUE=\"" + alias + "\">\r\n"
str += "</form>\r\n"
str += "<font size=2>This information will automatically be maintained<br>for up to thirty days of inactivity.<br></font>\r\n"
return( str )
END
METHOD doupdate( var, defval )
local v
v = ::session.var( var )
return( strempty( v ) ? defval : v )
END
METHOD UpdateId( )
local str, x, i, y
str = upper( ::userid + ::password )
i=1
x=1
for ( i=2; i<=len(str); i++ )
y = asc( str[i] )
if ( y > 0 )
x *= y
end
end
str = dec2hex( x )
if ( len( str ) > 8 )
str = right( str, 8 )
end
::id = str
return( ::id )
END
METHOD SessionUpdate( )
local str
::userid = ::doupdate( "userid", ::userid )
::password = ::doupdate( "pass", ::password )
::name = ::doupdate( "name", ::name )
::alias = ::doupdate( "alias", ::alias )
::email = ::doupdate( "email", ::email )
::picture = ::doupdate( "picture", ::picture )
::pglen = 0 + ::doupdate( "pglen", ::pglen )
::refreshRate = 0 + ::doupdate( "refreshRate", ::refreshRate )
::id = ::updateId( )
str = ::validate( )
if ( ! strempty( str ) )
return( str )
end
::pglen = ::pglen < 5 ? 5 : ::pglen
::refreshRate = ::refreshRate < 5 ? 5 : ::refreshRate
::save( )
return( "" )
END
METHOD validate( )
local str
str = ""
if ( strempty( ::userid ) )
str += "Must specify a User-id<br>"
end
if ( strempty( ::password ) )
str += "Must specify a Password<br>"
end
if ( strempty( ::name ) )
str += "Must specify a Name<br>"
end
if ( strempty( ::alias ) )
str += "Must specify an Alias<br>"
end
if ( strempty( ::email ) )
str += "Must specify an Email Address<br>"
end
if ( ! strempty( str ) )
return( "<h2>" + str + "</h2>Press the BACK button to return to the form..." )
end
return( "" )
END
END
_apGenerate( )
session = new( "session", param( 1 ), param( 2 ) )
user = new( "ChatUser", session, webServerHome( session.websrvr ) + "\\chat" )
channel = 0 + session.var( "channel" )
if ( channel < 1 )
channel = 1
end
alias = session.var( "alias" )
id = session.var( "id" )
if ( strempty( id ) || strempty( alias ) )
session._redir( "One Moment Please...", "sdchat.htm?channel=" + channel )
return( 0 )
end
qstr = "?id=" + id + "&channel=" + channel + "&alias=" + alias
]>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!-- SmartDesk Active Page, www.smartdesk.com -->
<HTML>
<HEAD>
<TITLE>WINC Users</TITLE>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#00FFFF" VLINK="#00FFFF" ALINK="#00FFFF">
<CENTER>
<FONT SIZE=5>U S E R L I S T</FONT><BR>
<A HREF="sdchat.htm<[! qstr ]>&cmd=ChatText" TARGET="winc_bottom">Return to the chat</A>
<P><BR></P>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=571 VSPACE=0>
<TR>
<TD WIDTH=300 VALIGN=top>
<[
basedir = webServerHome( session.websrvr ) + "\\chat"
filename = basedir + "\\chan" + channel + ".dat"
data = sessionDataGet( session.websrvr, -1, "CHATBUF." + filename )
cnt = chrcount( chr( 2 ), data )
j=0
users[1] = ""
for ( i=1; i<=cnt; i++ )
line = strextract( data, chr( 2 ), i )
id = strextract( line, chr( 1 ), 5 )
for ( k=1; k<=j; k++ )
if ( users[k] == id )
break
end
end
if ( k > j )
j++
users[j] = id
if ( user.load( id, 0 ) )
! "<A HREF=\"mailto:" + user.email + "\">" + user.name + "</A> is logged in as <FONT COLOR=yellow><B>" + user.alias + "</B></FONT><BR>"
end
end
end
]>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>