• User

    conferma

    ciao ragazzi,
    ho creato con dreamwaver un'area di registrazione con la login e mysql. il problema è che non trovo il tag php che mi consenta di inviare agli utenti registrati la mail di conferma dopo la compilazione del modulo. il codice del file "registrazione.php" a cui vorrei aggiungere lo script per l'invio della email, è il seguente:

    <?php require_once('Connections/connectdw.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    $insertSQL = sprintf("INSERT INTO utenti (nome, cognome, indirizzo, cap, citta, provincia, telefono, email, username, password) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($_POST['nome'], "text"),
    GetSQLValueString($_POST['cognome'], "text"),
    GetSQLValueString($_POST['indirizzo'], "text"),
    GetSQLValueString($_POST['cap'], "text"),
    GetSQLValueString($_POST['citta'], "text"),
    GetSQLValueString($_POST['provincia'], "text"),
    GetSQLValueString($_POST['telefono'], "text"),
    GetSQLValueString($_POST['email'], "text"),
    GetSQLValueString($_POST['username'], "text"),
    GetSQLValueString($_POST['password'], "text"));

    mysql_select_db($database_connectdw, $connectdw);
    $Result1 = mysql_query($insertSQL, $connectdw) or die(mysql_error());

    $insertGoTo = "registrazione_success.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
    }

    mysql_select_db($database_connectdw, $connectdw);
    $query_Rs_provincia = "SELECT province FROM province ORDER BY province ASC";
    $Rs_provincia = mysql_query($query_Rs_provincia, $connectdw) or die(mysql_error());
    $row_Rs_provincia = mysql_fetch_assoc($Rs_provincia);
    $totalRows_Rs_provincia = mysql_num_rows($Rs_provincia);
    ?>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
    <table align="center">
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Nome:</td>
    <td><input type="text" name="nome" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Cognome:</td>
    <td><input type="text" name="cognome" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Indirizzo:</td>
    <td><input type="text" name="indirizzo" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Cap:</td>
    <td><input type="text" name="cap" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Citta:</td>
    <td><input type="text" name="citta" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Provincia:</td>
    <td><select name="provincia">
    <?php
    do {
    ?>
    <option value="<?php echo $row_Rs_provincia['province']?>" ><?php echo $row_Rs_provincia['province']?></option>
    <?php
    } while ($row_Rs_provincia = mysql_fetch_assoc($Rs_provincia));
    ?>
    </select></td>
    </tr>
    <tr> </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Telefono:</td>
    <td><input type="text" name="telefono" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Email:</td>
    <td><input type="text" name="email" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Username:</td>
    <td><input type="text" name="username" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Password:</td>
    <td><input type="password" name="password" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"> </td>
    <td><input type="submit" value="Registrami" /></td>
    </tr>
    </table>
    <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <?php
    mysql_free_result($Rs_provincia);
    ?>


  • User

    ciao, prima di tutto non si chiamano tags, ma funzioni, in questo codice non ho visto nessuna funzione che consenta l'invio dell' e-mail


  • User

    ne ho provate alcune, ma poi le ho eliminate in quanto non risolvono il problema. appunto per ciò, chiedevo quale potesse essere una funzione adatta per questo file, tale da consentirmi l'invio di email di conferma agli utenti che si registrano. grazie :smile5:


  • User

    ti invito a leggere questo tutorial, ti sara molto utile, è proprio quello che cerchi!

    giorgiotave.it/forum/scripting-e-risorse-utili/83033-tutorial-area-privata.html


  • User

    Niente da fare. :bho: Ho visto tutte le funzioni presenti in quel tutorial, le ho applicate ma l'invio della email non avviene. Tra l'altro nel mio form, ho inserito anche un menu a tendina che permette la scelta della provincia di appartenenza. Comunque, grazie lo stesso.


  • User

    Ti conviene farlo da zero lo script, non prendere cose gia fatte! e cerca di studiare come funzionano le funzioni php. comunque la funzione per inviare le mail è [php]
    mail($destinatario, $oggetto, $messaggio);
    [/php]