%
If request.cookies("betterthinking") <> "" Then
session("idUser") = request.cookies("betterthinking")
strConnString = "driver={SQL Server};server=sql7.globalgold.co.uk;uid=betterthinking;pwd=master-point;database=betterthinking"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
strSql = "SELECT * from users where idUser = " & request.cookies("betterthinking")
'response.write("erm:" & strSql)
set new_rs = my_Conn.Execute(strSql)
If Not new_rs.eof then
name = new_rs("name")
varchar_email = new_rs("email")
varchar_town = new_rs("location")
new_rs.close
End if
End if
%>
<%
id_forum_topics = request("id_forum_topics")
strConnString = "driver={SQL Server};server=sql7.globalgold.co.uk;uid=betterthinking;pwd=master-point;database=betterthinking"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
If request("display_order") <> "" Then
display_order = request("display_order")
Else
display_order=0
End if
'response.write("test:"&display_order)
strSql = "SELECT * from forum_topics where idforum_topic=" & id_forum_topics
set rs = my_Conn.Execute (strSql)
id_forum_topic = rs("idforum_topic")
title_graphic_root = rs("title_graphic_root")
title_graphic_main = rs("title_graphic_main")
add_comment = rs("add_comment")
topic_summary = rs("topic_summary")
topic_brief = rs("topic_brief")
binary_display = rs("binary_display")
%>
<%
Select Case display_order
Case 0
strSql = "SELECT * from forum_posts where binary_display=1 and id_forum_topics = " & id_forum_topics & "order by datetime_date desc"
Case 1
strSql = "SELECT * from forum_posts where binary_display=1 and id_forum_topics = " & id_forum_topics & " order by int_votes desc"
Case 2
strSql = "SELECT * from forum_posts where binary_display=1 and id_forum_topics = " & id_forum_topics & " order by int_votes_neg desc"
End Select
'response.write("test:"&strsql)
'strSql = "SELECT * from forum_posts where binary_display=1 and id_forum_topics = " & id_forum_topics & " order by datetime_date desc"
set rs = my_Conn.Execute (strSql)
%>
<%
Do Until rs.eof
id_forum_posts = rs("idforumposts")
varchar_post = rs("varchar_post")
varchar_subject = rs("varchar_subject")
datetime_date = rs("datetime_date")
int_votes = rs("int_votes")
int_neg_votes = rs("int_votes_neg")
idUser = rs("idUser")
'date_obj = split(FormatDateTime(datetime_date,1))
'comment_month = date_obj(1)
'comment_day = Replace(date_obj(2), ",", "")
'Select Case comment_day
' Case 1, 31
' comment_day = comment_day & "st"
'Case 2, 22
' comment_day = comment_day & "nd"
'Case 3
' comment_day = comment_day & "rd"
'Case Else
' comment_day = comment_day & "th"
'end Select
'time_obj = Split(FormatDateTime(datetime_date,3),":")
'am_pm = Split(time_obj(2), " ")
'comment_time = time_obj(0) & ":" & time_obj(1) & LCase(am_pm(1))
strSql = "SELECT * from users where idUser = " & idUser
'response.write(strSql)
'response.end
set new_rs = my_Conn.Execute(strSql)
varchar_name = new_rs("name")
varchar_email = new_rs("email")
varchar_town = new_rs("location")
new_rs.close
varchar_name = Split(varchar_name, " ")
%>
<%
rs.movenext
loop
%>
<%=varchar_subject%>
<%=varchar_post%>
<%=varchar_name(0)%>, <%=varchar_town%>, <%=FormatDateTime(datetime_date,1)%>
<%=int_votes%> agree <%=int_neg_votes%> disagree Agree Disagree