<%
'**************************************************** CALCULA LOS SEGUNDOS VISITADOS *******************************************************
Hora_actual = Time
bOk = false
If Not(Session("Hora") > "") Then
Session("Hora") = Hora_actual
End If
bOk = true
Hora = hour(Hora_actual - Session("Hora"))
Minutos = minute(Hora_actual - Session("Hora"))
Segundos = second(Hora_actual - Session("Hora"))
Contador = 0
If Hora > 0 Then
Contador = Contador + (Hora * 3600)
End If
If Minutos > 0 Then
Contador = Contador + (Minutos * 60)
End If
If Segundos > 0 Then
Contador = Contador + Segundos
End If
Set Conn = Server.CreateObject("ADODB.Connection")
'Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=tutransformas.com;UID=tutransformas;PWD=ttidx4;DATABASE=tutransformas "
Conn.open "Provider=SQLOLEDB; Password=ttidx4;Initial Catalog=qcn64x;User ID=tutransformas;Data Source=localhost\DW0207\SQLEXPRESS,1433"
SQL_T = "select max(N_ID_TIEMPO)+1 from W_TIEMPO"
set rs_T = Conn.Execute(SQL_T)
N_ID = trim(rs_T(0))
SQL_I = "insert into W_TIEMPO (N_ID_TIEMPO,N_TIEMPO) values ("& N_ID & "," & Contador & ")"
set rs_I = Conn.Execute(SQL_I)
SQL = "select sum(N_TIEMPO) from W_TIEMPO"
set rs = Conn.Execute(SQL)
Tiempo = rs(0)
Ahorro = Round(Tiempo * 0.001,2)
S_Ahorro = "Avoided " & Ahorro & " grams of CO2"
Session("Hora") = Hora_actual
'*******************************************************************************************************************************************
%>
<%
If bOk Then
Conn.Close
End If
%>