Avatar billede kpl Nybegynder
02. marts 2003 - 21:13 Der er 8 kommentarer og
1 løsning

End if ..... fejl?

Jeg bliver ved med at få denne fejl:

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/a_medlemmer/signin.asp, line 140

-----------------

Selvom jeg tilføjer flere

end if


_________Således ser de sidste linier ud:



    rsUser.close
  set rsUser = nothing
  conn.close
  set conn = nothing
  Response.Redirect(page)
end if

else
end if

%>
Avatar billede janeamil Nybegynder
02. marts 2003 - 21:15 #1
Hmm hvorfor sårn prøv

  rsUser.close
  set rsUser = nothing
  conn.close
  set conn = nothing
  Response.Redirect(page)
end if
Avatar billede janeamil Nybegynder
02. marts 2003 - 21:15 #2
Kan jeg se helekoden?
Avatar billede kpl Nybegynder
02. marts 2003 - 21:17 #3
Hej - Det er en lidt lang kode men her kommer den :-)

<!--#include file="global.asp"-->

<!--#include virtual="/db.asp"-->

<%
Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag

'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box)
username = Request.Form("username")
password = Request.Form("password")
page = Request.Form("page")
stayloggedin = Request.Form("stayloggedin")

username = Replace(username,"Æ","&#198;")
username = Replace(username,"Ø","&#216;")
username = Replace(username,"Å","&#197;")
username = Replace(username,"é","&#233;")

'Check no s**t is trying to hack in using SQL commands
if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then
    sqlflag = True
end if

if request("comebackto") <> "" then
        sReferer = request("comebackto")
        sGoBackTo = "?" & request.querystring
    end if

    function Crypt(sText)
        'Removed for security
        Crypt = sText
    end function

    if request("cmdLogin") <> "" then

        sUserName = request("txtUserName")
        sPassword = request("txtPassword")

        OpenDB sConnUsers

        sSQL = "SELECT * FROM dating_Users WHERE UserName = '" & sUserName & "'"
        rs.Open sSQL, , , adCmdTable
        if not (rs.bof or rs.eof) then
            if rs("Password") = sPassword then
                'Login succeeded
                'Store info into session
                session("devUserName") = rs("UserName")
                session("devFullName") = rs("FirstName") & " " & rs("surname")
                if request("chkRemember") <> "" then
                    response.cookies("devUserName") = Crypt(rs("UserName"))
                    response.cookies("devFullName") = Crypt(rs("FirstName") & " " & rs("surName"))
                   
                    response.cookies("devUserName").expires = dateadd("d", 365, Date())
                  response.cookies("devFullName").expires = dateadd("d", 365, Date())
                   
                    response.cookies("devUserName").path = "/"
                    response.cookies("devFullName").path = "/"
                else
                    response.cookies("devUserName") = ""
                    response.cookies("devFullName") = ""
                    response.cookies("devUserName").expires = Date() - 365
                    response.cookies("devFullName").expires = Date() - 365
                end if
                rs("LastLogin") = now
                rs.update
                CloseDB
               




if sqlflag <> true then
'Open connection

'Get a recordset corresponding to the submitted username and password
sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'"
Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.Open sql, conn, 3, 3

'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set
If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then

    session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.

    Dim foundUser, LocalOnline, k
    foundUser = FALSE
    Application.Lock
    LocalOnline = Application("BrugereOnline")
   
    FOR k=0 TO UBOUND( LocalOnline, 2)
        IF LocalOnline(k, 0) = rsUser("id") THEN
            foundUser = TRUE
            EXIT FOR
    END IF
    NEXT
   

   
    IF foundUser = FALSE THEN
    FOR k = 0 TO UBOUND(LocalOnline, 2)
   
        IF LocalOnline(k, 0) = "" THEN
            LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren.
            LocalOnline(k, 1) = rsUser("username")
            LocalOnline(k, 2) = rsUser("sex")
            LocalOnline(k, 3) = rsUser("brugerAlder")
            LocalOnline(k, 4) = rsUser("seek")
                if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede.
                    LocalOnline(k, 5) = true
                else                ' Brugeren har ikke noget billede.
                    LocalOnline(k, 5) = false
                End if
            LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ?
            LocalOnline(k, 7) = NOW()
            EXIT FOR
        END IF
    NEXT
    END IF
    Application("BrugereOnline") = LocalOnline
    Application.UnLock
   
  Response.Cookies("username") = rsUser("username")
    Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes.
  'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date
  session("username")= rsUser("username")
  session("id") = rsUser("id")
  session("logintjek") = true
  if stayloggedin = "yes" then
    Response.Cookies("username").expires = #1/1/2010#
  end if

    rsUser.close
  set rsUser = nothing
  conn.close
  set conn = nothing
  Response.Redirect(page)
