Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
active user's name Posted by aytac2 on 7 Jan 2003 at 4:21 AM
hi
i need to know the active user's name by using the codes below
but i can not collect names to a plece
could you tell how i can make this

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("Active") = 0
Application("Kimler")=0
End Sub

Sub Application_OnEnd
'nothing needed here for this example
End Sub

Sub Session_OnStart
Session.Timeout = 1
Session("Start") = Now
Application.lock
Application("Active") = Application("Active") + 1
Application("Kimler") = Application("Kimler") + ??
'add 1 to active visitor count when new visitor arrives
Application.unlock
End Sub

Sub Session_OnEnd
Application.lock
Application("Active") = Application("Active") - 1
Application("Kimler") = Application("Kimler")-???
'subtract 1 active visitor when visitor leaves
Application.unlock
End Sub

</SCRIPT>
Report
Re: active user's name Posted by haxme on 7 Jan 2003 at 12:48 PM
: hi
: i need to know the active user's name by using the codes below
: but i can not collect names to a plece
: could you tell how i can make this
:
: <SCRIPT LANGUAGE=VBScript RUNAT=Server>
: Sub Application_OnStart
: Application("Active") = 0
: Application("Kimler")=0
: End Sub
:
: Sub Application_OnEnd
: 'nothing needed here for this example
: End Sub
:
: Sub Session_OnStart
: Session.Timeout = 1
: Session("Start") = Now
: Application.lock
: Application("Active") = Application("Active") + 1
: Application("Kimler") = Application("Kimler") + ??
: 'add 1 to active visitor count when new visitor arrives
: Application.unlock
: End Sub
:
: Sub Session_OnEnd
: Application.lock
: Application("Active") = Application("Active") - 1
: Application("Kimler") = Application("Kimler")-???
: 'subtract 1 active visitor when visitor leaves
: Application.unlock
: End Sub
:
: </SCRIPT>
:
Whith this code You can't get the user's name!
You just get a count of active user's on Your site.
If the IIS is set properly - You have no way to get the user's name.
If it's not try this:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>ADSI Get user details</title>
</HEAD>
<BODY>

<%
sFullUser = trim(Request.ServerVariables ("LOGON_USER"))
if len(sFullUser) = 0 then
Response.Write "You need to disable anonymous access for this code to work."
Response.End
End if
response.write sFullUser
iPos = InStr(sFullUser, "\")
sDomain = Left(sFullUser, iPos - 1)
sUser = Mid(sFullUser, iPos + 1)

Set objUser = GetObject("WinNT://" & sDomain & "/" & sUser)
%>

<p>
Your account is <%=sFullUser%> and your name is <%=objUser.FullName%>
</p>
<%
set objUser = nothing
%>
</BODY>
</HTML>

/haxme





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.