Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    errore invio dati guestbook

    pur immettendo tutti i dati richiesti, mi va sempre in errore

    Guestbook <- Provate ad inserire un messaggio.....da cosa puo dipendere

  2. #2
    C'è un redirect sull'errore...

    Posta il codice di inserimento!

  3. #3
    <%
    }
    else if (azione == "Inserisci")
    {
    // RECUPERO I DATI DAL MODULO PER EFFETTUARE LA REGISTRAZIONE
    var nome = new String(Request.Form("nome"));
    var email = new String(Request.Form("email"));
    var homepage = new String(Request.Form("homepage"));
    var titolo = new String(Request.Form("titolo"));
    var messaggio = new String(Request.Form("messaggio"));
    // ESPRESSIONE REGOLARE PER LA VERIFICA DELL'INDIRIZZO EMAIL
    var verifica = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    // CREO LA DATA
    var oggi = new Date();
    var data = oggi.getDate() + "/" + (oggi.getMonth() + 1) + "/" + oggi.getFullYear();
    var ora = oggi.getHours() + ":" + oggi.getMinutes();
    // VALIDAZIONE DEI DATI INSERITI DALL'UTENTE
    var errore = "guestbook.asp?azione=errore&codice=";
    if (nome == "" || nome == "undefined" || nome.charAt(0) == " ")
    {
    Response.Redirect(errore + "1");
    }
    else if (!verifica.test(email))
    {
    Response.Redirect(errore + "2");
    }
    else if (titolo == "" || titolo == "undefined" || titolo.charAt(0) == " ")
    {
    Response.Redirect(errore + "3");
    }
    else if (messaggio == "" || messaggio == "undefined" || messaggio.charAt(0) == " ")
    {
    Response.Redirect(errore + "4");
    }
    else
    {
    var r_messaggio = messaggio.replace(/</g, "&lt;");
    var rr_messaggio = r_messaggio.replace(/>/g, "&gt;");
    var rrr_messaggio = rr_messaggio.replace(/&/g, "&amp;");
    var rrrr_messaggio = rrr_messaggio.replace(/\n/g, "
    ");
    // CASO IN CUI TUTTE LE CONDIZIONI SONO STATE SODDISFATTE
    // QUINDI PROCEDO CON LA REGISTRAZIONE DEL MESSAGGIO
    var recordset = new ActiveXObject("ADODB.Recordset");
    recordset.Open("messaggi",connessione,3,3);
    recordset.AddNew();
    recordset("nome") = nome;
    recordset("email") = email;
    recordset("homepage") = homepage;
    recordset("titolo") = titolo;
    recordset("messaggio") = rrrr_messaggio;
    recordset("data") = data;
    recordset("ora") = ora;
    recordset.Update();
    recordset.Close();
    Response.Redirect("guestbook.asp");
    }
    }
    else if (azione == "errore")
    {
    // GESTIONE DEI MESSAGGI DI ERRORE
    var codice = parseInt(Request.QueryString("codice"));
    var correggi = "<p align=\"center\"><input type=\"button\" value=\"Correggi\" onClick=\"window.history.back()\">";
    if (codice == "1")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci il tuo nome per favore</p>" + correggi);
    }
    else if (codice == "2")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci la tua email per favore</p>" + correggi);
    }
    else if (codice == "2")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci la tua email per favore</p>" + correggi);
    }

    else if (codice == "4")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci il corpo del messaggio per favore</p>" + correggi);
    }
    else
    {
    Response.Redirect("guestbook.asp");
    }
    }
    else if (azione == "Login")
    {
    // LOGIN PER L'AMMINISTRATORE
    var password = new String(Request.Form("password"));
    if (password == admin_password)
    {
    Session("amministratore") = "OK";
    }
    Response.Redirect("guestbook.asp");
    }
    else if (azione == "Logout")
    {
    // LOGOUT PER L'AMMINISTRATORE
    Session.Abandon();
    Response.Redirect("guestbook.asp");
    }
    else if (azione == "Cancella")
    {
    // EFFETTUO LA CANCELLAZIONE DEL MESSAGGIO (SOLO SE AUTENTICATO)
    if (Session("amministratore") != null)
    {
    var id = parseInt(Request.QueryString("id"));
    connessione.Execute("DELETE * FROM messaggi WHERE id LIKE '" + id + "'");
    }
    Response.Redirect("guestbook.asp");
    }
    else
    {
    Response.Redirect("guestbook.asp");
    }
    %>

  4. #4
    Fai i controlli sul campo titolo che nel form non esiste

  5. #5
    ho tolto i controlli ma sempre stesso errore
    <%
    }
    else if (azione == "Inserisci")
    {
    // RECUPERO I DATI DAL MODULO PER EFFETTUARE LA REGISTRAZIONE
    var nome = new String(Request.Form("nome"));
    var email = new String(Request.Form("email"));
    var homepage = new String(Request.Form("homepage"));
    var messaggio = new String(Request.Form("messaggio"));
    // ESPRESSIONE REGOLARE PER LA VERIFICA DELL'INDIRIZZO EMAIL
    var verifica = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    // CREO LA DATA
    var oggi = new Date();
    var data = oggi.getDate() + "/" + (oggi.getMonth() + 1) + "/" + oggi.getFullYear();
    var ora = oggi.getHours() + ":" + oggi.getMinutes();
    // VALIDAZIONE DEI DATI INSERITI DALL'UTENTE
    var errore = "guestbook.asp?azione=errore&codice=";
    if (nome == "" || nome == "undefined" || nome.charAt(0) == " ")
    {
    Response.Redirect(errore + "1");
    }
    else if (!verifica.test(email))
    {
    Response.Redirect(errore + "2");
    }
    Response.Redirect(errore + "3");
    }
    else if (messaggio == "" || messaggio == "undefined" || messaggio.charAt(0) == " ")
    {
    Response.Redirect(errore + "4");
    }
    else
    {
    var r_messaggio = messaggio.replace(/</g, "&lt;");
    var rr_messaggio = r_messaggio.replace(/>/g, "&gt;");
    var rrr_messaggio = rr_messaggio.replace(/&/g, "&");
    var rrrr_messaggio = rrr_messaggio.replace(/\n/g, "
    ");
    // CASO IN CUI TUTTE LE CONDIZIONI SONO STATE SODDISFATTE
    // QUINDI PROCEDO CON LA REGISTRAZIONE DEL MESSAGGIO
    var recordset = new ActiveXObject("ADODB.Recordset");
    recordset.Open("messaggi",connessione,3,3);
    recordset.AddNew();
    recordset("nome") = nome;
    recordset("email") = email;
    recordset("homepage") = homepage;
    recordset("messaggio") = rrrr_messaggio;
    recordset("data") = data;
    recordset("ora") = ora;
    recordset.Update();
    recordset.Close();
    Response.Redirect("guestbook.asp");
    }
    }
    else if (azione == "errore")
    {
    // GESTIONE DEI MESSAGGI DI ERRORE
    var codice = parseInt(Request.QueryString("codice"));
    var correggi = "<p align=\"center\"><input type=\"button\" value=\"Correggi\" onClick=\"window.history.back()\">";
    if (codice == "1")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci il tuo nome per favore</p>" + correggi);
    }
    else if (codice == "2")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci la tua email per favore</p>" + correggi);
    }
    else if (codice == "2")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci la tua email per favore</p>" + correggi);
    }

    else if (codice == "4")
    {
    Response.Write("<p class=\"ERRORE\">Inserisci il corpo del messaggio per favore</p>" + correggi);
    }
    else
    {
    Response.Redirect("guestbook.asp");
    }
    }
    else if (azione == "Login")
    {
    // LOGIN PER L'AMMINISTRATORE
    var password = new String(Request.Form("password"));
    if (password == admin_password)
    {
    Session("amministratore") = "OK";
    }
    Response.Redirect("guestbook.asp");
    }
    else if (azione == "Logout")
    {
    // LOGOUT PER L'AMMINISTRATORE
    Session.Abandon();
    Response.Redirect("guestbook.asp");
    }
    else if (azione == "Cancella")
    {
    // EFFETTUO LA CANCELLAZIONE DEL MESSAGGIO (SOLO SE AUTENTICATO)
    if (Session("amministratore") != null)
    {
    var id = parseInt(Request.QueryString("id"));
    connessione.Execute("DELETE * FROM messaggi WHERE id LIKE '" + id + "'");
    }
    Response.Redirect("guestbook.asp");
    }
    else
    {
    Response.Redirect("guestbook.asp");
    }
    %>

  6. #6
    l'errore me lo da se metto un img al posto del classico pulsante
    <input type="submit" value=" Firma il Guestbook ">

  7. #7

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.