<% strConnection = "DRIVER={MySql}; SERVER=mydb2.surftown.se; DATABASE=fogler_db; UID=fogler_fogler; PWD=ajabaja" Session.Timeout = 10 Set Connect = Server.CreateObject("ADODB.Connection") Connect.Open strConnection ''''''''''''''''''''''''''''''''''''''''''''''''' ' Kontrollera inloggningen! ''''''''''''''''''''''''''''''''''''''''''''''''' if request.querystring("action") = "checklogin" then Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM Users" RecSet.Open Visa, Connect, 3, 3 X = false Do Until X = true OR RecSet.EOF If RecSet("Username") = Request.Form("Username") Then X = true Exit Do End If RecSet.MoveNext Loop If X = true Then Y = false Do Until Y = true OR RecSet.EOF If RecSet("Password") = Request.Form("Password") Then Y = true Exit Do End If RecSet.MoveNext Loop End If If X = true And Y = true Then Session("Username") = Request.Form("Username") Session("Password") = Request.Form("Password") Recset.Close end if end if ''''''''''''''''''''''''''''''''''''''''''''''''' ' BILDHANTERING! ''''''''''''''''''''''''''''''''''''''''''''''''' if request.querystring("action")= "addImage" then set Upload = Server.CreateObject("Chili.Upload.1") On Error Resume Next fileName = Upload.SourceFileName(False) fileName = Replace(fileName, " ", "_") fileName = Replace(fileName, "å", "a") fileName = Replace(fileName, "ä", "a") fileName = Replace(fileName, "ö", "o") Upload.SaveToFile(Server.MapPath("/images/") & "/" & fileName) Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="INSERT INTO Images(filename, imagetext, news) VALUES('" + filename + "','" & Upload.FormData("bildtext") & "','" & Upload.FormData("news") & "')" Connect.Execute SQL, intrecs, 129 Response.Redirect("thumbnail.php?fileName=" + filename) end if if request.querystring("action")= "editImage" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE Images SET Images.imagetext='" & Request.form("imagetext") & "' WHERE Images.ID=" & Request.QueryString("ID") Connect.Execute SQL, intrecs, 129 Response.Redirect("admin.asp?updated=true") end if if request.querystring("action")= "removeImage" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE Images SET Images.Aktivt='0' WHERE Images.ID=" & Request.QueryString("ID") Connect.Execute SQL, intrecs, 129 Response.Redirect("admin.asp?updated=true") end if ''''''''''''''''''''''''''''''''''''''''''''''''' ' Meddelandehantering! ''''''''''''''''''''''''''''''''''''''''''''''''' If Request.Querystring("action") = "removeMessage" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE News SET News.Aktivt='0' WHERE News.ID =" & Request.QueryString("id") Connect.Execute SQL, intrecs, 129 response.redirect("admin.asp?updated=true") response.end RecSet.Close end if if request.QueryString("action")= "editMessage" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE News SET News.Meddelanderubrik='" & Request.Form("meddelanderubrik") & "', News.Meddelande='" & request.form("meddelande") & "', News.Startpage='" & request.form("startpage") & "' WHERE News.ID=" & Request.QueryString("id") Connect.Execute(SQL), intrecs, 129 response.redirect("admin.asp?updated=true") response.end RecSet.Close end if if request.querystring("action")= "addMessage" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="INSERT INTO News(Meddelanderubrik, Meddelande, Startpage, Aktivt) VALUES('" & Request.Form("meddelanderubrik") & "','" & request.Form("meddelande") & "','" & request.Form("startpage") & "','1')" Connect.Execute SQL, intrecs, 129 Response.Redirect("admin.asp?updated=true") response.end RecSet.Close end if ''''''''''''''''''''''''''''''''''''''''''''''''' ' Länkar! ''''''''''''''''''''''''''''''''''''''''''''''''' If Request.Querystring("action") = "removeLink" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE Link SET Link.Aktivt='0' WHERE Link.ID =" + Request.QueryString("id") Connect.Execute SQL, intrecs, 129 response.redirect("admin.asp?updated=true") response.end RecSet.Close end if If Request.Querystring("action") = "editLink" then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="UPDATE Link SET Link.Link='" & request.form("link") & "',Link.Address='" & request.form("address") & "' WHERE Link.ID =" + Request.QueryString("id") Connect.Execute SQL, intrecs, 129 response.redirect("admin.asp?updated=true") response.end RecSet.Close end if if request.querystring("action")= "addLink" then if request.form("link") <> "" AND request.form("address") <> "" Then Set RecSet = Server.CreateObject("ADODB.Recordset") SQL="INSERT INTO Link(Link, Address, Aktivt) VALUES('" & request.form("link") & "','" & request.form("address") & "','1')" Connect.Execute SQL, intrecs, 129 Response.Redirect("admin.asp?updated=true") end if end if ''''''''''''''''''''''''''''''''''''''''''''''''' ' Uppdatera text! ''''''''''''''''''''''''''''''''''''''''''''''''' if request.querystring("action")= "updateText" then Set RecSet = Server.CreateObject("ADODB.RecordSet") SQL="UPDATE Informations SET Informations.Info='" & request.form("txt") & "' WHERE ID = '" & request.querystring("To") & "'" Connect.Execute SQL, intrecs, 129 Response.redirect("admin.asp?updated=true") end if %> Admin - cfm project

