• User Attivo

    per quanto riguarda la scrittura del file ... forse ci sto riuscendo .. allora ecco il codice che ho aggiunto:

    function add_to_list($email) {
    // Adds the email address to the data file.
    $nome = $_POST['nome'];
    global $list_file;
    $fd = @fopen($list_file, "a") or die("<center><b>The list data file could not be opened.</b><br>Check the path and permissions.</center>");
    fputs($fd, strtolower($nome));
    fputs($fd, strtolower($email)."\n");
    fclose($fd);
    return true;
    }

    però cosi il nome e l'email viene attaccato non riesco a dare lo spazio tra le due variabili


  • User Attivo

    fai così (in questo modo scriverà, ad esempio: nomeutente - [EMAIL="[email protected]"][email protected][/EMAIL] 😞

    function add_to_list($email) {
    // Adds the email address to the data file.
    $nome = $_POST['nome'];
    global $list_file;
    $fd = @fopen($list_file, "a") or die("<center><b>The list data file could not be opened.</b><br>Check the path and permissions.</center>");
    fputs($fd, strtolower($nome). " - " . strtolower($email)."\n");
    fclose($fd);
    return true;
    }


  • User Attivo

    perfetto funziona .. ma c'è un piccolo problem ... quando provo a cancellare l'email tramite Unsubscribe selezionato ... l'email non viene cancellata , ovviamente la funzione :
    function remove_from_list($email) {
    // Removes the address from the file.
    global $list_file;
    $file = @file($list_file);
    $success = false;
    $fd = @fopen($list_file, "w") or die("<center><b>The list data file could not be opened for writing.</b></center>");
    if ($file) {
    foreach($file as $address) {
    $address = trim($address);
    if ($address != $email) fputs($fd, "$address\n");
    else $success = true;
    }
    fclose($fd);
    }
    return $success;
    }

    non riconosce:

    nome utente - email

    ?????????????????????


  • User Attivo

    Prova questa soluzione:

    function remove_from_list($email) {
    // Removes the address from the file.
    global $list_file;
    $file = @file($list_file);
    $success = false;
    $fd = @fopen($list_file, "w") or die("<center><b>The list data file could not be opened for writing.</b></center>");
    if ($file) {
    foreach($file as $address) {
    $address2 = trim(substr(stristr($address, "-"),2));
    if ($address2 != $email) fputs($fd, "$address\n");
    else $success = true;
    }
    fclose($fd);
    }
    return $success;
    }


  • User Attivo

    Ok Tutto Perfetto ... Sei Ingamba... Ci Sentiamo ...


  • User Attivo

    è sempre un piacere aiutare le persone riconoscenti! :ciauz:


  • User Attivo

    ienavr ho un piccolo problema ... l'email e nomi posso essere registrati continuamente anche già presente nel file list.dat ... il codice in questione dovrebbe essere questo:

    [php]
    function subscribe($email, $nome, $send_confirm, $send_welcome) {
    // Subscribes address to list.
    global $list_name;
    if (($email == ""))
    {
    print_subscribe_form();
    }
    else {
    if (!banned($email)) {
    if (!on_list($email)) {
    if (valid_email($email)) {
    if ($send_confirm == "on") {
    send_confirm($email);
    echo "<h4 align="center">"$nome" Grazie per la tua registrazione a "$list_name".</h4><center>Un e-mail è stata inviata a "$email" asking you to confirm your subscription.<br>Please follow those instructions to complete the process.</center>";
    }
    else {
    if (add_to_list($email)) {
    echo "<h4 align="center">"$nome" l'e-mail: "$email" è stata registrata corettamente in "$list_name".</h4>";
    if ($send_welcome == "on") {
    send_welcome($email);
    echo "<br><center>Riceverai a breve un e-mail con le informazioni per scaricare gratuitamente i tuoi due regali, Grazie. <br><br><img src="logo copia ok.png" alt="logo Tendaggi" /><br><br>|<a href="http://www.fgtendaggi.it">Vai alla Home</a>| <a href="http://www.fgtendaggi.it/tende e tendaggi.html"> Visita il sito</a>|</center>";
    }
    }
    }
    }
    else echo "<h4 align="center">L'indirizzo e-mail: "$email" non è valido.</h4>";
    }
    else echo "<h4 align="center">L'e-mail: "$email" risulta già nel nostro database.<br> Se vuoi scaricare nuovamente i due regali contattaci a [email protected]</h4> <br><br><img src="logo copia ok.png" alt="logo Tendaggi" /><br><br>|<a href="http://www.fgtendaggi.it">Vai alla Home</a>| <a href="http://www.fgtendaggi.it/tende e tendaggi.html"> Visita il sito</a>|</center>";
    }
    else echo "<h4 align="center">L'indirizzo e-mail: "$email" è sospeso da "$list_name".</h4>";
    }
    }
    [/php]
    ma cosa c'è che non và secondo te????????


  • User Attivo

    ciao vincenzo e scusa se non ho risposto prima!

    La funzione da cambiare non è subscribe, ma on_list.

    Per la precisione devi sostituire questo pezzo di codice:

    function on_list($email) {
    // Returns true if email address is on list.
    global $list_file;
    $found = false;
    $file = @file($list_file);
    if ($file) {
    foreach ($file as $address) {
    if (trim($address) == trim($email)) {
    $found = true;
    }
    }
    }
    return $found;
    }

    con questo:

    function on_list($email) {
    // Returns true if email address is on list.
    global $list_file;
    $found = false;
    $file = @file($list_file);
    if ($file) {
    foreach ($file as $address) {
    if ( trim(substr(stristr($address, "-"),2)) == trim($email)) {
    $found = true;
    }
    }
    }
    return $found;
    }

    Spero che sia tutto corretto!

    Ciao


  • User Attivo

    fantastico ... tutto coretto ... sono ripetitivo ma non posso esimermi dal farti i complimenti 😉


  • User Attivo

    Ciao a tutti, nn riesco ad accedere all'area amministrazione mi date una mano? nn so configurarlo forse

    function admin() {
    // Controls the administration options.
    global $q, $username, $password, $user, $pass;
    if (($user == $username) && ($pass == $password)) {
    if ($q == "send_msg") admin_send_msg();
    elseif ($q == "send_msg_confirm") admin_send_msg_confirm();
    elseif ($q == "write_msg") admin_write_msg();
    elseif ($q == "view_subs") admin_view_subs();
    elseif ($q == "config") admin_config();
    elseif ($q == "add_remove") admin_add_remove();
    admin_print_options();
    }
    else {
    if (($username == "MIAUSERNAME") && ($password == "MIA PASSWORD)) admin_print_logon("");
    else admin_print_logon("Invalid username and/or password.");
    }
    }

    CHE DEVO SCRIVERE IN QUEI CAMPI? GRAZIE RAGAZZI


  • User Attivo

    SCUSATE ANCORA, HO UN'ALTRO PROBLEMA..... MA NEI CAMPI
    if ($email == "") DEVO METTERE LA EMAIL DEL SITO?

    function subscribe($email, $nome, $send_confirm, $send_welcome) {
    // Subscribes address to list.
    global $list_name;
    if ($email == "")
    {
    print_subscribe_form();
    }
    else {
    if (!banned($email)) {
    if (!on_list($email)) {
    if (valid_email($email)) {
    if ($send_confirm == "on") {
    send_confirm($email);
    echo "<h4 align="center">"$nome" Thank you for subscribing to "$list_name".</h4><center>An email will be sent to "$email" asking you to confirm your subscription.<br>Please follow those instructions to complete the process.</center>";
    }
    else {
    if (add_to_list($email)) {
    echo "<h4 align="center">"$nome" The email address: "$email" has been subscribed to "$list_name".</h4>";
    if ($send_welcome == "on") {
    send_welcome($email);
    echo "<br><center>A welcome message will be emailed to you confirming this.</center>";
    }
    }
    }
    }
    else echo "<h4 align="center">The email address: "$email" does not appear to be valid.</h4>";
    }
    else echo "<h4 align="center">The email address: "$email" is already subscribed to this list.</h4>";
    }
    else echo "<h4 align="center">The email address: "$email" has been banned from "$list_name".</h4>";
    }
    }

    function unsubscribe($email) {
    // Removes email from list if it exists.
    global $list_file, $list_name, $send_goodbye;
    if ($email == "") {
    print_subscribe_form();
    }
    else {
    if (remove_from_list($email)) {
    echo "<center><b>The email address: "$email" has been removed from "$list_name".</b>";
    if ($send_goodbye == "on") {
    send_goodbye($email);
    echo "<br>A email confirming this will be sent to "$email".";
    }
    echo "</center>";
    }
    else echo "<center><b>The email address: "$email" is not subscribed to "$list_name".</b>";
    }
    }

    :mmm: