Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Controllo accessi

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2016
    Messaggi
    13

    Controllo accessi

    Ciao, mi trovo a dover modificare un form di accesso in ASP dove devono essere inseriti 3 parametri:

    - azienda
    - utente
    - password

    Fino ad ora è stato possibile inserire diversi nomi di aziende per accedere, la mia necessità è fare in modo che sia uno solo il nome valido.

    Ho provato a fare diverse modifiche ottenendo solo accesso negato, o errori nell'accedere.

    Il mio codice è
    codice:
    <% 
    
    Dim strPath
    Dim strAzienda
    Dim strUserID
    Dim strPassword
    Dim bRet
    
    strPath = "/mdb-database"
    strAzienda = Request.Form("fAzienda")
    strAzienda = replace(UCase(strAzienda),"PIPPO","PIPPO1") 'si può fare il login con azienda PIPPO o PIPPO1
    strUserID = Request.Form("fUserID")
    strPassword = Request.Form("fPassword")
    
    ' Controllo dei parametri
    
    if isnull(strAzienda) or (strAzienda = "") then _
        Response.Redirect "page.asp?IDPage=ErrUserIDNull"
    
    if isnull(strUserID) or (strUserID = "") then _
        Response.Redirect "page.asp?IDPage=ErrUserIDNull"
    
    if isnull(strPassword) or (strPassword = "") then _
        Response.Redirect "page.asp?IDPage=ErrPwdNull"
    
    ' Verifica esistenza Azienda
    if (UCase(strAzienda) <> "PIPPO") and (UCase(strAzienda) <> "PIPPOBG")  _
     and (UCase(strAzienda) <> "PIPPOBS" and (UCase(strAzienda) <> "PIPPOPD")  _ 
     and (UCase(strAzienda) <> "PIPPOBO") and (UCase(strAzienda) <> "PIPPOD2")  _ 
     and (UCase(strAzienda) <> "PIPPOGE") and (UCase(strAzienda) <> "PIPPORM")) _ 
     and (UCase(strAzienda) <> "PIPPOZZZ") _
     then _
        Response.Redirect "page.asp?IDPage=ErrLogAz"
    
    if ((strUserID = "SylvieVartan") AND (strPassword = "DNEU3JKSL3KQ")) then 'disabilito accesso come superutente che non ha check IP
        'strUserID = "ADMIN"
        response.write "accesso non consentito per questo IP. Configurare login.asp per l'accesso di questo utente"
        response.end
    else
        ' Verifica corrispondenza UT - PWD
        if Not fncCheckUser(strPath, strAzienda, strUserID, fncCript("E", strPassword)) then _
            Response.Redirect "page.asp?IDPage=ErrLogUtPwd"
        
        ' Verifica indirizzo IP di provenienza
        if Not fncCheckIP(Request.ServerVariables("REMOTE_ADDR"),strAzienda) then _
            Response.Redirect "page.asp?IDPage=ErrIP"
    end if
    
    ' Ottengo e memorizzo un codice univoco di sessione
    strSessionID = fncGetSessionID(strPath, strAzienda, strUserID)
    bRet = fncSessionParam(strPath, strAzienda, "Set", strSessionID, "Login", "1")
    bRet = fncSessionParam(strPath, strAzienda, "Set", strSessionID, "UserID", strUserID)
        
    Session("USERID") = strUserID    
    response.cookies("USERID") = strUserID
    Response.Cookies ("USERID").Expires = date() + 1    
    'Response.Cookies ("USERID").Path = "/" 
    Response.Redirect fncMakeQueryString("appl/frameset.asp", strAzienda, strSessionID, "Menu", _
        "", "", "", "", "", "", "")
    
    %>
    Anticipatamente grazie

  2. #2
    spiega meglio il concetto " la mia necessità è fare in modo che sia uno solo il nome valido"

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2016
    Messaggi
    13
    Hai ragione...dunque in questo momento il database conta circa 20 utenti con quindi 20 password che possono entrare come aziende diverse, 6 in totale.

    La necessità è quella di permettere l'accesso degli utenti come unica azienda (diversa da quelle attuali).

  4. #4
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,812
    a me tutto quel confronto "pippo alla10cima" pare una roba inutilmente complicata...

    la tabella degli account come è strutturata?

    non puoi chiedere, semplicemente, la combinazione dei tre elementi azienda/user/pass?

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.