برگزیده های پرشین تولز

نمایش حاضرین در سایت

M-r-r

کاربر تازه وارد
تاریخ عضویت
10 فوریه 2004
نوشته‌ها
383
لایک‌ها
1
سن
37
محل سکونت
in my clothes
چطور میشه با ASP حاضرین در سایت رو شمرد ؟
آیا میشه اطلاعات اونها رو مثه آدرس آی پی و . . . رو هم درآورد ؟
ممنونم.
 

artin

کاربر تازه وارد
تاریخ عضویت
19 می 2004
نوشته‌ها
2,114
لایک‌ها
2
سلام

اگه یه سرچ می کردی پیدا می کردی تو همین فروم

اگر بخوای همین جوری نشون بده با این برنامه می تونی واگر نه کارت سخت تر میش

ببین اگه این کاربتو راه ننداخت یکی دیگه ردیف کنم

یه فایل global.asa توی شاخه سایتت بساز و این رو بزار توش

کد:
<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 = 20

'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>

حالا هر جا از کدهات که خواستی تعداد یوزهای آنلاین رو نشون بده فقط این کد پایین رو می زاری و دیگه هیچ چیزه دیگه ای لازم نداری

کد:
Response.Write Application("intActiveUserNumber")

مثلا

کد:
Online Users <strong><%Response.Write Application("intActiveUserNumber") %> Users</strong>

این روی 20 دقیه تنظیم شده اگه خواستی زمان رو عوض کنی فقط تو فایل گلوبال زمان تایم اوت رو کم و زیاد کن

موفق باشی
 

M-r-r

کاربر تازه وارد
تاریخ عضویت
10 فوریه 2004
نوشته‌ها
383
لایک‌ها
1
سن
37
محل سکونت
in my clothes
ممنونم . اما جواب نداد . . . پیام خطا بهم میده . . .
 
بالا