Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 19 su 19
  1. #11
    questo era in access e stramegafunzionava, a questo punto tu dirai e lascialo in access... ebbravo vallo dire al capo vallo a dire...

    <%@ Language=VBScript %>
    <% option explicit %>
    <%Response.Buffer=true%>
    <%
    Dim user
    Dim password
    Dim pagina
    user = Replace(Request.Form("user"), "'", "''")
    password = Replace(Request.Form("password"), "'", "''")
    Dim cn
    Dim autenticato
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("utenti.mdb")
    Dim sql
    sql = "SELECT ID FROM Utenti WHERE user='" &user&_
    "' AND PASSWORD='" &password& "'"
    Dim rs
    Set rs = cn.Execute(sql)


    if rs.eof then
    autenticato = false
    else
    autenticato = true
    end if

    if autenticato = true then
    Session("Autenticato") = "OK"
    server.transfer("portale.asp")
    else
    Response.Redirect("negative.asp")
    end if
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing

    %>

  2. #12
    Utente di HTML.it L'avatar di Sypher
    Registrato dal
    Jun 2003
    Messaggi
    1,994
    se fai questa response?

    codice:
    <%@ Language=VBScript %> 
    <% option explicit %> 
    <%Response.Buffer=true%> 
    <% 
    Dim user 
    Dim password 
    Dim pagina 
    user = Replace(Request.Form("user"), "'", "''") 
    password = Replace(Request.Form("password"), "'", "''") 
    Dim cn 
    Dim autenticato 
    Dim cn 
    Dim strSQLConn 
    
    strSQLConn= "Driver={SQL Server};Server=localhost;Database=Estraz
    ioniAs400;UID=sa;PWD=sa;" 
    
    Set cn = Server.CreateObject("ADODB.Connection") 
    Response.Write("OK")
    Response.End 
    cn.Open strSQLConn 
    ...
    %>
    e poi sposti il response.end dopo la open della connessione
    La passera non dura perchè Sypher la cattura!

    "No one like us we don't care, we are millwall, super millwall, we are millwall from the DEN"

  3. #13
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    27
    nada

  4. #14
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    strSQLConn= "Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=EstrazioniAs400;User ID=sa;Password=sa;"

    Roby

  5. #15
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    27
    provaten ma non funzionare...

    che mica esiste uno script specifico di autenticazione asp + sql? Ho provato a cercare ma niente...

  6. #16
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non hai ancora detto che errore ti da...
    Dobbiamo buttare ad indovinare?


    Roby

  7. #17
    giusto ma se ti chiamano in continuazione... allora ho modificato un po' il codice come segue:

    <%@ Language=VBScript %>
    <% option explicit %>
    <%Response.Buffer=true%>
    <%
    Dim cn
    Dim strSQLConn
    Dim rs
    Dim user
    Dim password
    Dim autenticato
    Dim sqlstr
    user = Replace(Request.Form("user"), "'", "''")
    password = Replace(Request.Form("password"), "'", "''")
    strSQLConn= "Driver={SQL Server};Server=localhost;Database=EstrazioniAs400; UID=sa;PWD=sa;"
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open strSQLConn
    Set Rs=Server.createobject("ADODB.Recordset")
    SQLStr="SELECT esttabellaagenti FROM utenti where desagente = '" & user & "' and password = "' & password & "'"
    rs.open SQLStr, cn
    while not rs.eof



    if rs.eof then
    autenticato = "false"
    else
    autenticato = "true"
    end if
    wend
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing

    if autenticato = "true" then
    Session("Autenticato") = "ok"
    server.transfer("portale.asp")
    else
    Response.Redirect("negative.asp")
    end if
    %>

    ma ottengo:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.

    /sitoagenti/login.asp, line 19

    aiuto!!!

  8. #18
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Okkio alle virgolette:

    codice:
    SQLStr="SELECT esttabellaagenti FROM utenti where desagente = '" & user & "' and password = '"& password & "'"
    Roby

  9. #19
    ok giusto... funziona tutto. grazie troppe

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 © 2026 vBulletin Solutions, Inc. All rights reserved.