Pagina 1 di 6 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 51

Discussione: aiutatemi a loggarmi

  1. #1

    aiutatemi a loggarmi

    Sto cercando di far funzionare una pagina di login, ma una volta inviati "username" e "password", mi da errore: Impossibile visualizzare la pagina..

    Nella LOGIN_CLUB.ASP
    invio i dati tramite: <form action="enter_club.asp" method=POST>

    Nella ENTER_CLUB.ASP
    ho questo codice:
    <%@Language=VBscript%>
    <%
    username = request.form("username")
    password = request.form("password")
    dim cn
    dim rs
    set rs = Server.CreateObject("ADODB.Recordset")
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "DRIVER={Microsoft Access Driver (*.mdb)};PWD=..;DBQ=" & server.MapPath("/mdb-database/DB.mdb")

    sql = "select * from Club "&_
    "where username = '"&username&"'"&" and Password = '"&password&"'"
    rs.Open sql, cn, 1
    found = rs.recordcount
    rs.close
    cn.Close
    set rs = Nothing
    set cn = Nothing

    if found = 1 then
    if username="webmaster" and password="x1" then
    Session("rb_accesso") = True
    response.redirect "http://www.club.it/home.htm?username="&username
    end if
    else
    response.redirect "login_club.asp?error=1"
    end if

    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    <%@Language=VBscript%>
    <%
    username = trim(request.form("username"))
    username = replace(username, "'", "''")
    password = trim(request.form("password"))
    password = replace(password, "'", "''") 
    dim cn 
    dim rs 
    set rs = Server.CreateObject("ADODB.Recordset")
    Set cn = Server.CreateObject("ADODB.Connection") 
    cn.Open "DRIVER={Microsoft Access Driver (*.mdb)};PWD=..;DBQ=" & server.MapPath("/mdb-database/DB.mdb") 
    
    found = false 
    sql = "select * from Club "&_
    "where username = '"&username&"' and [Password] = '"&password&"'"
    rs.Open sql, cn, 1
    if not rs.eof then
    found = true
    end if 
    rs.close
    cn.Close
    set rs = Nothing
    set cn = Nothing 
    
    if found then
    Session("rb_accesso") = True
    response.redirect "http://www.club.it/home.htm?username="&username
    else
    response.redirect "login_club.asp?error=1"
    end if 
    %>
    Roby

  3. #3
    Niente ancora, sempre lo stesso errore..
    ??

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Menu strumenti --> opzioni internet --> avanzate di Internet Explorer e disabilita la voce "Mostra messaggi di errore HTTP brevi".

    Fai ripartire la pagina, guarda l'errore e postalo qui!

    Roby

  5. #5
    da questo errore:

    Microsoft VBScript compilation error '800a0400'

    Expected statement

    enter_club.asp, line 19

    end if
    ^

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Hai fatto copia/incolla di quello che ho scritto io???

    Roby

  7. #7
    certo ho copiato tutte le parti in neretto..

  8. #8

  9. #9
    <%@Language=VBscript%>
    <%
    username = trim(request.form("username"))
    username = replace(username, "'", "''")
    password = trim(request.form("password"))
    password = replace(password, "'", "''")
    dim cn
    dim rs
    set rs = Server.CreateObject("ADODB.Recordset")
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "DRIVER={Microsoft Access Driver (*.mdb)};PWD=xx;DBQ=" & server.MapPath("/mdb-database/DB.mdb")

    found = false
    sql = "select * from Club "&_
    "where username = '"&username&"' and [Password] = '"&password&"'"
    rs.Open sql, cn, 1
    found = rs.recordcount
    found = true
    end if
    rs.close
    cn.Close
    set rs = Nothing
    set cn = Nothing

    if found then
    if username="webmaster" and password="jes999" then
    Session("rb_accesso") = True
    response.redirect "http://www.club.it/home.htm?username="&username
    end if
    else
    response.redirect "login_club.asp?error=1"
    end if

    %>

  10. #10
    c'è un if non chiuso.
    1. impara a indentare bene il codice
    2. usa [CODE] quando posti il codice


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.