fra access til MySQL i ASP
Hej alle sammen.Jeg har netop konventeret min access database til MySQL.
Derfor skal jeg have jer til at lave denne kode om så det ikke er access. Den skal connecte til en MySQL database. Dermed skal i lave hvad der ellers skal laves for at den virker til en MySQL.
Jeg modtager ikke kodestumper, så det er jer som skal sætte det ind i koden.
På forhånd tak
David Plum Olsen
----------------------------------------
<%
Response.Buffer = True
Function opendb()
Set conn = Server.CreateObject("ADODB.Connection")
DNS = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" + Server.MapPath("db/ahf.mdb")
conn.Open(DNS)
set opendb = conn
End function
Function closedb ()
conn.close
Set conn = nothing
End Function
'sideinformation
function getpage
pagestr = request.querystring("page")
if pagestr = "" then pagestr = 1
getpage = pagestr
end function
function getpagename
if getpage() = 1 then getpagename = "forside"
if getpage() = 2 then getpagename = "information"
if getpage() = 3 then getpagename = "klassen"
if getpage() = 4 then getpagename = "kalender"
if getpage() = 5 then getpagename = "forum"
if getpage() = 6 then getpagename = "tagwall"
if getpage() = 7 then getpagename = "kontakt"
if getpage() = 8 then getpagename = "links"
if getpage() = 9 then getpagename = "login"
if getpage() = 10 then getpagename = "registrering"
if getpage() = 11 then getpagename = "administration"
end function
function getmode
modestr = request.querystring("mode")
if modestr = "" then modestr = "normal"
getmode = modestr
end function
Function Makelink(strInput)
Set objRegExpHTTP1 = New RegExp
Set objRegExpHTTP2 = New RegExp
Set objRegExpEMail = New RegExp
objRegExpHTTP1.Pattern = "(http|ftp)(:\/\/[\w\._-]+\.[\w\._-]+\S*)"
objRegExpHTTP2.Pattern = "(^|[^\/])(www[^\.\s]?\.[\w\._-]+\.[A-Za-z]{2,3}\S*)"
objRegExpEMail.Pattern = "([\w\._-]+@[\w\._-]+\.[A-Za-z]{2,3}\S*)"
objRegExpHTTP1.Global = True
objRegExpHTTP2.Global = True
objRegExpEMail.Global = True
objRegExpHTTP1.IgnoreCase = True
objRegExpHTTP2.IgnoreCase = True
objRegExpEMail.IgnoreCase = True
strOutput = objRegExpEMail.Replace(strInput, " <a href='mailto:$1'>$1</a> ")
strOutput = objRegExpHTTP1.Replace(strOutput, " <a href='$1$2' target='_blank'>$1$2</a> ")
strOutput = objRegExpHTTP2.Replace(strOutput, " <a href='http://$2' target='_blank'>$2</a> ")
Set objRegExpHTTP2 = Nothing
set objRegExpHTTP1 = Nothing
Set objRegExpEMail = Nothing
Makelink = strOutput
End Function
'adgangskontrol
function logout
session("login") = ""
session("memberid") = ""
session("username") = ""
session("authlevel") = ""
end function
function restricted
if session("login") = "" then
response.redirect "?page=9"
end if
end function
function ban
SQL = "SELECT COUNT(*) as found FROM ban WHERE ip = '" & request.ServerVariables("REMOTE_HOST") & "'"
set RS = conn.execute(SQL)
if RS("found") > 0 then
response.redirect("pages/llamah.asp")
end if
RS.close
set RS = nothing
end function
%>