% @LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Response.Buffer = True
On Error Resume Next
%>
<%
Dim strConnect, objConn, RS
Dim i, counter
Dim lang, topic, country, theme
Dim country_ids(200), countries(200), people(50), languages(50), topics(50)
Dim name, nationality, email, school
%>
<%
If (request.form("lang")<>"") Then lang=trim(request.form("lang")) Else lang="" End If
If (request.form("topic")<>"") Then topic=trim(request.form("topic")) Else topic="" End If
If (request.form("country")<>"") Then country=trim(request.form("country")) Else country="" End If
%>
<%
''Open Connection
strConnect="DSN=csb;UID=web;PWD=!prod1"
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.open strConnect
%>
<%
If lang<>"" Then
theme = lang
ElseIf topic<>"" Then
theme = topic
ElseIf country<>"" Then
theme = getCountryName(country)
End If
%>
Tu as choisis <%=theme%>
Les experts de <%=theme%> sont:
<%
If lang<>"" Then
Set RS=objConn.execute("SELECT DISTINCT id FROM mun_languages WHERE Languages='"&lang&"' ")
i=0
while not RS.eof
people(i)=RS(0)
people(i+1)=0
i=i+1
RS.movenext
wend
RS.close
Set RS = nothing
i=0
while people(i)<>0
getBrief people(i)
i=i+1
wend
ElseIf topic<>"" Then
Set RS=objConn.execute("SELECT DISTINCT id FROM mun_topics WHERE topic='"&topic&"' ")
i=0
while not RS.eof
people(i)=RS(0)
people(i+1)=0
i=i+1
RS.movenext
wend
RS.close
Set RS = nothing
i=0
while people(i)<>0
getBrief people(i)
i=i+1
wend
ElseIf country<>"" Then
Set RS=objConn.execute("SELECT DISTINCT id FROM mun_countries WHERE country_id='"&country&"' ")
i=0
while not RS.eof
people(i)=RS(0)
people(i+1)=0
i=i+1
RS.movenext
wend
RS.close
Set RS = nothing
i=0
while people(i)<>0
getBrief people(i)
i=i+1
wend
End If
%>
<%
''Close Connection
objConn.close
set objConn = Nothing
%>
<%
Function getBrief(id)
Set RS=objConn.execute("SELECT * FROM mun_people WHERE id='"&id&"' ")
name=RS(1)
nationality=RS(2)
email=RS(3)
school=RS(4)
Set RS=objConn.execute("SELECT Languages FROM mun_languages WHERE id='"&id&"' ")
counter=0
while not RS.eof
languages(counter) = RS(0)
languages(counter+1) = ""
counter=counter+1
RS.movenext
wend
RS.close
Set RS = nothing
Set RS=objConn.execute("SELECT topic FROM mun_topics WHERE id='"&id&"' ")
counter=0
while not RS.eof
topics(counter) = RS(0)
topics(counter+1) = ""
counter=counter+1
RS.movenext
wend
RS.close
Set RS = nothing
%>
<%
response.write ""& name &"" & vbcr
%>
<%
End Function
%>
<%
Function getCountryName(id)
Set RS=objConn.execute("SELECT fullname FROM stats_main WHERE id="&id&"")
getCountryName = RS(0)
RS.movenext
RS.close
Set RS = nothing
End Function
%>