<!--#include file="./base.inc"-->
<%
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4

Const rblPageSize = 10

Dim conn

Open_Conn(sPath)

If Request("Page") > "" Then
   PageNo = Request("Page")
   PageNo = PageNo + 0
Else
   PageNo = 1
End If


sql = "select A.* from User A"
xC = Request.Form("_c")
If xC > "" Then
   xV = Request.Form("_v")
   xO1 = Request.Form("_o")
   xO2 = "'"
   If xO1 = "l1" then
	xO1 = "like '%"
	xO2 = "%'"
   End If
   If xO1 = "l2" then
	xO1 = "like '"
	xO2 = "%'"
   End If
   sql = sql & " Where A." & xC & " " & xO1 & xV & xO2
End If

Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open sql, Conn, adOpenKeyset,adLockReadOnly 
RS.PageSize = rblPageSize            ' Number of rows per page

If RS.recordcount > 0 Then
  RS.AbsolutePage = PageNo
End If
%>
<HTML>
<HEAD><TITLE>Liste des Utilisateurs</TITLE>
</HEAD>
<BODY BGCOLOR=FFFFFF>
<HR>
<DIV class="std">
<TABLE WIDTH="100%" class="tool1"><TR><TD ALIGN=LEFT><B>Page <%=PageNo%> / <%=RS.PageCount%></B></TD>
          <TD><% xP = RS.PageCount
                 if xP > 1 Then
		    Response.write "Page : "
		    If PageNo > 1 Then
		      iP = PageNo - 1
		      Response.write "<A HREF=""./user_liste.asp?id=" & uId & "&page=" & iP & """>Prev.</A>, "
                    End If
                    iP = 0
                    Do While xP > iP
                       iP = iP + 1
		       If iP = PageNo Then
			  Response.write iP & ", "
                       Else
			  Response.write "<A HREF=""./user_liste.asp?id=" & uId & "&page=" & iP & """>" & iP & "</A>, "
		       End If
	            Loop
		    iP = PageNo + 1
		    If PageNo < xP Then
		      Response.write "<A HREF=""./user_liste.asp?id=" & uId & "&page=" & iP & """>Next</A>"
		    End If
                 End If
	      %>
          </TD>
           <TD ALIGN=RIGHT><A HREF="./add_user.asp">Add User</A></TD>
</TR></TABLE>


<P>
<FORM METHOD=POST ACTION="./user_liste.asp">
	<TABLE><TR>
	<TD><SELECT NAME="_c">              
		<OPTION VALUE="sNom" SELECTED>Nom
		<OPTION VALUE="sPrenom">Prenom
		<OPTION VALUE="sSite">Site
		<OPTION VALUE="sMail">Adresse Mail
		<OPTION VALUE="sURL">Adresse URL
	</SELECT>
	<SELECT NAME="_o">              
		<OPTION VALUE="l1">Contien
		<OPTION VALUE="l2">Commence par
		<OPTION VALUE="like '%">Se termine par
		<OPTION VALUE="= '">Egal
		<OPTION VALUE="< '">Inferieur
		<OPTION VALUE="> '">Superieur
		<OPTION VALUE="not = '">Different
	</SELECT>
	</TD>
	<TD><INPUT TYPE=TEXT NAME="_v" SIZE=20 VALUE=""></TD>
        <TD><INPUT TYPE=SUBMIT VALUE="Chercher"></TD>
	</TR></TABLE>
</FORM>
	<TABLE WIDTH="90%" class="std">
	<% 
	RowCount = rs.PageSize
	Do While Not RS.EOF and rowcount > 0 
	%>
	<TR BGCOLOR=1010FF>
	<TD><A class="tool3" HREF="<% =RS("sURL") %>"><% =RS("sSite") %></A></TD>
	<TD ALIGN=RIGHT class="tool3"><% If RS("sMail") > "" Then 
		Response.Write "<A class=""tool3"" HREF=""mailto:" & RS("sMail") & """>" & RS("sNom") & "," & RS("sPrenom") & "</A>"
               Else
		Response.Write RS("sNom") & "," & RS("sPrenom") 
               End If %>
        </TD></TR>
        <TR>
            <TD><A HREF="./mess_liste.asp?id=<% =RS("idUser") %>">See</A> or 
      	        <A HREF="./add_liste.asp?id=<% =RS("idUser") %>">Add</A> GuestBook messages
            </TD>
            <TD ALIGN=RIGHT><% =RS("dDtCreat")%></TD></TR>
	<TR><TD COLSPAN=2><% =RS(7) %><BR>
                          <B>URL : </B><A HREF="<% =RS("sURL") %>"><% =RS("sURL") %></A>
            </TD></TR>
	<%
	RowCount = RowCount - 1
	RS.MoveNext
	Loop
	%>
	</TABLE>
	<P>
	<%

Conn.Close
set rs = nothing
set Conn = nothing
%>
</TABLE>
<P><P>
</DIV>
</BODY>
</HTML>
<%
Function Open_Conn(sBase)
	Set conn = Server.CreateObject("ADODB.Connection")
	conn.open sBase,"",""
End Function
%>