%
Response.Buffer = True
dim Conn
OpenConn("karchbold.mdb")
dim setupClubName, setupStyles, setupCurrentSeason,setupClubMail,setupTrainingDay,setupTrainingTime,setupTableURL,setupTrainingPlace, setupUserName, setupPassword,setupHome
dim setupShowLastGame,setupShowNextGame,setupShowTraining,setupShowMatch,setupShowFootBallNews, setupPlayersAmount, setupTactics,setupStatistic
dim RSa, SQLa
set RSa = server.createobject("ADODB.recordset")
SQLa = "SELECT * FROM setup"
RSa.Open SQLa,conn
if not RSa.eof then
setupClubName = RSa("setupClubName")
setupStyles = RSa("setupStyles")
setupCurrentSeason = RSa("setupCurrentSeason")
setupClubMail = RSa("setupClubMail")
setupTrainingDay = RSa("setupTrainingDay")
setupTrainingTime = RSa("setupTrainingTime")
setupTrainingPlace = RSa("setupTrainingPlace")
setupTableURL = RSa("setupTableURL")
setupHome = RSa("setupHome")
setupShowLastGame = RSa("setupShowLastGame")
setupShowNextGame = RSa("setupShowNextGame")
setupShowTraining = RSa("setupShowTraining")
setupShowMatch = RSa("setupShowMatch")
setupShowFootBallNews = RSa("setupShowFootBallNews")
setupPlayersAmount = 10
setupTactics = RSa("setupTactics") '1-3-3'
setupStatistic = RSa("setupStatistic")
end if
RSa.close
set RSa = nothing
setupUserName = "Danmark"
setupPassword = "Danmark"
function getDayName(dayno)
dim result
select case dayno
case 1
result = "søndag"
case 2
result = "mandag"
case 3
result = "tirsdag"
case 4
result = "onsdag"
case 5
result = "torsdag"
case 6
result = "fredag"
case 7
result = "lørdag"
end select
getDayName = result
end function
function getPreviousMatches(opponent,maxdate)
dim RS, SQL, result
result=""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM Kampe WHERE Modstander LIKE '"&opponent&"' AND clng(dato) < "&clng(maxdate) & " ORDER BY dato DESC"
RS.Open SQL,Conn
if not RS.eof then
do until rs.eof
if RS("hjemmehold") = "True" then
result = result & setupClubName &" - " & RS("modstander") & " " & RS("klubscore") & "-" & RS("modstanderscore")& " (" & right(rs("dato"),2) &"/" & mid(RS("dato"),5,2) &"-" & left(RS("dato"),4) & ") "
else
result = result & RS("modstander") & " - "& setupClubName & " " & RS("modstanderscore") & "-" & RS("klubscore")& " (" & right(rs("dato"),2) &"/" & mid(RS("dato"),5,2) &"-" & left(RS("dato"),4) & ") "
end if
rs.movenext
loop
end if
RS.close
set RS=nothing
getPreviousMatches = result
end function
function getSeasonName(saesonid)
dim result, RS, SQL
result = ""
if saesonid <> "" then
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM saeson WHERE saesonid =" &saesonid
RS.Open SQL,Conn
if not RS.eof then
result = RS("saesontitel")
else
result = "mangler"
end if
RS.close
set RS = nothing
end if
getSeasonName = result
end function
function getPlayerAge(playerid)
dim RS, SQL, result, date1, date2
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT foedt FROM spillere WHERE spillerid=" & playerid
RS.Open SQL,Conn
if rs("foedt")>2000 then
result = year(now) - left(RS("foedt"),4)
if month(now) < cint(mid(RS("foedt"),5,2)) then
result = result -1
end if
if month(now) = cint(mid(RS("foedt"),5,2)) and day(now) < cint(right(RS("foedt"),2)) then
result = result -1
end if
else
result = year(now)- rs("foedt")
end if
RS.close
set RS = nothing
getPlayerAge = result
end function
function getGoalCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as goalcount FROM maal WHERE spillerid =" & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("goalcount")
RS.close
set RS = nothing
getGoalCount = result
end function
function getAssistCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as assistcount FROM maal WHERE assistspillerid =" & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("assistcount")
RS.close
set RS = nothing
getAssistCount = result
end function
function getTodaysDate()
dim today, lmonth, lday, lastplayed
lmonth = month(now)
if lmonth < 10 then
lmonth = "0" & lmonth
end if
lday = day(now)
if lday < 10 then
lday = "0" & lday
end if
getTodaysDate = year(now) & lmonth & lday
end function
function splitDate(ldate)
if len(ldate) > 4 then
splitDate = cdate(cint(right(ldate,2)) & "/" & cint(mid(ldate,5,2)) & "/" & cint(left(ldate,4)))
else
splitDate = ldate
end if
end function
function writeDate(ldate)
if len(ldate) > 4 then
writeDate = cint(right(ldate,2)) & "/" & cint(mid(ldate,5,2)) & "-" & cint(left(ldate,4))
else
writeDate = ldate
end if
end function
function getMatchCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as matchcount FROM kampe WHERE clng(dato) <= " & getTodaysDate() & " AND (spiller1 = " & playerid & " OR spiller2 = " & playerid & " OR spiller3 = " & playerid & " OR spiller4 = " & playerid & " OR spiller5 = " & playerid & " OR spiller6 = " & playerid & " OR spiller7 = " & playerid & " OR spiller8 = " & playerid & " OR spiller9 = " & playerid & " OR spiller10 = " & playerid & ")"
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("matchcount")
RS.close
set RS = nothing
getMatchCount = result
end function
function getVictories(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as matchcount FROM kampe WHERE clng(dato) <= " & getTodaysDate() & " AND (spiller1 = " & playerid & " OR spiller2 = " & playerid & " OR spiller3 = " & playerid & " OR spiller4 = " & playerid & " OR spiller5 = " & playerid & " OR spiller6 = " & playerid & " OR spiller7 = " & playerid & " OR spiller8 = " & playerid & " OR spiller9 = " & playerid & " OR spiller10 = " & playerid & ") AND VUT = 'V'"
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("matchcount")
RS.close
set RS = nothing
getVictories = result
end function
function getMomCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as momcount FROM kampe WHERE mom = " & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("momcount")
RS.close
set RS = nothing
getMomCount = result
end function
function getDomCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as domcount FROM kampe WHERE dom = " & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("domcount")
RS.close
set RS = nothing
getDomCount = result
end function
function getRefCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as refcount FROM kampe WHERE referant = " & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("refcount")
RS.close
set RS = nothing
getRefCount = result
end function
function getVaskCount(playerid, saesonid)
dim RS, SQL, result
result = 0
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT count(*) as vaskcount FROM kampe WHERE vask = " & playerid
if saesonid <> "" then
SQL = SQL & " AND saesonid =" & saesonid
end if
RS.Open SQL,Conn,2,3
result = rs("vaskcount")
RS.close
set RS = nothing
getVaskCount = result
end function
function getGoalScorers(matchID)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM maal WHERE kampid=" & matchID
RS.Open SQL,Conn
if not RS.eof then
do until RS.EOF
result = result & getPlayerName(RS("spillerid")) & ", "
RS.MoveNext
loop
end if
RS.close
set RS = nothing
if len(result) > 2 then
response.write left(result,len(result)-2)
else
response.write result
end if
end function
function getAssists(matchID)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM maal WHERE kampid=" & matchID
RS.Open SQL,Conn
if not RS.eof then
do until RS.EOF
result = result & getPlayerName(RS("assistspillerid")) & ", "
RS.MoveNext
loop
end if
RS.close
set RS = nothing
if len(result) > 2 then
response.write left(result,len(result)-2)
else
response.write result
end if
end function
function editGoalScorers(matchID)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM maal WHERE kampid=" & matchID
RS.Open SQL,Conn
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
response.write result
end function
function getPlayerName(playerid)
dim result, RS, SQL
if playerid <> "" then
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM spillere WHERE spillerid=" & playerid
RS.Open SQL,Conn
if not RS.eof then
result = RS("fornavn") & " " & RS("efternavn")
else
result = "??"
end if
RS.close
set RS = nothing
else
result = "??"
end if
getPlayerName = result
end function
function getPlayerPic(playerid)
dim result, RS, SQL
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM spillere WHERE spillerid=" & playerid
RS.Open SQL,Conn
if not RS.eof then
result = RS("billede")
else
result = 0
end if
RS.close
set RS = nothing
getPlayerPic = result
end function
function getPlayersInOptions(lselected)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM spillere WHERE aktiv = true ORDER BY fornavn"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
response.write result
end function
function getOpponentsInOptions(lname)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM Modstandere ORDER BY modstandernavn"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
response.write result
end function
function getOpponentIntro(lname)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM Modstandere WHERE modstandernavn = '"& lname & "'"
RS.Open SQL,Conn
if not RS.eof then
result = RS("modstanderintro")
end if
RS.close
set RS = nothing
getOpponentIntro = result
end function
function getOpponentInfo(lname)
dim result, RS, SQL
result = "Klubben har ikke noteret noget info på denne modstander!"
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM Modstandere WHERE modstandernavn = '"& lname & "'"
RS.Open SQL,Conn
if not RS.eof then
result = RS("modstanderinfo")
end if
RS.close
set RS = nothing
getOpponentInfo = result
end function
function getSeasonsInOptions(lselected)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM saeson ORDER BY saesontitel"
RS.Open SQL,Conn
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
response.write result
end function
function getSeasonID(lmatchid)
dim result, RS, SQL
result = ""
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT saesonID FROM kampe WHERE kampid = "& lmatchid
RS.Open SQL,Conn
if not rs.eof then
result = rs("saesonID")
end if
RS.close
set RS = nothing
getSeasonID = result
end function
sub deleteOldTraining(newdate)
dim RS, SQL
set RS = server.createobject("ADODB.recordset")
SQL = "DELETE * FROM traening WHERE traeningsdato < " & newdate
RS.Open SQL,Conn,2,3
set RS = nothing
end sub
sub setPlayersTrainingState()
dim RS, SQL
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT *FROM spillere"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
RS("traener") = false
RS("traenerikke") = false
RS.update
RS.MoveNext
loop
end if
RS.close
set RS = nothing
end sub
function getTrainingPlayers()
dim RS, SQL, result
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT *FROM spillere WHERE aktiv = true AND traener = true ORDER BY fornavn"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
getTrainingPlayers = result
end function
function getNotTrainingPlayers()
dim RS, SQL, result
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT *FROM spillere WHERE aktiv = true AND traenerikke = true ORDER BY fornavn"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
getNotTrainingPlayers = result
end function
function getTheRest()
dim RS, SQL, result
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT *FROM spillere WHERE aktiv = true AND traener = false AND traenerikke = false ORDER BY fornavn"
RS.Open SQL,Conn,2,3
if not RS.eof then
do until RS.EOF
result = result & ""
RS.MoveNext
loop
end if
RS.close
set RS = nothing
getTheRest = result
end function
function getNextTrainingDay(dayno)
dim result, currentday, currentdate, trainingday
trainingday = cint(dayno)
currentdate = Date()
currentday = cint(DatePart("w", currentdate))
if currentDay = trainingday then
result = currentdate
else
if currentday < trainingday then
result = dateAdd("d", trainingday - currentday, currentdate)
end if
if currentday > trainingday then
result = dateAdd("d", trainingday - currentday + 7 , currentdate)
end if
end if
getNextTrainingDay = result
end function
function saveFileInMediaDB(lfilename)
dim RS, SQL
set RS = server.createobject("ADODB.recordset")
SQL = "SELECT * FROM medier"
RS.Open SQL,Conn,2,3
rs.addnew
rs("medienavn") = lfilename
rs.update
RS.close
set RS = nothing
saveFileInMediaDB = "Billedet er gemt i databasen "
end function
function Old_OpenConn( DBName )
dim ODBCpath, whereareyou
Set Conn = Server.CreateObject("ADODB.Connection")
whereareyou = instrrev(request.servervariables("PATH_TRANSLATED"), "\hybris")
response.write request.servervariables("PATH_TRANSLATED") & " "
if whereareyou = 0 then whereareyou = instrrev(request.servervariables("PATH_TRANSLATED"), "\")
ODBCpath = left(request.servervariables("PATH_TRANSLATED"), whereareyou) & "hybris\db\"
response.write ODBCpath
'Conn.Open "DBQ=" & ODBCpath & DBName & ";DefaultDir=" & ODBCpath & ";Driver={Microsoft Access Driver (*.mdb)}"
end function
function OpenConn( DBName )
dim ODBCpath, isbackend
Set Conn = Server.CreateObject("ADODB.Connection")
'ODBCpath = left(request.servervariables("PATH_TRANSLATED"), instrrev(request.servervariables("PATH_TRANSLATED"), "\"))
'ODBCpath = left(request.servervariables("PATH_TRANSLATED"),instr(request.servervariables("PATH_TRANSLATED"),"wwwroot")-1)
ODBCpath = left(request.servervariables("PATH_TRANSLATED"),instr(request.servervariables("PATH_TRANSLATED"),"public_html")-1)
isbackend = instrrev(ODBCpath, "\indtast")
if isbackend > 0 then
ODBCpath = left(ODBCpath,isbackend)
end if
'response.write ODBCpath
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ODBCpath & "db\" & DBName
end function
function CloseConn()
Conn.close
Set Conn = nothing
end function
%>