Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/02/2005, 07:49
Avatar de kunndry
kunndry
 
Fecha de Ingreso: abril-2004
Ubicación: Alicante / España
Mensajes: 247
Antigüedad: 21 años, 1 mes
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