Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870

    Utente non riconosciuto.

    Ciao di nuovo.

    Potete spiegarmi dove sbaglio in questo codice che permette il cambio della propria psw d'accesso ad un portale web?

    Inserendo i dati esatti cade cmq sempre nella condizione utente non riconosciuto.

    Il DB è MySQL.

    codice:
    'RECUPERO I DATI DAL FORM
                    strUser = request.form("user")		
    		strCode1 = request.form("act_code")
    		strCode1 = cripta(strCode1,key)
    
    		strCode2 = request.form("new_code1")
    		strCode3 = request.form("new_code2")
    
    		strMail= request.form("mail")
    		
    'CONTROLLO SUI DATI DEL FORM
    	
    	if(strUser<>"") AND (strCode1<>"") AND (strCode2<>"") AND (strCode2=strCode3) AND (strMail<>"") then
    
    'ESEGUO QUERY DI CONTROLLO USERNAME E PSW
    
    		strSql = "SELECT * FROM codici WHERE userName = '"&strUser&"' AND userCode = '"&strCode1&"'"
    		Set rs = Server.CreateObject("ADODB.Recordset")
    		rs.Open strSql, cn, 3, 3
    'SE PRESENTI
    		
    	if not(rs.eof) then
    		
    		UserCode = rs("UserCode")
    		UserCodeDue = rs("UserCodeDue")
    		UserCodeTre = rs("UserCodeTre")
    		UserCodeNuova = cripta(strCode2,Key)
    		
    		UserID = rs("Utente_ID")
    		
    'CONTROLLO SU PSW
    		
    if UserCodeNuova = UserCode or UserCodeNuova = UserCodeDue or UserCodeNuova = UserCodeTre then
    
    RESPONSE.WRITE "Questa password è già stata utilizzata in passato."
    
    'ALTRIMENTI AGGIORNO IL DATO
    
    else
    
    sql_update = "UPDATE codici "
    sql_update = sql_update & " set UserCode = '"&cripta(strCode2,Key)&"', "
    sql_update = sql_update & " where utente_id = "& UserID
    cn.Execute(sql_update)
    
    RESPONSE.WRITE "Utente riconosciuto!"
    
    end if
    
    else
    
    RESPONSE.WRITE "Utente non riconosciuto!"
    
    
    		'chiudo il database
    		rs.Close
    		set rs = Nothing
    		cn.Close 
    		set cn = Nothing
    		
    		end if
    		end if
    		
    		
    %>

  2. #2
    da' un'indentata fatta bene, ché non si capisce dove inizia / finisce un blocco if else endif

  3. #3
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870
    Non è che mi riesce tanto bene, in realtà cmq:

    codice:
    'RECUPERO I DATI DAL FORM
                    strUser = request.form("user")		
    		strCode1 = request.form("act_code")
    		strCode1 = cripta(strCode1,key)
    
    		strCode2 = request.form("new_code1")
    		strCode3 = request.form("new_code2")
    
    		strMail= request.form("mail")
    		
    'CONTROLLO SUI DATI DEL FORM
    	
    	if(strUser<>"") AND (strCode1<>"") AND (strCode2<>"") AND (strCode2=strCode3) AND (strMail<>"") then
    
    'ESEGUO QUERY DI CONTROLLO USERNAME E PSW
    
    		strSql = "SELECT * FROM codici WHERE userName = '"&strUser&"' AND userCode = '"&strCode1&"'"
    		Set rs = Server.CreateObject("ADODB.Recordset")
    		rs.Open strSql, cn, 3, 3
    'SE PRESENTI
    		
    	     if not(rs.eof) then
    		
    		UserCode = rs("UserCode")
    		UserCodeDue = rs("UserCodeDue")
    		UserCodeTre = rs("UserCodeTre")
    		UserCodeNuova = cripta(strCode2,Key)
    		
    		UserID = rs("Utente_ID")
    		
    'CONTROLLO SU PSW
    		
                        if UserCodeNuova = UserCode or UserCodeNuova = UserCodeDue or UserCodeNuova = UserCodeTre then
    
    RESPONSE.WRITE "Questa password è già stata utilizzata in passato."
    
    'ALTRIMENTI AGGIORNO IL DATO
    
                                 else
    
    sql_update = "UPDATE codici "
    sql_update = sql_update & " set UserCode = '"&cripta(strCode2,Key)&"', "
    sql_update = sql_update & " where utente_id = "& UserID
    cn.Execute(sql_update)
    
    RESPONSE.WRITE "Utente riconosciuto!"
    
                        end if
    
           else
    
    RESPONSE.WRITE "Utente non riconosciuto!"
    
    
    		'chiudo il database
    		rs.Close
    		set rs = Nothing
    		cn.Close 
    		set cn = Nothing
    		
    	end if
    end if
    		
    		
    %>

  4. #4
    a fra', mica è difficile

    codice:
    IF ....
       ......
       IF ....
          ....
          IF ...
              ...
          ELSE
              ....
          END IF
          ....
       ELSE
          ...
       END IF
       ....
    ELSE
       ...
    END IF
    le righe sotto la IF le fai rientrare di 3 spazi
    la ELSE la rimetti sotto la IF
    le righe sotto la ELSE le fai rientrare di 3 spazi (come quelle sotto la IF)
    la END IF la rimetti sotto la IF


  5. #5
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870
    Speriamo bene:

    codice:
    'RECUPERO I DATI DAL FORM
                    strUser = request.form("user")		
    		strCode1 = request.form("act_code")
    		strCode1 = cripta(strCode1,key)
    
    		strCode2 = request.form("new_code1")
    		strCode3 = request.form("new_code2")
    
    		strMail= request.form("mail")
    		
    'CONTROLLO SUI DATI DEL FORM
    	
    if(strUser<>"") AND (strCode1<>"") AND (strCode2<>"") AND (strCode2=strCode3) AND (strMail<>"") then
    
    'ESEGUO QUERY DI CONTROLLO USERNAME E PSW
    
    		strSql = "SELECT * FROM codici WHERE userName = '"&strUser&"' AND userCode = '"&strCode1&"'"
    		Set rs = Server.CreateObject("ADODB.Recordset")
    		rs.Open strSql, cn, 3, 3
    'SE PRESENTI
    		
      if not(rs.eof) then
    		
         UserCode = rs("UserCode")
         UserCodeDue = rs("UserCodeDue")
         UserCodeTre = rs("UserCodeTre")
         UserCodeNuova = cripta(strCode2,Key)
         UserID = rs("Utente_ID")
    		
    'CONTROLLO SU PSW
    		
        if UserCodeNuova = UserCode or UserCodeNuova = UserCodeDue or UserCodeNuova = UserCodeTre then
    
           RESPONSE.WRITE "Questa password è già stata utilizzata in passato."
    
    'ALTRIMENTI AGGIORNO IL DATO
    
        else
    
           sql_update = "UPDATE codici "
           sql_update = sql_update & " set UserCode = '"&cripta(strCode2,Key)&"', "
           sql_update = sql_update & " where utente_id = "& UserID
           cn.Execute(sql_update)
    
        RESPONSE.WRITE "Utente riconosciuto!"
    
       end if
    
     else
    
    RESPONSE.WRITE "Utente non riconosciuto!"
    
    
    		'chiudo il database
    		rs.Close
    		set rs = Nothing
    		cn.Close 
    		set cn = Nothing
    		
     end if
    end if
    		
    		
    %>

  6. #6
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870
    E' mai possibile che con access funziona e con mysql no?
    Gli stessi dati di accesso vengono convalidati da access ma non da mysql...

    E' come se non funzionasse più la decriptazione della password:
    codice:
    <%
    	' Parte Modificabile : Chiave INTERA di codifica e decodifica
    	' ATTENZIONE: intKey deve esser compreso tra 0 e 64 
    	dim key
    		key = 5
    	' Fine Parte modificabile
    	
    	function cripta(strTesto,intKey)
    		dim ctInd
    		dim chrAnalisi
    		dim strTesto2
            For ctInd = 1 To Len(strTesto)
    			chrAnalisi = Mid(strTesto, ctInd, 1)
                chrAnalisi = Asc(chrAnalisi) + intKey
                chrAnalisi = chrAnalisi Mod 256
                strTesto2 = strTesto2 & Chr(chrAnalisi)
    		Next
    		cripta=strTesto2
    	end function
    
    	function decripta(strTesto, intKey)
    		dim ctInd
    		dim chrAnalisi
    		dim IntValore
    		dim intResto
    		dim strTesto2
                For ctInd = 1 To Len(strTesto)
                    chrAnalisi = Mid(strTesto, ctInd, 1)
                    intValore = Asc(chrAnalisi)
                    intResto = (intKey + intValore) Mod 256
                    If (intValore + intKey < 256) Then
                        strTesto2 = strTesto2 & Chr(intValore - intKey)
                    Else
                        strTesto2 = strTesto2 & Chr(256 - intKey + intResto)
                    End If
                Next
    			decripta=strTesto2
    	end function
    %>
    Ma ho provato ad inserirla criptata come sta nel db mysql e non funziona lo stesso... :master:

  7. #7
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870
    In questa query i dati passano correttamente:

    codice:
    SELECT * FROM codici WHERE userName = 'pippo' AND userCode = 'P\]ZHW-='
    la usercode è criptata... così come sta nel db mysql ma non mi autorizza...

    :master:

  8. #8
    Utente di HTML.it L'avatar di fraude
    Registrato dal
    Feb 2004
    Messaggi
    2,870
    Scoperto il problema:

    Non so perchè ma mysql non riesce a decifrare questo tipo di psw: P\]ZHW-=

    infatti quando l'ho cambiata l'accesso è stato autorizzato, avete qualche idea? qualche funzione di criptaggio compatibile con mysql?

  9. #9
    Originariamente inviato da fraude
    Scoperto il problema:

    Non so perchè ma mysql non riesce a decifrare questo tipo di psw: P\]ZHW-=

    infatti quando l'ho cambiata l'accesso è stato autorizzato, avete qualche idea? qualche funzione di criptaggio compatibile con mysql?
    boh...provato a vedere sul sito di mysql?

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.