hossein_asp
کاربر تازه وارد
چطوري ميشه با asp (البته دریم ویور ) اعضای حاضر در سایت را نمایش داد
برای این سایت می خوام سایت من http://www.persianprogramers.somee.com
برای این سایت می خوام سایت من http://www.persianprogramers.somee.com
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Application("intActiveUserNumber") = 0
End Sub
Sub Session_OnStart
Session.Timeout = 20
Application.Lock
Application("intActiveUserNumber") = Application("intActiveUserNumber") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("intActiveUserNumber") = Application("intActiveUserNumber") - 1
Application.UnLock
End Sub
</SCRIPT>
Response.Write Application("intActiveUserNumber")
Online Users <strong><%Response.Write Application("intActiveUserNumber") %> Users</strong>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
'The code in this section is for when the server starts or the first user uses your site
'any variables in the Application_OnStart will remain till the server is stopped or the server is rebooted
Sub Application_OnStart
'Create an ActiveUsersNumber variable with Application scope and set it to 0
Application("intActiveUserNumber") = 0
End Sub
'The code in this section is for when a user connects to any page in your web site
Sub Session_OnStart
'The session timeout is how long a session (user connection) to your web site will last. The defualt is 20 minutes
'When you call a web page a connection is made when the page is finshed downloading the connection is dropped
'if the session time out is set two low you wont register active users while they are reading a page
'if you set it two high you will still register users as active after they have left your site
'It is pobally best to leave at the defualt 20 minutes so that it dosent effect any other session variables used in your web site
Session.Timeout = 30
'The appilcation must be locked so that only one user can increment the Application ActiveUserNumber variable at a time
Application.Lock
'The Application ActiveUserNumber variable is incremented by 1
Application("intActiveUserNumber") = Application("intActiveUserNumber") + 1
'The application is now unlocked
Application.UnLock
End Sub
'The code in this section is for when a user leaves yoursite or the session times out which ever comes first.
'Usally with HTTP access the server can not tell when a user has left the site so will wait for the session to time out
Sub Session_OnEnd
'The appilcation must be locked so that only one user can decrement the Application ActiveUserNumber variable at a time
Application.Lock
'The Application ActiveUserNumber variable is decremented by 1
Application("intActiveUserNumber") = Application("intActiveUserNumber") - 1
'The application is now unlocked
Application.UnLock
End Sub
</SCRIPT>