end if

else
end if

%>
Avatar billede medions Nybegynder
02. marts 2003 - 21:20 #4
Prøv sådan her:

<!--#include file="global.asp"-->

<!--#include virtual="/db.asp"-->

<%
Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag

'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box)
username = Request.Form("username")
password = Request.Form("password")
page = Request.Form("page")
stayloggedin = Request.Form("stayloggedin")

username = Replace(username,"Æ","&#198;")
username = Replace(username,"Ø","&#216;")
username = Replace(username,"Å","&#197;")
username = Replace(username,"é","&#233;")

'Check no s**t is trying to hack in using SQL commands
if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then
    sqlflag = True
end if

if request("comebackto") <> "" then
        sReferer = request("comebackto")
        sGoBackTo = "?" & request.querystring
end if

    function Crypt(sText)
        'Removed for security
        Crypt = sText
    end function

    if request("cmdLogin") <> "" then

        sUserName = request("txtUserName")
        sPassword = request("txtPassword")

        OpenDB sConnUsers

        sSQL = "SELECT * FROM dating_Users WHERE UserName = '" & sUserName & "'"
        rs.Open sSQL, , , adCmdTable
        if not (rs.bof or rs.eof) then
            if rs("Password") = sPassword then
                'Login succeeded
                'Store info into session
                session("devUserName") = rs("UserName")
                session("devFullName") = rs("FirstName") & " " & rs("surname")
            End If
           
                if request("chkRemember") <> "" then
                    response.cookies("devUserName") = Crypt(rs("UserName"))
                    response.cookies("devFullName") = Crypt(rs("FirstName") & " " & rs("surName"))
                   
                    response.cookies("devUserName").expires = dateadd("d", 365, Date())
                  response.cookies("devFullName").expires = dateadd("d", 365, Date())
                   
                    response.cookies("devUserName").path = "/"
                    response.cookies("devFullName").path = "/"
                else
                    response.cookies("devUserName") = ""
                    response.cookies("devFullName") = ""
                    response.cookies("devUserName").expires = Date() - 365
                    response.cookies("devFullName").expires = Date() - 365
                end if
               
                rs("LastLogin") = now
                rs.update
                CloseDB
               




if sqlflag <> true then
'Open connection

'Get a recordset corresponding to the submitted username and password
sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'"
Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.Open sql, conn, 3, 3

End If

'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set
If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then

    session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.

    Dim foundUser, LocalOnline, k
    foundUser = FALSE
    Application.Lock
    LocalOnline = Application("BrugereOnline")
   
    FOR k=0 TO UBOUND( LocalOnline, 2)
        IF LocalOnline(k, 0) = rsUser("id") THEN
            foundUser = TRUE
            EXIT FOR
    END IF
    NEXT
   

   
    IF foundUser = FALSE THEN
    FOR k = 0 TO UBOUND(LocalOnline, 2)
   
        IF LocalOnline(k, 0) = "" THEN
            LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren.
            LocalOnline(k, 1) = rsUser("username")
            LocalOnline(k, 2) = rsUser("sex")
            LocalOnline(k, 3) = rsUser("brugerAlder")
            LocalOnline(k, 4) = rsUser("seek")
                if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede.
                    LocalOnline(k, 5) = true
                else                ' Brugeren har ikke noget billede.
                    LocalOnline(k, 5) = false
                End if
            LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ?
            LocalOnline(k, 7) = NOW()
            EXIT FOR
        END IF
    NEXT
    END IF
    Application("BrugereOnline") = LocalOnline
    Application.UnLock
   
  Response.Cookies("username") = rsUser("username")
    Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes.
  'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date
  session("username")= rsUser("username")
  session("id") = rsUser("id")
  session("logintjek") = true
  if stayloggedin = "yes" then
    Response.Cookies("username").expires = #1/1/2010#
  end if

    rsUser.close
  set rsUser = nothing
  conn.close
  set conn = nothing
  Response.Redirect(page)
end if
end if

%>

//>Rune
Avatar billede medions Nybegynder
02. marts 2003 - 21:22 #5
Hmm sådan her :-)

<!--#include file="global.asp"-->

<!--#include virtual="/db.asp"-->

<%
Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag

