<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/PACIENTES.asp" -->
<%
      Public Function DoLog(arquivo,mensagem)
    
    Dim ObjFSO, ObjFile, ObjStream, Dia, Mes, Ano, Hora, IpNum
    
    Const forReading = 1, forWriting = 2, forAppending = 8
    Const TriDef = -2, TriTrue = -1, TriFalse = 0
    
    Set ObjFSO = CreateObject("Scripting.FileSystemObject")
     
       If ObjFSO.FileExists(arquivo) = False then
       
       objFSO.CreateTextFile(arquivo)
    
    End If
       Set ObjFile = objFSO.GetFile(arquivo)
       Set objStream = ObjFile.OpenAsTextStream(forAppending,TriDef)
       Dia = Day(Date())
       Mes = Month(Date())
       Ano = Year(Date())
       Hora = Time()
       IpNum = Request.ServerVariables("REMOTE_ADDR")
    
       ObjStream.WriteLine Dia & "-" & Mes & "-" & Ano & " | " & Hora & " | " & IpNum & " --> " & Mensagem
       ObjStream.close
        
    End Function
    
    DoLog "\log.txt","Entrada de Usuário"
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="logar.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_PACIENTES_STRING
Recordset1_cmd.CommandText = "SELECT * FROM usuariospaciente ORDER BY Id DESC" 
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_PACIENTES_STRING
Recordset2_cmd.CommandText = "SELECT * FROM usuarioadm" 
Recordset2_cmd.Prepared = true
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 5
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = 5
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last  = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (Recordset1_total = -1) Then
  ' count the total records by iterating through the recordset
  Recordset1_total=0
  While (Not Recordset1.EOF)
    Recordset1_total = Recordset1_total + 1
    Recordset1.MoveNext
  Wend
  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
    Recordset1.MoveFirst
  Else
    Recordset1.Requery
  End If
  ' set the number of rows displayed on this page
  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
End If
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>   Po se alguém conseguir me ajudar eu solto fogos! To no desespero com isso  :wacko: