Avatar billede dsl Nybegynder
22. juli 2002 - 22:13 Der er 1 løsning

Fejl i det her?

Kan i finde nogen fejl her:

<%
    Response.Buffer = True
    Session.LCID = 1030
    Randomize

%><!--#include file="inc_settings.asp" --><%

    ' ------------------------------------------------------------------------------------------
    '/ ADVARSEL: Hvis koden under denne linie ændres er det ikke sikkert at systemet            \
    '\          fortsat vil virke korrekt, med mindre det er angivet!                            /
    ' ------------------------------------------------------------------------------------------

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "Driver={mySQL}; Server=localhost; Port=3306; Option=131072; Stmt=; uid=admin; pwd=43e9a4ab75570f5b;"


    strMode = LCase(Request("mode"))
    strPID = Request("pid"):          If Not IsNumeric(strPID) Then strPID = ""
    strLastPID = Request("last_pid"): If Not IsNumeric(strLastPID) Then strLastPID = ""
    Page_ShowMenu = True

    bolWasPosted = (Request.ServerVariables("HTTP_METHOD") = "POST")
    SessionID = Request.Cookies("sessionid")
    If SessionID = "" Then
        Response.Cookies("sessionid") = Session.SessionID
        Response.Cookies("sessionid").Expires = DateAdd("yyyy", 1, Now)
        SessionID = Session.SessionID
    End If
    RemoteAddress = Request.ServerVariables("REMOTE_ADDR")

    If strMode = "list" Then
        strGender = Request("gender"): If strGender = "" Then strGender = "1"
        strType = Request("type"):      If strType = "" Then strType = "0"

        Select Case strType
            Case "0": Page_Caption = "Seneste " & ListSize
            Case "1": Page_Caption = "Top " & ListSize
        End Select

        Select Case strGender
            Case "1": Page_Caption = Page_Caption & " kvinder"
            Case "2": Page_Caption = Page_Caption & " mænd"
            Case "3": Page_Caption = Page_Caption & " børn"
        End Select
    ElseIf strMode = "savefakereport" And bolWasPosted Then
        strReason = Request("reason")

        strMail = Replace(strEMOF, "#pid", strPID) & strReason

        bolIsOK = SendMail(OwnerEmail, "Anmeldelse af fake billede!", strMail)
        strMode = "report_fake"

        Page_Caption = "Anmeld fake billede"
        Page_ShowMenu = False
    ElseIf strMode = "savecomment" And bolWasPosted Then
        strName = DeMessSQL(Server.HTMLEncode(Request("name")))
        strEmail = DeMessSQL(Request("email"))
        strSubject = DeMessSQL(Server.HTMLEncode(Request("subject")))
        strComment = DeMessSQL(Server.HTMLEncode(Request("comment")))

        Conn.Execute "INSERT INTO comments (pid,fromname,email,subject,comment,datetime) VALUES (" & strPID & ",'" & strName & "','" & strEmail & "','" & strSubject & "','" & strComment & "',now())"
        Set Rs = Conn.Execute("SELECT name,email FROM persons WHERE id=" & strPID)

        strText = Replace(strEMOC, "#navn", Rs(0))
        bolSuccess = SendMail(CStr(Rs(1)), "Besked til dig på Hot Or Not...", strText)

        Page_Caption = "Kommentar sendt!"
        Response.Redirect "default.asp?mode=commentsent&pid=" & strPID
    ElseIf strMode = "delete_comment" Then
        strID = Request("id"): If strID = "" Or Not IsNumeric(strID) Then Response.Redirect "default.asp?mode=read_comments"

        Conn.Execute "DELETE FROM comments WHERE id=" & strID & " AND pid=" & Session("id")

        Response.Redirect "default.asp?mode=read_comments"
    ElseIf strMode = "vote" And bolWasPosted Then
        Session("onlyvote") = Request("onlyvote")
        strVote = Request("vote")

        strLastGender = Request("gender")
        If strLastGender = "1" Then strLastGender = "2" Else strLastGender = "1"

        bolVoteIsOK = False

        Set Rs = Conn.Execute("SELECT id FROM votes WHERE sessionid='" & SessionID & "' AND pid=" & strPID)
        If Rs.BOF And strVote > "" And IsNumeric(strVote) Then
            If CInt(strVote) > 0 And CInt(strVote) < 11 Then
                Conn.Execute "UPDATE hits SET raters=raters+1,vote" & strVote & "=vote" & strVote & "+" & strVote & " WHERE pid=" & strPID
                Conn.Execute "INSERT INTO votes (sessionid,pid,ip,vote,datetime) VALUES ('" & SessionID & "'," & strPID & ",'" & RemoteAddress & "'," & strVote & ",now())"

                bolVoteIsOK = True
            End If
        End If

        strWhere = " WHERE id<>" & strPID
        If Session("onlyvote") > "" And Not Session("onlyvote") = "0" Then strWhere = strWhere & " AND gender=" & Session("onlyvote")

        Set Rs = Conn.Execute("SELECT id,rand() AS rnd FROM persons" & strWhere & " ORDER BY rnd LIMIT 0,1")
        If Not Rs.BOF Then
            strNewPID = Rs(0)

            Select Case bolVoteIsOK
                Case True:  Response.Redirect "default.asp?last_pid=" & strPID & "&gender=" & strLastGender & "&pid=" & strNewPID
                Case False: Response.Redirect "default.asp?gender=" & strLastGender & "&pid=" & strNewPID
            End Select
        Else
            Response.Redirect "default.asp?mode=np"
        End If
    ElseIf strMode = "logout" Then
        Session.Abandon
        Response.Redirect "default.asp"
    ElseIf strMode = "login" Then
        strEmail = DeMessSQL(Request("email"))
        strPass = DeMessSQL(Request("pass"))

        Page_Caption = "Redigér profil"
        Page_ShowMenu = False

        bolLoginSuccessfull = True
        If strEmail > "" And strPass > "" And bolWasPosted Then
            Set Rs = Conn.Execute("SELECT id,email,password FROM persons WHERE email='" & strEmail & "' AND password='" & strPass & "'")
            If Not Rs.BOF Then
                Session("id") = Rs(0)
                Session("email") = Rs(1)
                Session("pass") = Rs(2)

                Response.Redirect "default.asp?mode=login"
            Else
                bolLoginSuccessfull = False
            End If
        End If

        bolIsValid = (Session("email") > "" And Session("pass") > "" And Session("id") > "")
    ElseIf strMode = "delete_pic" And Session("id") > "" Then
        Set Rs = Conn.Execute("SELECT picturefile FROM persons WHERE id=" & Session("id"))
        strPicture = Rs(0)

        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        fso.DeleteFile Server.MapPath("pictures/" & Session("id") & "_" & strPicture), True
        Set fso = Nothing

        Conn.Execute "DELETE FROM persons WHERE id=" & Session("id")
        Conn.Execute "DELETE FROM hits WHERE pid=" & Session("id")
        Conn.Execute "DELETE FROM comments WHERE pid=" & Session("id")

        Response.Redirect "default.asp"
    ElseIf strMode = "commentsent" Then
        Page_Caption = "Kommentar sendt :-)"
        Page_ShowMenu = False
    ElseIf strMode = "send_comment" Then
        Page_Caption = "Send kommentar"
        Page_ShowMenu = False
    ElseIf strMode = "signup" Or strMode = "confirm" Then
        Page_Caption = "Tilmelding"
        Page_ShowMenu = False
    ElseIf strMode = "report_fake" Then
        Page_Caption = "Anmeld fake billede"
        Page_ShowMenu = False
    ElseIf strMode = "read_comments" Then
        Page_Caption = "Kommentarer"
        Page_ShowMenu = False
    ElseIf strMode = "read_comment" Then
        Page_Caption = "Læs kommentar"
        Page_ShowMenu = False
    ElseIf strMode = "np" Then
        Page_Caption = "Ingen profiler"
        Page_ShowMenu = False
    ElseIf strMode = "edit_profile" And Session("id") > "" Then
        Page_Caption = "Ret dine informationer"
        Page_ShowMenu = False
    ElseIf strMode = "pic_stat" And Session("id") > "" Then
        Page_Caption = "Din statistik"
        Page_ShowMenu = False
    ElseIf strMode = "upload_new" And Session("id") > "" Then
        Page_Caption = "Upload nyt billede"
        Page_ShowMenu = False
    ElseIf strMode = "" Then
        Page_Caption = "Vis profil"

        If strPID = "" Then
            If Session("onlyvote") > "" And Not Session("onlyvote") = "0" Then strWhere = " WHERE gender=" & Session("onlyvote")
            Set Rs = Conn.Execute("SELECT id,rand() AS rnd FROM persons" & strWhere & " ORDER BY rnd LIMIT 0,1")
            If Not Rs.BOF Then
                strPID = Rs(0)
                Response.Redirect "default.asp?pid=" & strPID
            Else
                Response.Redirect "default.asp?mode=np"
            End If
        End If
    End If

    If Page_Caption > "" Then
        Page_Header = Page_Caption
        Page_Caption = " - " & Page_Caption
    End If
%>
Avatar billede dsl Nybegynder
22. juli 2002 - 22:16 #1
lukker har valgt forkert kat.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

Seneste spørgsmål Seneste aktivitet
I går 10:21 Ny printer, men hvilken Af mort1 i Printere
13/0819:41 USB på Linux Af Uvanga i Linux
12/0818:26 Hvilken type mus Af mort1 i PC
11/0813:21 ms Forms Af leahcim i Andet software
10/0821:30 Blokeret på Snapchat? Af LineP i Chat & Messaging