Joachim.dk
<%
Dim vPath, pPath, ConString, sqltext1, rsPageList
vPath = "db/joachim.mdb" 'use this one if database is in root of cart folder
pPath = Server.MapPath( vPath )
ConString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & pPath & ";"
Function unQuote(strTekst)
unQuote = Replace(strTekst,"'","''")
End Function
Sub sletside(nId)
sqltext = "DELETE FROM Pages WHERE Lbnr=" & nId & ""
Conn.Execute(sqltext)
End Sub
Sub nyside (nPageId, nTekst, nForfatter)
nDatoZ = UniTid("ZMT")
nDato = UniTid("CET")
sqltext = "INSERT INTO Pages (PageId, Tekst, Forfatter, Id, Modified) "
sqltext = sqltext & "values ('"&nPageId&"','"& nTekst &"','"& nForfatter &"','','" & nDatoZ &"')"
'response.write sqltext
Conn.Execute(sqltext)
End Sub
Sub hentsider
sqltext1 = "SELECT * from Pages order by PageId"
'response.write(sqltext1)
set rsPageList = Conn.Execute(sqltext1)
End Sub
Function UniTid(nTidtype)
if(nTidtype = "ZMT") then
SysTime = DateAdd("h",-1,Now)
else
SysTime = Now
end if
UniYear = DatePart("yyyy",SysTime)
UniDay = DatePart("d",SysTime)
if (UniDay < 10 ) then
UniDay = "0"&UniDay
end if
UniMonth = DatePart("m",SysTime)
if (UniMonth < 10 ) then
UniMonth = "0"&UniMonth
end if
UniHour = DatePart("h",SysTime)
if (UniHour < 10 ) then
UniHour = "0"&UniHour
end if
UniMin = DatePart("n",SysTime)
if (UniMin < 10 ) then
UniMin = "0"&UniMin
end if
UniSec = DatePart("s",SysTime)
if (UniSec < 10 ) then
UniSec = "0"&UniSec
end if
'GMT tid
if(nTidtype = "ZMT") then
UniTid = UniYear&"-"&UniMonth&"-"&UniDAy&"T"&UniHour&":"&UniMin&":"&UniSec&"Z"
else
UniTid = UniYear&"-"&UniMonth&"-"&UniDAy&"T"&UniHour&":"&UniMin&":"&UniSec
end if
End Function
'Main program
if (Len(Session("Brugerid")) = 0) then
Response.redirect "blog/blogadm.asp"
end if
chaAktion = unQuote(Request.form("Aktion"))
chaBrugerid = unQuote(Request.form("Brugerid"))
chaBrugerLbnr = unQuote(Request.form("BrugerLbnr"))
chaCurItem1 = Request.form("CurItem1")
chaPageId = unQuote(Request.form("PageId"))
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString
if (chaAktion = "gem") then
nyside chaPageId,"
Ny side oprettet...
Brødtekst står her...",0
end if
if (chaAktion = "slet") then
sletside chaCurItem1
end if
if (chaAktion = "logoff") then
Session("Brugerid") = ""
end if
%>
<%
if (Len(Session("Brugerid")) > 0) then
response.write "