Foros del Web » Programando para Internet » ASP Clásico »

Quien lo ha conseguido??

Estas en el tema de Quien lo ha conseguido?? en el foro de ASP Clásico en Foros del Web. Hay alguien que halla logrado mostrar: Numero de Usuarios en la Web Numero de Miembros Navegando Nombre de Miembros Navegando Numero de Invitados Navegando Llevo ...
  #1 (permalink)  
Antiguo 02/02/2005, 06:55
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
Quien lo ha conseguido??

Hay alguien que halla logrado mostrar:
Numero de Usuarios en la Web
Numero de Miembros Navegando
Nombre de Miembros Navegando
Numero de Invitados Navegando

Llevo muchos dias dandole vueltas al global.asa, sub session_onEnd() no se dispara cuando deberia, probe intentando usar Response.IsClientConnected ,pero nada de nada.

Si alguien dispone de un codigo que funcione y no le importe compartirlo sera bien recibido.
Gracias de antemano
  #2 (permalink)  
Antiguo 02/02/2005, 07:49
Avatar de kunndry  
Fecha de Ingreso: abril-2004
Ubicación: Alicante / España
Mensajes: 247
Antigüedad: 20 años, 2 meses
Puntos: 0
Fichero global.asa
Cita:
<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>
Fichero online.asp
Cita:
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Active User's Hit Counter</title>

<!-- The Web Wiz Guide active user counter is written by Bruce Corkhill ©2001
If you want your own hit counter then goto http://www.webwizguide.info -->


</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center">
<h1>Active User Counter</h1>
<br>
<table width="102" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" height="43">
<tr>
<td align="center">
<%
'Dimension variables
Dim intDisplayDigitsLoopCount 'Loop counter to diplay the graphical hit count


'Error handler
On Error Resume Next


'HTML output to display the visitor number
Response.Write " <font size=2>Active User's</font><br>"

'Loop to display grapical digits
For intDisplayDigitsLoopCount = 1 to Len(Application("intActiveUserNumber"))

'Display the graphical active user hit count by getting the path to the image using the mid function
Response.Write "<img src=""counter_images/" & Mid(Application("intActiveUserNumber"), intDisplayDigitsLoopCount, 1) & ".gif"">"
Next


'Alternative to display text output instead
'Response.Write Application("intActiveUserNumber")

%>
</td>
</tr>
</table>
<p>This active user counter will only increment when a new user comes to the site (not
by hitting refresh)<br>
The active user counter will decrement when a user leaves the site or the
session times out (defualt 20 minutes)<br>
<br>
<a href="http://www.webwizguide.info" target="_top"><img src="web_wiz_guide.gif" width="100" height="30" border="0" alt="Web Wiz Guide"></a>
</p>
</div>
</body>
</html>
Tal cual esta el codigo tendras que crear una carpeta llamada counter_images y pone los archivos 0.gif 1.gif....... para cada numero, pero vamos, sustituir eso por un simple numero no es dificil.

Es un script que me baje de alguna página, te puede servir como ayuda, o eso espero, un saludo
  #3 (permalink)  
Antiguo 02/02/2005, 08:39
Avatar de Muzztein  
Fecha de Ingreso: agosto-2002
Ubicación: Hangar 18
Mensajes: 1.703
Antigüedad: 21 años, 9 meses
Puntos: 16
eso iba a decir.
por lo que aprendi la semana pasada, esas cosas se hacen con el global asa.
y lo aprendi en este mismo forito

  #4 (permalink)  
Antiguo 02/02/2005, 09:54
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
kunndry muchas gracias, pero el codigo que yo uso es similar al que tu me has proporcionado y no funciona bien porque si el usuario no finaliza la session expresamente, es decir va a una página que contiene Session.Abandon, el global.asa no detecta que la sesion ha finalizado en
sub session_onEnd() hasta que no se alcanza el valor de session.timeout (20 minutos por defecto). Esto no es algo que yo me este inventando, ni que sean supociciones mias, en la web hay muchos de articulos que hacen referencia a esto como por ejemplo:
http://www.aspfaq.com/show.asp?id=2078

Muzztein ya se que tu aprendiste eso la semana pasada, que esas cosas se hacen con el global asa. y que lo aprendiste en este mismo forito.
http://www.forosdelweb.com/f15/global-asa-ha-dejado-funcionar-264838/
Yo mismo te explique que era el global.asa

Bueno, si alguien tiene algo mas con respecto a este tema gracias.
  #5 (permalink)  
Antiguo 02/02/2005, 10:52
Avatar de AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 3 meses
Puntos: 535
Hola sqa212, no entiendo si lo que te ocurre es que no te funciona bien porque los clientes siguen apareciendo como activos durante 20 minutos aunque se hayan ido del sitio sin cerrar sesión mediante session.abandon o porque, como dice el artículo de aspfaq.com haciendo referencia a un BUG -que desconocía-, "If they leave your site in any other way, the session data will be stored forever", la sesión jamás finaliza (o sea que perdura mucho más de 20 minutos)?
__________________
...___...
  #6 (permalink)  
Antiguo 02/02/2005, 15:57
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
bueno Al Zuwaga (A pa nick ) y si eso pasa ¿existe alguna forma de matar las sessiones que no esten activas?

es decir, se puede saber cuales sesiones realmente estan activas por que el usuario sigue navegando y cuales siguen activas por que no se cerraron ¿se puede saber?
__________________
CreandoWebs.com
www.creandowebs.com
PLANTILLAS TEMPLATEMONSTER CON 10% DE DESCUENTO
  #7 (permalink)  
Antiguo 02/02/2005, 16:38
 
Fecha de Ingreso: enero-2004
Ubicación: Chihuahua, México
Mensajes: 146
Antigüedad: 20 años, 5 meses
Puntos: 0
a ver si te sirve esto...

usuarios en línea
__________________
¡Que todo sea para bien del hombre!
www.dechihuahua.com
Comunidad Chihuahuense
----------- (50%)
Sólo hasta que el Hombre siente la energía universal, sabe de lo que está hecho.
  #8 (permalink)  
Antiguo 03/02/2005, 02:39
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
terraqueotenaz, estoy probando lo que me has dicho, por ahora creo que funciona correctamente,
pero voy a seguir haciendo pruebas.
Por ahora he visto algo que pienso se podria modificar:
En el archivo online.asp esta:
<!--#include file="../global.asa"-->
Yo creo que esto se podria suprimir ya que global.asa se inicia sin necesidad de include
  #9 (permalink)  
Antiguo 03/02/2005, 05:28
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
He visto lo siguiente:
si estas registrado y vas a logintrack.asp te muestra:
http://dominio.com/login.asp?error=3
y aparece un mensaje que dice:
Sorry This User is already logged in ( O sea que ese usuario ya esta registrado).

Si terminas la sesion con el boton logout y vas a logintrack.asp te muestra:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/logintrack.asp, line 55


¿Para que sirve logintrack.asp?
¿A que se debe este error?
¿Sabeis si hay diferencia en el uso de sessiones o application dependiendo de
si te conectas a la web con un mac o un pc?


De todas formas, terraqueotenaz Gracias de nuevo por el link, esta bastante bien
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:39.