Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Ip su guestbook

  1. #1
    Utente di HTML.it L'avatar di alkresl
    Registrato dal
    Feb 2005
    Messaggi
    270

    Ip su guestbook

    hey raga avrei assolutissimamente bisogno che qualkuno mi aiutasse ad iserirlo, in modo che possa riconoscere gli utenti...


    raga.. vi prego.. è molto importante...

    ecco una mia pagina che registra le info nel mio database...

    Add to guestbook.asp
    codice:
    <%
    
    
    'Dimension variables
    Dim adoCon 			'Holds the Database Connection Object
    Dim rsAddComments		'Holds the recordset for the new record to be added to the database
    Dim strSQL			'Holds the SQL query for the database
    
    'Create an ADO connection odject
    Set adoCon = Server.CreateObject("ADODB.Connection")
    
    'Set an active connection to the Connection object using a DSN-less connection
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
    
    'Set an active connection to the Connection object using DSN connection
    'adoCon.Open "DSN=guestbook"
    
    'Create an ADO recordset object
    Set rsAddComments = Server.CreateObject("ADODB.Recordset")
    
    'Initialise the strSQL variable with an SQL statement to query the database
    strSQL = "SELECT tblComments.Name, tblComments.Comments, tblComments.ip FROM tblComments;"
    
    'Set the cursor type we are using so we can navigate through the recordset
    rsAddComments.CursorType = 2
    
    'Set the lock type so that the record is locked by ADO when it is updated
    rsAddComments.LockType = 3
    
    'Open the tblComments table using the SQL query held in the strSQL varaiable
    rsAddComments.Open strSQL, adoCon
    
    'Tell the recordset we are adding a new record to it
    rsAddComments.AddNew
    
    'Add a new record to the recordset
    rsAddComments.Fields("Name") = Request.Form("name")
    rsAddComments.Fields("Comments") = Request.Form("comments")
    rsAddComments.Fields("ip")=Request.ServerVariables("REMOTE_ADDR")
    
    'Write the updated recordset to the database
    rsAddComments.Update
    
    'Reset server objects
    rsAddComments.Close
    Set rsAddComments = Nothing
    Set adoCon = Nothing
    
    'Redirect to the guestbook.asp page
    Response.Redirect "cellularmania.asp"
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    L'IP è già inserito.
    Non serve a molto a dire il vero. Chi ha l'ip dinamico non lo riconoscerai mai.

    Roby

  3. #3
    Utente di HTML.it L'avatar di alkresl
    Registrato dal
    Feb 2005
    Messaggi
    270
    azz.. che sbadato


    cmq l'errore me lo dà qui:

    guestbook.asp
    codice:
    <html>
    <head>
    <title>MiniCellularmania</title>
    </head>
    <body bgcolor="white" text="black">
    <html>
    <head>
    <title>Guestbook</title>
    </head>
    <body bgcolor="white" text="black">
    <%
    'Dimension variables
    Dim adoCon 			'Holds the Database Connection Object
    Dim rsGuestbook			'Holds the recordset for the records in the database
    Dim strSQL			'Holds the SQL query for the database
    
    
    
    
    'Create an ADO connection odject
    Set adoCon = Server.CreateObject("ADODB.Connection")
    
    'Set an active connection to the Connection object using a DSN-less connection
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
    
    'Set an active connection to the Connection object using DSN connection
    'adoCon.Open "DSN=guestbook"
    
    'Create an ADO recordset object
    Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
    
    'Initialise the strSQL variable with an SQL statement to query the database
    strSQL = "SELECT tblComments.Name, tblComments.Comments, tblComments.ip FROM tblComments;"
    
    'Open the recordset with the SQL query 
    rsGuestbook.Open strSQL, adoCon
    
    'Loop through the recordset
    Do While not rsGuestbook.EOF
    	
    	'Write the HTML to display the current record in the recordset
    	Response.Write ("
    ")
    	Response.Write (rsGuestbook("Name"))
    	Response.Write ("rsGuestbook("Ip")
    	Response.Write ("
    ")
            Response.Write (rsGuestbook("Ora"))
            Response.Write ("
    ")
    	Response.Write (rsGuestbook("Comments"))
    	Response.Write ("
    ")
    
    	'Move to the next record in the recordset
    	rsGuestbook.MoveNext
    
    Loop
    
    'Reset server objects
    rsGuestbook.Close
    Set rsGuestbook = Nothing
    Set adoCon = Nothing
    %>
    </body>
    </html>
    <form name="form" method="post" action="add_to_guestbook.asp">
      NiCK<input type="text" name="name" maxlength="53">  
      
    
      MSG <input type="text" name="comments" maxlength="140">
    	
    
    <input type="submit" name="Submit" value="Invia"></p>
    </form>
    </body>
    </html>



    mi dice:
    Microsoft VBScript compilation error '800a03ee'

    Expected ')'

    /alkresl/prova2/cellularmania2.asp, line 44

    Response.Write ("rsGuestbook("Ip")
    ------------------------------^

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Conta le parentesi...

    codice:
    Response.Write (rsGuestbook("Ip"))
    Roby

  5. #5
    Utente di HTML.it L'avatar di alkresl
    Registrato dal
    Feb 2005
    Messaggi
    270
    azz... ehehe me ne sn dimenticato... di )
    eheheh

    grazie, ma cmq mi dà un altro errore...
    questo :


    ken81.208.74.***

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal.

    /alkresl/prova2/cellularmania2.asp, line 46

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Il campo della riga 46 non esiste nella tabella.
    Leggi bene i tuoi script. E' inutile postare tutti gli errori.
    Cerca di capire quello che scrivi.

    Roby

  7. #7
    Utente di HTML.it L'avatar di alkresl
    Registrato dal
    Feb 2005
    Messaggi
    270
    skusami... azz.. che pirla che sn...
    mi sn fatto sfuggire delle cose molto semplici...
    spero che tu mi possa xdonare...

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Originariamente inviato da alkresl

    spero che tu mi possa xdonare...
    Mai!

    :maLOL:

    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.