'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box)
username = Request.Form("username")
password = Request.Form("password")
page = Request.Form("page")
stayloggedin = Request.Form("stayloggedin")

username = Replace(username,"Æ","&#198;")
username = Replace(username,"Ø","&#216;")
username = Replace(username,"Å","&#197;")
username = Replace(username,"é","&#233;")

'Check no s**t is trying to hack in using SQL commands
if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then
    sqlflag = True
end if

if request("comebackto") <> "" then
        sReferer = request("comebackto")
        sGoBackTo = "?" & request.querystring
end if

    function Crypt(sText)
        'Removed for security
        Crypt = sText
    end function

    if request("cmdLogin") <> "" then

        sUserName = request("txtUserName")
        sPassword = request("txtPassword")

        OpenDB sConnUsers

        sSQL = "SELECT * FROM dating_Users WHERE UserName = '" & sUserName & "'"
        rs.Open sSQL, , , adCmdTable
        if not (rs.bof or rs.eof) then
            if rs("Password") = sPassword then
                'Login succeeded
                'Store info into session
                session("devUserName") = rs("UserName")
                session("devFullName") = rs("FirstName") & " " & rs("surname")
            End If
           
                if request("chkRemember") <> "" then
                    response.cookies("devUserName") = Crypt(rs("UserName"))
                    response.cookies("devFullName") = Crypt(rs("FirstName") & " " & rs("surName"))
                   
                    response.cookies("devUserName").expires = dateadd("d", 365, Date())
                  response.cookies("devFullName").expires = dateadd("d", 365, Date())
                   
                    response.cookies("devUserName").path = "/"
                    response.cookies("devFullName").path = "/"
                else
                    response.cookies("devUserName") = ""
                    response.cookies("devFullName") = ""
                    response.cookies("devUserName").expires = Date() - 365
                    response.cookies("devFullName").expires = Date() - 365
                end if
               
                rs("LastLogin") = now
                rs.update
                CloseDB
        End If
  End If
               




if sqlflag <> true then
'Open connection

'Get a recordset corresponding to the submitted username and password
sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'"
Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.Open sql, conn, 3, 3

End If

'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set
If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then

    session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.

    Dim foundUser, LocalOnline, k
    foundUser = FALSE
    Application.Lock
    LocalOnline = Application("BrugereOnline")
   
    FOR k=0 TO UBOUND( LocalOnline, 2)
        IF LocalOnline(k, 0) = rsUser("id") THEN
            foundUser = TRUE
            EXIT FOR
    END IF
    NEXT
   

   
    IF foundUser = FALSE THEN
    FOR k = 0 TO UBOUND(LocalOnline, 2)
   
        IF LocalOnline(k, 0) = "" THEN
            LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren.
            LocalOnline(k, 1) = rsUser("username")
            LocalOnline(k, 2) = rsUser("sex")
            LocalOnline(k, 3) = rsUser("brugerAlder")
            LocalOnline(k, 4) = rsUser("seek")
                if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede.
                    LocalOnline(k, 5) = true
                else                ' Brugeren har ikke noget billede.
                    LocalOnline(k, 5) = false
                End if
            LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ?
            LocalOnline(k, 7) = NOW()
            EXIT FOR
        END IF
    NEXT
    END IF
    Application("BrugereOnline") = LocalOnline
    Application.UnLock
   
  Response.Cookies("username") = rsUser("username")
    Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes.
  'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date
  session("username")= rsUser("username")
  session("id") = rsUser("id")
  session("logintjek") = true
  if stayloggedin = "yes" then
    Response.Cookies("username").expires = #1/1/2010#
  end if

    rsUser.close
  set rsUser = nothing
  conn.close
  set conn = nothing
  Response.Redirect(page)
end if

%>

//>Rune
Avatar billede kpl Nybegynder
02. marts 2003 - 21:24 #6
Medions: Samme fejl

Microsoft VBScript compilation error '800a03f6'

Expected 'End'
Avatar billede medions Nybegynder
02. marts 2003 - 21:25 #7
Hmm i hvilken linje?

//>Rune
Avatar billede kpl Nybegynder
02. marts 2003 - 21:26 #8
Medions ..Ups - der var jeg for hurtig til at acceptere....men i samme minut kommer der en rettelse fra dig og det virkede. Så alt er perfekt - TAKKER!
Avatar billede medions Nybegynder
02. marts 2003 - 21:27 #9
*G* Fair nok :-)
Thx 4 Poinz

//>Rune
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
Kurser inden for grundlæggende programmering

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