File: D:/HostingSpaces/RImmers/duitsedog.tk/wwwroot/includes/inc_onderhoud.asp
<%
Function CheckFotoRandomizer
dim strSQl, Rs, datMaxVisit, strMsg
On Error Resume Next
strSQL = "SELECT dat_laatste_fotoupdate as datum from dd_instellingen"
Set Rs = GetRs(strSQL)
datMaxVisit = DateSerial(Year(Rs("datum")),Month(Rs("datum")),Day(Rs("datum")))
txtLog "CheckFotoRandomizer MAX(datum)=" & datMaxVisit & " today=" & date
Rs.Close
If (datMaxVisit < date) Then
txtLog "CheckFotoRandomizer 1e dagbezoek pagina"
strSQL = "UPDATE dd_instellingen SET dat_laatste_fotoupdate = " & DateToSQL(date)
ExecSQL(strSQL)
' send dagstats
strMsg = getUniekeBezoekers(date-1,date)
txtLog "Send dag stats"
SendInfoMail "Dag statistieken www.duitsedog.tk", strMsg
'SendWebsiteData "https://www.dynamisch-tarief.nl/stroom/","Energie tarieven per uur"
' Pagina is vandaag nog niet bekeken
Set Rs = GetRS("SELECT * FROM DD_FOTOS WHERE IND_ACTIEF=1 AND TYPE_ID <> 6 AND TYPE_ID <> 1 ")
While Not Rs.EOF
Call UpdateFotoRandomVolgorde(Rs("id"))
Rs.MoveNext
Wend
Rs.Close
CheckFotoRandomizer = True
Else
CheckFotoRandomizer = False
End If
Set Rs = Nothing
End Function
Function UpdateFotoRandomizer
dim strSQl, Rs, strMsg
On Error Resume Next
Set Rs = GetRS("SELECT * FROM DD_FOTOS WHERE IND_ACTIEF=1 AND TYPE_ID <> 6 AND TYPE_ID <> 1 ")
While Not Rs.EOF
Call UpdateFotoRandomVolgorde(Rs("id"))
Rs.MoveNext
Wend
Rs.Close
Set Rs = Nothing
End Function
Function GebrNaam(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT naam " & _
"FROM DD_GEBRUIKERS " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
GebrNaam = Null
Else
GebrNaam = Rs("naam")
End If
Rs.Close
Set Rs = Nothing
End Function
Function GebrIdByLogin(ByVal strLogin)
Dim Rs, strSQL
strSql = "SELECT * " & _
"FROM DD_GEBRUIKERS " & _
"WHERE loginnaam=" & StrToSql(strLogin)
Set Rs = GetRs(strSql)
If Rs.EOF Then
GebrIdByLogin = Null
Else
GebrIdByLogin = SQLToInt(Rs("id"))
End If
Rs.Close
Set Rs = Nothing
End Function
Function GebrIdByLoginPass(ByVal strLogin, ByVal strWachtwoord)
Dim Rs, strSQL
strSql = "SELECT * " & _
"FROM DD_GEBRUIKERS " & _
"WHERE loginnaam=" & StrToSql(strLogin) & " " & _
"AND WACHTWOORD=" & StrToSql(strWachtwoord)
Set Rs = GetRs(strSql)
If Rs.EOF Then
GebrIdByLoginPass = Null
Else
GebrIdByLoginPass = SQLToInt(Rs("id"))
End If
Rs.Close
Set Rs = Nothing
End Function
Function HasActiveNest()
dim Rs, strSql
strSQL = "SELECT COUNT(*) as aantal FROM DD_NESTEN WHERE ind_actief=1"
Set Rs = GetRs(strSql)
HasActiveNest = Rs("aantal")>0
Rs.Close
Set Rs = Nothing
End Function
Function NestDatum(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT dat_geboren " & _
"FROM DD_NESTEN " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
NestDatum = Null
Else
NestDatum = Rs("dat_geboren")
End If
Rs.Close
Set Rs = Nothing
End Function
Sub VerwijderNest(ByVal Id)
Dim strSQL
strSQL = "DELETE FROM DD_NESTEN " &_
"WHERE id=" & IntToSql(Id)
ExecSQL(strSQL)
End Sub
Function VoegNestToe(ByVal blnActief,ByVal datGeboren,ByVal strKleur, ByVal intAantReuen, ByVal intAantTeven, ByVal dblPrijs, ByVal strprijsOms, ByVal strFoto1, ByVal intAantalBytesFoto1, ByVal strFoto2, ByVal intAantalBytesFoto2, ByVal strFoto3, ByVal intAantalBytesFoto3, ByVal strFoto4, ByVal intAantalBytesFoto4,ByVal strFoto5, ByVal intAantalBytesFoto5,ByVal strFoto6, ByVal intAantalBytesFoto6, ByVal strVader, ByVal strFotoVader, ByVal intAantalBytesVader, ByVal strMoeder, ByVal strFotoMoeder, ByVal intAantalBytesMoeder)
Dim strSQL, intFotoTypeNest, intSeizoenId, intFotoIdVader, intFotoIdMoeder, intFotoId, intFoto2Id, intFoto3Id, intFoto4Id, intFoto5Id, intFoto6Id
intFotoTypeNest = 1
intSeizoenId = bepaalSeizoen()
if Not IsNull(strFoto1) Then
intFotoId = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest1 " & Period(now),strFoto1,intAantalBytesFoto1,true)
Else
intFotoId = Null
End If
if Not IsNull(strFoto2) Then
intFoto2Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest2 " & Period(now),strFoto2,intAantalBytesFoto2,true)
Else
intFoto2Id = Null
End If
if Not IsNull(strFoto3) Then
intFoto3Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest3 " & Period(now),strFoto3,intAantalBytesFoto3,true)
Else
intFoto3Id = Null
End If
if Not IsNull(strFoto4) Then
intFoto4Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest4 " & Period(now),strFoto4,intAantalBytesFoto4,true)
Else
intFoto4Id = Null
End If
if Not IsNull(strFoto5) Then
intFoto5Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest5 " & Period(now),strFoto5,intAantalBytesFoto5,true)
Else
intFoto5Id = Null
End If
if Not IsNull(strFoto6) Then
intFoto6Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest6 " & Period(now),strFoto6,intAantalBytesFoto6,true)
Else
intFoto6Id = Null
End If
if Not IsNull(strFotoVader) Then
intFotoIdVader = InsertFoto(intSeizoenId,intFotoTypeNest,"Vader " & Period(now),strFotoVader,intAantalBytesVader,true)
Else
intFotoIdVader = Null
End If
if Not IsNull(strFotoMoeder) Then
intFotoIdMoeder = InsertFoto(intSeizoenId,intFotoTypeNest,"Vader " & Period(now),strFotoMoeder,intAantalBytesMoeder,true)
Else
intFotoIdMoeder = Null
End If
strSQL = "INSERT INTO DD_NESTEN(ind_actief,dat_geboren,kleur,moeder,vader,aant_reuen,aant_teven,prijs,prijs_oms,foto_id,foto2_id,foto3_id,foto4_id,foto5_id,foto6_id,foto_id_vader, foto_id_moeder) " &_
"VALUES (" & _
BoolToSQL(blnActief) & "," & _
DateToSQL(datGeboren) & "," & _
StrToSQL(strKleur) & "," & _
StrToSQL(strMoeder) & "," & _
StrToSQL(strVader) & "," & _
IntToSQL(intAantReuen) & "," & _
IntToSQL(intAantTeven) & "," & _
DblToSQL(dblPrijs) & "," & _
StrToSQL(StrPrijsOms) & "," & _
IntToSQL(intFotoId) & "," & _
IntToSQL(intFoto2Id) & "," & _
IntToSQL(intFoto3Id) & "," & _
IntToSQL(intFoto4Id) & "," & _
IntToSQL(intFoto5Id) & "," & _
IntToSQL(intFoto6Id) & "," & _
IntToSQL(intFotoIdVader) & "," & _
IntToSQL(intFotoIdMoeder)& ")"
VoegNestToe = ExecSQLId(strSQL)
End Function
Sub WijzigNest(ByVal Id, ByVal blnActief,ByVal datGeboren,ByVal strKleur, ByVal intAantReuen, ByVal intAantTeven, ByVal dblPrijs, ByVal strprijsOms, ByVal strFoto1, ByVal intAantalBytesFoto1, ByVal strFoto2, ByVal intAantalBytesFoto2, ByVal strFoto3, ByVal intAantalBytesFoto3, ByVal strFoto4, ByVal intAantalBytesFoto4,ByVal strFoto5, ByVal intAantalBytesFoto5,ByVal strFoto6, ByVal intAantalBytesFoto6, ByVal strVader, ByVal strFotoVader, ByVal intAantalBytesVader, ByVal strMoeder, ByVal strFotoMoeder, ByVal intAantalBytesMoeder)
Dim strSQL, intFotoTypeNest, intSeizoenId, intFotoIdVader, intFotoIdMoeder, intFotoId, intFoto2Id, intFoto3Id, intFoto4Id, intFoto5Id, intFoto6Id
intFotoTypeNest = 1
intSeizoenId = bepaalSeizoen()
if Not IsNull(strFoto1) Then
intFotoId = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest1 " & Period(now),strFoto1,intAantalBytesFoto1,true)
Else
intFotoId = Null
End If
if Not IsNull(strFoto2) Then
intFoto2Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest2 " & Period(now),strFoto2,intAantalBytesFoto2,true)
Else
intFoto2Id = Null
End If
if Not IsNull(strFoto3) Then
intFoto3Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest3 " & Period(now),strFoto3,intAantalBytesFoto3,true)
Else
intFoto3Id = Null
End If
if Not IsNull(strFoto4) Then
intFoto4Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest4 " & Period(now),strFoto4,intAantalBytesFoto4,true)
Else
intFoto4Id = Null
End If
if Not IsNull(strFoto5) Then
intFoto5Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest5 " & Period(now),strFoto5,intAantalBytesFoto5,true)
Else
intFoto5Id = Null
End If
if Not IsNull(strFoto6) Then
intFoto6Id = InsertFoto(intSeizoenId,intFotoTypeNest,"Nest6 " & Period(now),strFoto6,intAantalBytesFoto6,true)
Else
intFoto6Id = Null
End If
if Not IsNull(strFotoVader) Then
intFotoIdVader = InsertFoto(intSeizoenId,intFotoTypeNest,"Vader " & Period(now),strFotoVader,intAantalBytesVader,true)
Else
intFotoIdVader = Null
End If
if Not IsNull(strFotoMoeder) Then
intFotoIdMoeder = InsertFoto(intSeizoenId,intFotoTypeNest,"Vader " & Period(now),strFotoMoeder,intAantalBytesMoeder,true)
Else
intFotoIdMoeder = Null
End If
strSQL = "UPDATE DD_NESTEN " &_
"SET ind_actief=" & BoolToSQL(blnActief) & ", " &_
"dat_geboren=" & DateToSQL(datGeboren) & ", " &_
"kleur=" & StrToSQL(strKleur) & ", " &_
"moeder=" & StrToSQL(strMoeder) & ", " &_
"vader=" & StrToSQL(strVader) & ", " &_
"aant_reuen=" & IntToSQL(intAantReuen) & ", " &_
"aant_teven=" & IntToSQL(intAantTeven) & ", " &_
"prijs=" & DblToSQL(dblPrijs) & ", " &_
"prijs_oms=" & StrToSQL(strPrijsOms) & ", " &_
"foto_id=" & IntToSQL(intFotoId) & ", " &_
"foto2_id=" & IntToSQL(intFoto2Id) & ", " &_
"foto3_id=" & IntToSQL(intFoto3Id) & ", " &_
"foto4_id=" & IntToSQL(intFoto4Id) & ", " &_
"foto5_id=" & IntToSQL(intFoto5Id) & ", " &_
"foto6_id=" & IntToSQL(intFoto6Id) & ", " &_
"foto_id_vader=" & IntToSQL(intFotoIdVader) & ", " &_
"foto_id_moeder=" & IntToSQL(intFotoIdMoeder) & " " &_
"WHERE id=" & IntToSQL(Id)
ExecSQL(strSQL)
End Sub
Sub UpdateFotoHit(ByVal Id)
Dim strSQL
strSQL = "UPDATE DD_FOTOS " &_
"SET hits = hits + 1, dat_laatst_getoont=date() " &_
"WHERE id=" & IntToSQL(Id)
ExecSQL(strSQL)
End Sub
Function FotoTypeOms(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT oms " & _
"FROM DD_FOTO_TYPES " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
FotoTypeOms = Null
Else
FotoTypeOms = Rs("oms")
End If
Rs.Close
Set Rs = Nothing
End Function
Function InsertFoto(ByVal intSeizoenId,ByVal intTypeId, ByVal strOms, ByVal strFileName, ByVal intGrootte, ByVal blnActief)
Dim strSQL
strSQL = "INSERT INTO DD_FOTOS(seizoen_id,type_id,oms,bestandsnaam,grootte,datum, ind_actief) " &_
"VALUES (" & _
IntToSQL(intSeizoenId) & "," & _
IntToSQL(intTypeId) & "," & _
StrToSQL(strOms) & "," & _
StrToSQL(strFileName)& "," & _
IntToSQL(intGrootte) & "," & _
DateToSQL(date) & "," & _
BoolToSQL(blnActief) & ")"
InsertFoto = ExecSQLId(strSQL)
End Function
Sub UpdateFoto(ByVal intId, ByVal intSeizoenId,ByVal intTypeId, ByVal strOms, ByVal strFileName, ByVal intGrootte, ByVal blnActief)
Dim strSQL
strSQL = "UPDATE DD_FOTOS " & _
"SET type_id =" & IntToSQL(intTypeId) & "," & _
"seizoen_id =" & IntToSQL(intSeizoenId)& "," & _
"oms =" & StrToSQL(strOms) & "," & _
"bestandsnaam =" & StrToSQL(strFileName) & "," & _
"grootte =" & IntToSQL(intGrootte) & "," & _
"datum =" & DateToSQL(date) & "," & _
"ind_actief =" & BoolToSQL(blnActief) & " " & _
"WHERE id=" & IntToSQL(intId)
ExecSQL(strSQL)
End Sub
Function FotoOms(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT oms " & _
"FROM DD_FOTOS " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
FotoOms = Null
Else
FotoOms = Rs("oms")
End If
Rs.Close
Set Rs = Nothing
End Function
Function FotoTypeId(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT type_id " & _
"FROM DD_FOTOS " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
FotoTypeId = Null
Else
FotoTypeId = Rs("type_id")
End If
Rs.Close
Set Rs = Nothing
End Function
Function FotoBestandsnaam(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT bestandsnaam " & _
"FROM DD_FOTOS " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
FotoBestandsnaam = Null
Else
FotoBestandsnaam = Rs("bestandsnaam")
End If
Rs.Close
Set Rs = Nothing
End Function
Sub VerwijderFoto(ByVal intId)
Dim strSQL, strBestandsnaam, objFSO, MyFile, uploadsDirVar
uploadsDirVar = "D:\HostingSpaces\RImmers\duitsedog.tk\wwwroot\fotos\" & FotoTypeOms(FotoTypeId(intId))
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strBestandsnaam = FotoBestandsnaam(intId)
strSQL = "DELETE FROM DD_FOTOS WHERE id=" & IntToSQL(intId)
ExecSQL(strSQL)
Set MyFile = objFSO.GetFile(uploadsDirVar & "\" & strBestandsnaam)
MyFile.Delete
End Sub
Sub UpdateFotoRandomVolgorde(ByVal intId)
Dim strSQL, intVolgorde
intVolgorde = GenerateRandomInteger(100)
strSQL = "UPDATE DD_FOTOS " &_
"SET volgorde = " & IntToSQL(intVolgorde) &_
" WHERE id=" & IntToSQL(intId)
ExecSQL(strSQL)
End Sub
Function PaginaNaam(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT naam " & _
"FROM DD_PAGINAS " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
PaginaNaam = Null
Else
PaginaNaam = Rs("naam")
End If
Rs.Close
Set Rs = Nothing
End Function
Function HasActiveHerplaatsting()
dim Rs, strSql
strSQL = "SELECT COUNT(*) as aantal FROM DD_HERPLAATSINGEN WHERE ind_actief=1"
Set Rs = GetRs(strSql)
HasActiveHerplaatsting = Rs("aantal")>0
Rs.Close
Set Rs = Nothing
End Function
Function HerplaatsingTitel(ByVal intId)
Dim Rs, strSQL
strSql = "SELECT titel " & _
"FROM DD_HERPLAATSINGEN " & _
"WHERE ID=" & IntToSql(intId)
Set Rs = GetRs(strSql)
If Rs.EOF Then
HerplaatsingTitel = Null
Else
HerplaatsingTitel = Rs("titel")
End If
Rs.Close
Set Rs = Nothing
End Function
Sub VerwijderHerplaatsing(ByVal intId)
Dim strSQL
strSQL = "DELETE FROM DD_HERPLAATSINGEN WHERE id = " & IntToSQL(intId)
ExecSQL(strSQL)
End Sub
Function bepaalSeizoen()
If (Month(date)=3 And Day(date)>=21) Or (Month(date)>3 And Month(date)<=6 And Day(date)<21)Then
bepaalSeizoen = 1
ElseIf (Month(date)=6 And Day(date)>=21) Or (Month(date)>6 And Month(date)<=9 And Day(date)<23)Then
bepaalSeizoen = 2
ElseIf (Month(date)=9 And Day(date)>=23) Or (Month(date)>9 And Month(date)<=12 And Day(date)<22)Then
bepaalSeizoen = 3
Else
bepaalSeizoen = 4
End If
End Function
Function VoegHerplaatsingToe(ByVal blnActief, ByVal strTitel, ByVal strTekst, ByVal strTekstUK, ByVal intGrootte, ByVal strBestandsnaam)
Dim strSQL, intFotoId, intSeizoenId, intFotoTypeHerplaatsing
intFotoTypeHerplaatsing = 7
if Not IsNull(strBestandsnaam) Then
intSeizoenId = bepaalSeizoen()
intFotoId = InsertFoto(intSeizoenId,intFotoTypeHerplaatsing,strTitel,strBestandsnaam,intGrootte,true)
Else
intFotoId = Null
End If
strSQL = "INSERT INTO DD_HERPLAATSINGEN(titel, tekst, tekst_UK, ind_actief, foto_id) " &_
"VALUES (" & _
StrToSQL(strTitel) & "," & _
StrToSQL(strTekst) & "," & _
StrToSQL(strTekstUk) & "," & _
BoolToSQL(blnActief) & "," & _
IntToSQL(intFotoId) & ")"
VoegHerplaatsingToe = ExecSQLId(strSQL)
End Function
Sub WijzigHerplaatsing(ByVal intId, ByVal blnActief, ByVal strTitel, ByVal strTekst, ByVal strTekstUK, ByVal intGrootte, ByVal strBestandsnaam)
Dim strSQL, intFotoId, intSeizoenId, intFotoTypeHerplaatsing
intFotoTypeHerplaatsing = 7
if Not IsNull(strBestandsnaam) Then
intSeizoenId = bepaalSeizoen()
intFotoId = InsertFoto(intSeizoenId,intFotoTypeHerplaatsing,strTitel,strBestandsnaam,intGrootte,true)
Else
intFotoId = Null
End If
strSQL = "UPDATE DD_HERPLAATSINGEN SET " &_
"titel=" & StrToSQL(strTitel) & "," & _
"tekst=" & StrToSQL(strTekst) & "," & _
"tekst_UK=" & StrToSQL(strTekstUK) & "," & _
"foto_id=" & IntToSQL(intFotoId) & "," & _
"ind_actief=" & BoolToSQL(blnActief) & " " & _
"WHERE id = " & IntToSQL(intId)
ExecSQL(strSQL)
End Sub
Sub WijzigGeenNestTekst(ByVal blnAltijdTonen, ByVal strTekst, ByVal strTekstUK)
Dim strSQL
strSQL = "UPDATE DD_INSTELLINGEN SET ind_pups_tekst_altijd_tonen =" & BoolToSQL(blnAltijdTonen) & ", pups_tekst = " & StrToSql(strTekst) & ", pups_tekst_uk = " & StrToSql(strTekstUk)
ExecSQL(strSQL)
End Sub
%>