%@ Language=VBScript %>
<% Response.Buffer = True
set session("connection") = Server.CreateObject("ADODB.Connection")
session("connection").Open "Driver={mySQL}; Server=localhost; Port=3306; Option=0; Socket=; Stmt=; Database=themclub_org; Uid=umdmclub; Pwd=Sky3569far;"
Function CToDate(OrgDate)
Date1=CDate(OrgDate)
Date2=Year(Date1) & "-" & month(Date1)-1 & "-" & Day(Date1)
CToDate=Date2
End Function
If request.form ("sport_id") = "" then
SQL = "Select * from news where sport = '"& request.form("sport_id") &"' order by date_entered asc"
Set RsSearch = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsSearch.open SQL, session("connection")
active_selection = ""
'no query
else
If request.form("sport_id") = "All Sports" then
SQL = "Select * from news order by date_entered asc"
Set RsSearch = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsSearch.open SQL, session("connection")
active_selection = "All Sports"
else
SQL = "Select * from news where sport = '"& request.form("sport_id") &"' order by date_entered asc"
Set RsSearch = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsSearch.open SQL, session("connection")
active_selection = cint(request.form("sport_id"))
end if
end if
'response.write active_selection
Function CropSentence(strText, intLength, strCrop)
Dim intPosition 'As Integer
Dim intMaxLength 'As Integer
Dim strOutput 'As String
'Set the max length to be the desired length minus
'the length of the trailing characters.
intMaxLength = intLength
'Check if the max length is less than or equal to zero.
If intMaxLength <= 0 Then
'Return an empty string.
CropSentence = ""
'Check if the inputted text it is less that the desired length.
ElseIf Len(strText) <= intLength Then
'Return the inputted text
CropSentence = strText
'Crop the sentance
Else
'Remove the end of the text.
strOutput = Left(strText, intLength)
'Get the position of the last space in the text.
intPosition = InStrRev(strOutput, " ")
'Return the cropped sentance
CropSentence = Left(strOutput, intPosition - 1) & strCrop
End If
End Function
%>
<%SQL="Select * from sports where athletic = 1 order by sport asc"
Set RsSportsList = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsSportsList.open SQL, session("connection")
%>
<%If request.form("sport_id") <> "" then
SQL="Select sport from sports where sport_id = '"&request.form("sport_id")&"'"
Set RsSport = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsSport.open SQL, session("connection")%>
<%=RsSport("sport")%>
<%else%>
<%end if%>
<%If RsSearch.EOF then%>
<%If active_selection <> "" then %>
There are no news articles available at this
time.
<%else%>
<%end if%>
<%else
Do while not RsSearch.EOF
content=RsSearch("content")
SQL="Select * from news_administrators where administrator_id = '"&RsSearch("administrator_id")&"'"
Set RsAdmin = Server.CreateObject("ADODB.Recordset")
'response.write SQL
RsAdmin.open SQL, session("connection")%>