Visualizzazione dei risultati da 1 a 4 su 4

Discussione: sql inj

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2004
    Messaggi
    108

    sql inj

    salve vi posto il codice asp di verifica per il login in cui ho implementato la fixsql.

    potete gentilmente dirmi se lho implementata in modo corretto?

    grazie


    <%

    Function FixSQL(stringa)
    stringa = Replace(stringa, "'", "''")
    stringa = Replace(stringa, "%", "[%]")
    stringa = Replace(stringa, "[", "[[]")
    stringa = Replace(stringa, "]", "[]]")
    stringa = Replace(stringa, "_", "[_]")
    stringa = Replace(stringa, "#", "[#]")
    FixSQL = stringa
    End function


    Dim nome_ut
    Dim pass
    nome_ut = fixsql(Request.Form("nome_utente"), "'", "''")
    pass = fixsql(Request.Form("password"), "'", "''")

    Dim cn
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("xx.mdb")
    Dim sql
    sql = "SELECT ID FROM Utenti WHERE NOMEUTENTE='" &nome_ut&_
    "' AND PASSWORD='" &pass& "'"

    Dim rs
    Set rs = cn.Execute(sql)

    Dim xx
    if rs.eof then
    xx = false
    else
    xx = true
    end if
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing

    if xx = true then
    Session("xx") = "OK"
    Response.Redirect("xx.asp")
    else
    Response.Redirect("xx.htm")
    end if
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    La funzione fixSQL accetta un parametro... tu gliene hai messi 3...

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2004
    Messaggi
    108

    re

    scusa mi dici dove sta l'errore?

    grazie

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    fixsql(Request.Form("nome_utente"))
    Ammesso che poi la funzione sia corretta, non sono entrato nel merito.

    Roby

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.