Pagina 1 di 8 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 78

Discussione: Problema db

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2009
    Messaggi
    71

    Problema db

    Non so bene come configurare il db per la registrazione di un utente...quando lo provo in locale mi da questo errore ...Table 'db2.user' doesn't exist
    pero io il db2 lo creato come devo impostarlo per creare i parametri user ecc ecc? vi devo postare il php?

  2. #2
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    guarda che ti sta dicendo che la TABELLA user non esiste...


    praticamente lui cerca nel database db2 nella tabella user (che non esiste)

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2009
    Messaggi
    71
    Originariamente inviato da kodode
    guarda che ti sta dicendo che la TABELLA user non esiste...


    praticamente lui cerca nel database db2 nella tabella user (che non esiste)
    si infatti ho risolto grazie mille xò ora mi da sto errore

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', 'miamail@hotmail.it')' at line 11

  4. #4
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    posta il codice dove fai il salvataggio nel db (dove c'è la query)

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2009
    Messaggi
    71
    Originariamente inviato da kodode
    posta il codice dove fai il salvataggio nel db (dove c'è la query)
    Codice PHP:

    <?php
    require('connessionedb.php');
    $user mysql_real_escape_string($_POST['user']);
    $user_mail $_POST['user'];
    $pass mysql_real_escape_string(md5($_POST['pass']));
    $pass_mail $_POST['pass'];
    $firstname mysql_real_escape_string($_POST['firstname']);
    $lastname =  mysql_real_escape_string($_POST['lastname']);
    $query "SELECT * FROM user " .
              
    "WHERE user_username = '$user' " .
              
    "OR user_email = '$mail' ";
    $result mysql_query($query) or die (mysql_error());
    if (
    mysql_num_rows($result) != 0)
    {
    while (
    $row mysql_fetch_array($result))
    {
       if (
    $row['user_username'] == $user)
      {
       echo 
    "

    "
    ;
       echo 
    "L'username, [b]" $row['user_username'] . "[/b] è già in uso da un altro utente, scegliere uno diverso";
       echo 
    "</p>";
      }
      if (
    $row['user_email'] == $_POST['email'])
      {
       echo 
    "

    "
    ;
       echo 
    "La casella E-mail, [b]" $row['user_email'] . "[/b] è già presente nel Data Base, scegliere una diversa";
       echo 
    "</p>";
      }
    }
    echo 
    "

    "
    ;
    echo 
    "<a href=\"registrazione.php\">";
    echo 
    "<<< Clicca qui per ritornare alla pagina precedente";
    echo 
    "</a>";
    echo 
    "</p>";
    exit();
    }
    else
    {
       switch (
    $_GET['action'])
       {
         case 
    "add":
         switch (
    $_GET['type'])
         {
          case 
    "user":
          
    $sql "INSERT INTO user
                   (user_firstname,
            user_lastname,
             user_username,
            user_password,
            user_email)
          VALUES
            ('
    $firstname',
            '
    $lastname',
            '
    $user',
            
    $pass',
            '" 
    $_POST['email'] . "')";
           
    $users mysql_query($sql) or die(mysql_error());
           
    $id mysql_insert_id(); 
           break;
         }
        break;
       }
    }
    $temp gettimeofday();
    $msec = (int) $temp["usec"];
    $msgid md5(time() . $msec);
    $ins "INSERT INTO confirm
           (confirm_validator,
        confirm_userid)
         VALUES
       ('
    $msgid',
        '
    $id')";
    $res mysql_query($ins) or die(mysql_error());
    ?>
    <html>
    <head>
    <title>Inserimento dati</title>
    </head>
    <body>
    <?php
    $to 
    $_POST["email"];
    $toname $_POST["firstname"];
    $subject "Completa la tua registrazione";

    $boundary "==MP_Bound_xyccr948x==";
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: multipart/alternative; boundary=\"$boundary\"\r\n";
    $headers .= "From: mailda [email]inserire@tuoserver.it[/email]\r\n"//l'indirizzo email
    $html_msg "<center>";
    $html_msg .= "<table width=\"500\" border=0 cellpadding=\"4\">";
    $html_msg .= "<tr><td align=\"center\">";
    $html_msg .= "</td></tr>";
    $html_msg .= "<tr><td>Questi sono i dati della tua registrazione:";
    $html_msg .= "</td></tr><tr><td>Username: <font color=\"red\">" $user_mail "</font>";
    $html_msg .= "</td></tr><tr><td>Password: <font color=\"red\">" $pass_mail "</font>";
    $html_msg .= "</td></tr><tr><td align=\"center\">";
    $html_msg .= "</td></tr></table></center>";
    $confirmmessage "Salve " $toname ",\n\n";
    $confirmmessage .= "per completare la tua registrazione devi cliccare sul link sottostante:\n\n";
    $confirmmessage .= $html_msg "\n\n";
    // inserire il percorso esatto che porta alla nostra pagina confirm_reg.php
    $confirmmessage .= "<a href=\"http://localhost/percorso pagina confirm_reg.php" .
      
    "?id=$msgid\">Clicca qui per confermare la tua registrazione</a>";
    $message "This is a Multipart Message in MIME format\n";
    $message .= "--$boundary\n";
    $message .= "Content-type: text/html; charset=iso-8859-1\n";
    $message .= "Content-Transfer-Encoding: 7bit\n\n";
    $message .= $confirmmessage "\n";
    $message .= "--$boundary--";
    $mailsent mail($to$subject$message$headers);
    if (
    $mailsent)
    {
      echo 
    "Salve" .  $toname ",
    "
    ;
      echo 
    "Un messaggio è stato inviato all'indirizzo [b]" $to "[/b] da te fornito.

    "
    ;
      echo 
    "IMPORTANTE:
    "
    ;
      echo 
    "Per completare la registrazione al sito devi aprire la tua casella e-mail, leggere il messaggio di conferma e cliccare sul link che troverai all'interno.

    "
    ;
    } else {
      echo 
    "Errore durante l'invio dell'e-mail.";
    }
    ?>
    </body>
    </html>

  6. #6
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    un errore l'ho visto... vediamo se era quello ...
    copia e incolla questo codice

    Codice PHP:
    <?php 
    require('connessionedb.php'); 
    $user mysql_real_escape_string($_POST['user']); 
    $user_mail $_POST['user']; 
    $pass mysql_real_escape_string(md5($_POST['pass'])); 
    $pass_mail $_POST['pass']; 
    $firstname mysql_real_escape_string($_POST['firstname']); 
    $lastname =  mysql_real_escape_string($_POST['lastname']); 
    $query "SELECT * FROM user " 
              
    "WHERE user_username = '$user' " 
              
    "OR user_email = '$mail' "
    $result mysql_query($query) or die (mysql_error()); 
    if (
    mysql_num_rows($result) != 0

    while (
    $row mysql_fetch_array($result)) 

       if (
    $row['user_username'] == $user
      { 
       echo 
    "

    "

       echo 
    "L'username, [b]" $row['user_username'] . "[/b] è già in uso da un altro utente, scegliere uno diverso"
       echo 
    "</p>"
      } 
      if (
    $row['user_email'] == $_POST['email']) 
      { 
       echo 
    "

    "

       echo 
    "La casella E-mail, [b]" $row['user_email'] . "[/b] è già presente nel Data Base, scegliere una diversa"
       echo 
    "</p>"
      } 

    echo 
    "

    "

    echo 
    "<a href=\"registrazione.php\">"
    echo 
    "<<< Clicca qui per ritornare alla pagina precedente"
    echo 
    "</a>"
    echo 
    "</p>"
    exit(); 

    else 

       switch (
    $_GET['action']) 
       { 
         case 
    "add"
         switch (
    $_GET['type']) 
         { 
          case 
    "user"
          
    $sql "INSERT INTO user 
                   (user_firstname, 
            user_lastname, 
             user_username, 
            user_password, 
            user_email) 
          VALUES 
            ('
    $firstname', 
            '
    $lastname', 
            '
    $user', 
            '
    $pass', 
            '" 
    $_POST['email'] . "')"
           
    $users mysql_query($sql) or die(mysql_error()); 
           
    $id mysql_insert_id(); 
           break; 
         } 
        break; 
       } 

    $temp gettimeofday(); 
    $msec = (int) $temp["usec"]; 
    $msgid md5(time() . $msec); 
    $ins "INSERT INTO confirm 
           (confirm_validator, 
        confirm_userid) 
         VALUES 
       ('
    $msgid', 
        '
    $id')"
    $res mysql_query($ins) or die(mysql_error()); 
    ?> 
    <html> 
    <head> 
    <title>Inserimento dati</title> 
    </head> 
    <body> 
    <?php 
    $to 
    $_POST["email"]; 
    $toname $_POST["firstname"]; 
    $subject "Completa la tua registrazione"

    $boundary "==MP_Bound_xyccr948x=="
    $headers "MIME-Version: 1.0\r\n"
    $headers .= "Content-type: multipart/alternative; boundary=\"$boundary\"\r\n"
    $headers .= "From: mailda [email]inserire@tuoserver.it[/email]\r\n"//l'indirizzo email 
    $html_msg "<center>"
    $html_msg .= "<table width=\"500\" border=0 cellpadding=\"4\">"
    $html_msg .= "<tr><td align=\"center\">"
    $html_msg .= "</td></tr>"
    $html_msg .= "<tr><td>Questi sono i dati della tua registrazione:"
    $html_msg .= "</td></tr><tr><td>Username: <font color=\"red\">" $user_mail "</font>"
    $html_msg .= "</td></tr><tr><td>Password: <font color=\"red\">" $pass_mail "</font>"
    $html_msg .= "</td></tr><tr><td align=\"center\">"
    $html_msg .= "</td></tr></table></center>"
    $confirmmessage "Salve " $toname ",\n\n"
    $confirmmessage .= "per completare la tua registrazione devi cliccare sul link sottostante:\n\n"
    $confirmmessage .= $html_msg "\n\n"
    // inserire il percorso esatto che porta alla nostra pagina confirm_reg.php 
    $confirmmessage .= "<a href=\"http://localhost/percorso pagina confirm_reg.php" 
      
    "?id=$msgid\">Clicca qui per confermare la tua registrazione</a>"
    $message "This is a Multipart Message in MIME format\n"
    $message .= "--$boundary\n"
    $message .= "Content-type: text/html; charset=iso-8859-1\n"
    $message .= "Content-Transfer-Encoding: 7bit\n\n"
    $message .= $confirmmessage "\n"
    $message .= "--$boundary--"
    $mailsent mail($to$subject$message$headers); 
    if (
    $mailsent

      echo 
    "Salve" .  $toname ",
    "

      echo 
    "Un messaggio è stato inviato all'indirizzo [b]" $to "[/b] da te fornito.

    "

      echo 
    "IMPORTANTE:
    "

      echo 
    "Per completare la registrazione al sito devi aprire la tua casella e-mail, leggere il messaggio di conferma e cliccare sul link che troverai all'interno.

    "

    } else { 
      echo 
    "Errore durante l'invio dell'e-mail."

    ?> 
    </body> 
    </html>

  7. #7
    Utente di HTML.it
    Registrato dal
    Jul 2009
    Messaggi
    71
    Originariamente inviato da kodode
    un errore l'ho visto... vediamo se era quello ...
    copia e incolla questo codice
    ok ora non mi da piu quell errore ma dove stava l errore?

    cmq ora mi da questo errore qua sempre in quel file
    Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first in C:\wamp\www\registrazione_e_gestione_utenti\data_i nsert.php on line 110
    Errore durante l'invio dell'e-mail.

  8. #8
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    mancava un'apice nell'insert...

    ora invece ti dice che c'è un problema con il parametro SMTP, che dovrebbe essere settato nel PHP.ini però non saprei come aiutarti...

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2009
    Messaggi
    71
    Originariamente inviato da kodode
    mancava un'apice nell'insert...

    ora invece ti dice che c'è un problema con il parametro SMTP, che dovrebbe essere settato nel PHP.ini però non saprei come aiutarti...
    ah praticamente devo mettere l smtp del serve con cui faccio mandare le mail x la registrazione del utente? io uso una hotmail per provare che smtp usano?

  10. #10
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    no, la funzione mail() si prende l'SMTP che c'è nel PHP.ini del server dove "gira" il tuo codice.
    quindi devi controllare( o devi far controllare) il php.ini di apache.

    hai un server in locale o su un hosting?

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.