. : ADMIN : .


<% if Session("Username") = "" and Session("Password") = "" then %>
Inloggning
Användarnamn:
Lösenord:

<% else %>
Nyheter :: vad är cfm project :: concrete :: finishing :: method :: ab :: links :: Bilder

<% end if %> <% if request.querystring("updated") = "true" then %>
Uppdaterat
Informationen har uppdaterats!
<% end if %> <% if request.querystring("editObj") = "news" then %>
Nyheter <% if request.querystring("id") <> "" then %>
name="Formen"> <% else %> <% end if %>
Meddelanderubrik:
<% if request.querystring("id") <> "" then Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM News WHERE ID = " & Request.QueryString("id") RecSet.Open Visa, Connect, 3, 3 Response.Write("") else Response.Write("") end if %>

Meddelande:
<% if request.querystring("id") = "" then %>
Visa på startsidan <% else %>
> Visa på startsidan <% end if %>

Aktuella nyheter:

<% Response.write("") Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM News WHERE Aktivt = 1" RecSet.Open Visa, Connect, 3, 3 Do Until RecSet.EOF Response.Write("") RecSet.MoveNext Loop RecSet.Close Response.Write("
  • " & RecSet("Meddelanderubrik") & "
  • EditeraTa Bort
    ") %>
    <% end if %> <% if request.querystring("editObj") = "images" then %> <% if request.querystring("id") <> "" then Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM Images WHERE ID=" & Request.QueryString("id") RecSet.Open Visa, Connect, 3, 3 Do Until RecSet.EOF %>
    Bilder
    name="Formen">
    <% Response.Write("

    ") %>
    Bildnamn:
    <% Response.Write(RecSet("filename")) %>

    Bildtext:
    <% RecSet.MoveNext Loop RecSet.Close %>
    <% else %>
    Bilder
    Bild:


    Bildtext:
    <% Response.Write("

    Koppla bild till nyhet:
    ") Response.Write("Vad är cfm project
    ") Response.Write("concrete
    ") Response.Write("finishing
    ") Response.Write("method
    ") Response.Write("ab
    ") Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM News WHERE Aktivt=1" RecSet.Open Visa, Connect, 3, 3 Do Until RecSet.EOF Response.Write("
    ") RecSet.MoveNext Loop RecSet.Close Response.Write("

    ") %>
    <% Response.Write("
    Befintliga bilder:
    ") Response.write("") Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM Images WHERE Aktivt=1 ORDER BY news ASC" RecSet.Open Visa, Connect, 3, 3 Do Until RecSet.EOF if RecSet("imagetext") = "" then bildtext = "Bildtext saknas" else bildtext = RecSet("imagetext") end if Response.Write("") RecSet.Movenext Loop RecSet.Close Response.Write("
  • " & RecSet("filename") & "
  • " & bildtext & "NyhetsID: " & RecSet("news") & "EditeraTa bort
    ") %>
    <% end if end if %> <% if request.QueryString("editObj") = "links" then %>
    Länkar <% if request.QueryString("id") <> "" then %>
    name="FormenLinks"> <% else %> <% end if %>
    Länktext:
    <% if request.QueryString("id") <> "" then Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM Link WHERE ID = " & Request.QueryString("id") RecSet.Open Visa, Connect, 3, 3 response.write("") else response.write("") end if %>
    Adress:
    <% if request.QueryString("id") <> "" then response.write("") else response.write("") end if %>
    <% Response.write("") Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT * FROM Link WHERE Aktivt = 1" RecSet.Open Visa, Connect, 3, 3 Do Until RecSet.EOF Response.Write("") RecSet.MoveNext Loop RecSet.Close Response.Write("

    Befintliga länkar:
  • " & RecSet("Link") & "
  • " & RecSet("Address") & "EditeraTa Bort
    ") %>
    <% end if %> <% if request.QueryString("editObj") = "whatiscfm" or request.QueryString("editObj") = "concrete" or request.QueryString("editObj") = "finishing" or request.QueryString("editObj") = "method" or request.QueryString("editObj") = "project" or request.QueryString("editObj") = "ab" then %>
    <% Response.Write(request.QueryString("editObj")) %>
    name="FormenText">
    Information:
    <% Set RecSet = Server.CreateObject("ADODB.Recordset") Visa = "SELECT Info FROM Informations WHERE ID = '" & request.querystring("editObj") & "'" RecSet.Open Visa, Connect, 3, 3 %>
    <% Recset.close end if %> <% Connect.Close %>