%
strDSN = "DRIVER={MySQL}; Server=mydb6.surf-town.net; Database=spoforum; Uid=spoaddi_php; Password=smovs;"
Function DBFix(tempString)
tempString = Replace(Trim(tempString), "'", "''")
tempString = Replace(tempString, "|", "")
DBFix = tempString
End Function
%>
<%
If Session("ADMINID") = 1 Then
godkendt = 1
elseIf Session("ADMINID") = 2 Then
godkendt = 1
elseIf Session("ADMINID") = 7 Then
godkendt = 1
elseIf Session("ADMINID") = 8 Then
godkendt = 1
elseIf Session("ADMINID") = 9 Then
godkendt = 1
elseIf Session("ADMINID") = 28 Then
godkendt = 1
Else godkendt = 0
END IF
%>
<%
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open strDSN
strSQL = "SELECT * FROM 16cnyheder ORDER BY ID DESC"
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
Do While Not rs.EOF
strSQL = "SELECT *, DATE_FORMAT(date,'%d-%m-%Y') AS FormDate, TIME_FORMAT(date,'%H:%i') AS FormTime FROM 16cnyheder WHERE (id =" & rs("id") & ")"
Set formatDate = myConn.Execute(strSQL)
dtmFormatDate = formatDate("FormDate")
strSQL = "SELECT Count(*) AS ItemCount FROM 16cnyheder Where (id = " & rs("id") & ")"
Set recordCount = myConn.Execute(strSQL)
If godkendt = 1 Then
' strHTML = strHTML & "
"
END IF
strSQLcommentsnospam = "SELECT Count(*) AS ItemCount FROM 16ccomments Where (newsid = " & rs("id") & ") AND (spam != 1)"
strSQLcommentswithspam = "SELECT Count(*) AS ItemCount FROM 16ccomments Where (newsid = " & rs("id") & ")"
Set commentCount = myConn.Execute(strSQLcommentsnospam)
Set commentCountwithspam = myConn.Execute(strSQLcommentswithspam)
strHTML = strHTML & ""
strHTML = strHTML & ""
If commentCount("ItemCount") = 0 Then
strHTML = strHTML & "Der er ingen kommentarer til denne nyhed, klik her og vær den første!"
elseif commentCount("ItemCount") = 1 Then
strHTML = strHTML & "Der er én kommentar til denne nyhed"
else
strHTML = strHTML & "Der er " & commentCount("ItemCount") & " kommentarer til denne nyhed"
END IF
strHTML = strHTML & ""
if godkendt = 1 then
strHTML = strHTML & " (" & commentCountwithspam("ItemCount") & " med spam)"
end if
strHTML = strHTML & " "
if Request("comments") = rs("id") Then
if (godkendt = 1) Then
strSQLshowcomment = "SELECT *, DATE_FORMAT(date,'%d-%m-%Y %H:%i') AS FormDate FROM 16ccomments WHERE (newsid = " & rs("id") & ")"
else
strSQLshowcomment = "SELECT *, DATE_FORMAT(date,'%d-%m-%Y %H:%i') AS FormDate FROM 16ccomments WHERE (newsid = " & rs("id") & ") AND (spam != 1)"
end if
Set sc = myConn.Execute(strSQLshowcomment)
If Not (sc.BOF Or sc.EOF) Then
Do While Not sc.EOF
'Set formatDate = myConn.Execute(strSQLshowcomment)
comFormatDate = sc("FormDate")
if (godkendt = 1) Then
strHTML = strHTML & " "
End if
else
if (godkendt = 1) Then
strHTML = strHTML & " "
End if
end if
if sc("spam") = 0 Then
comment = Replace(sc("comment"), vbcrlf, " ")
strHTML = strHTML & " " & comment & "
"
else
strHTML = strHTML & "
"
end if
sc.MoveNext
Loop
End if
' kommentar felt
strHTML = strHTML & ""
End if
strHTML = strHTML & ""
rs.MoveNext
Loop
End If
myConn.Close
Set myConn = Nothing
If godkendt = 1 Then
strNY = " - Skriv en ny nyhed"
else Response.write ""
End IF
%>
Sidste nyt 16c