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 èAnticipatamente graziecodice:<% 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", _ "", "", "", "", "", "", "") %>

Rispondi quotando

