• User Newbie

    Script per form invio CV

    Buongiorno Colleghi... :[CENTER]1145534674[/CENTER]
    avrei bisogno di un vostro aiuto.
    Dovrei creare un form contatti che dia la possibilità di allegare un Curriculum. Però⭕o:x Non riesco a capire dove stia sbagliando... In pratica quando premo il tasto invio ricevo un messaggio di errore anzi mi appare il messaggio che mi indica che il link è broken..
    Ora vi riporto lo script che ho utilizzato:

    <form action="invio.php" enctype="multipart/form-data" id="lavora_con_noi" method="post">
    Dati personali:
    <p>
     </p>
    <table border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td>
    <label for="nome">Nome:</label> <input id="nome" name="nome" size="20" type="text" /></td>
    <td>
    <label for="cognome">Cognome:
    </label> <input id="cognome" name="cognome" size="20" type="text" /></td>
    </tr>
    <tr>
    <td>
    <label for="sesso">Sesso:</label> <select id="sesso" name="sesso"><option>Seleziona...</option><option value="Uomo">Uomo</option><option value="Donna">Donna</option></select></td>
    </tr>
    <tr>
    <td>
    <label for="telefono">Telefono:
    </label> <input id="telefono" name="telefono" type="text" /></td>
    </tr>
    <tr>
    <td>
    <label for="email">Email:*</label> <input id="email" name="email2" type="text" /></td>
    <td>
     </td>
    </tr>
    <tr>
    <td colspan="2">
    Allegati
    <p>
     </p>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <label for="fototessera">Fototessera:</label> <input id="fototessera" name="fototessera" type="file" /> <span>Puoi inviare una tua foto non superiore a 100 KB, in uno dei formati ".jpg", ".gif", ".png", ".bmp"</span>
    <p>
     </p>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <label for="curriculum">Curriculum Vitae:</label> <input id="curriculum" name="curriculum" type="file" /> <span>Puoi inviare una tuo curriculum non superiore a 300 KB, in uno dei formati ".pdf", ".txt", ".doc"</span>
    <div>
     </div>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <input id="invia.php" name="invia" type="submit" value="Invia richiesta" /></td>
    </tr>
    </tbody>
    </table>
    </form><!--?php
    //CONTROLLO HACKERS
    foreach(array('note') as $key) $_POST[$key] = strip_tags($_POST[$key]);
    if(!is_secure($_POST)) {
    $subject = "Hack Attept via Contact Form!";
    $body = "Indirizzo IP: ".getenv("REMOTE_ADDR")."<br>Agent: ".getenv("HTTP_USER_AGENT")."";
    //QUI INSERISCI LA TUA EMAIL
    $emailto = " ------------.it";
    $headers = "From: $emailto";
    //AVVERTI TE STESSO DELL'ATTACCO:
    @mail($emailto, $subject, $body, $headers);
    die("<font color="red"><b>Asta la vista Hacker!</b></font><br><br>");
    }
    //END

    //L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
    $to = "------------.it";

    //IL SOGGETTO DELLA MAIL
    $subject = "Candidatura - Lavora Con Noi";
    $nome = $_POST['nome']; // contain name of person
    $cognome = $_POST['cognome']; // contain surname of person
    $stato_civile = $_POST['stato_civile'];
    $luogo_di_nascita = $_POST['luogo_di_nascita'];
    $data_di_nascita = $_POST['data_di_nascita'];
    $via = $_POST['via'];
    $civico = $_POST['civico'];
    $cap = $_POST['cap'];
    $comune_residenza = $_POST['comune_residenza'];
    $nazione = $_POST['nazione'];
    $provincia = $_POST['provincia'];
    $email = $_POST['email']; // Email address of sender
    $telefono = $_POST['telefono'];
    $cellulare = $_POST['cellulare'];

    //INVIO
    if(mail($to, $subject, $body, $headers)) { // SE L'INOLTRO È ANDATO A BUON FINE...
    echo "E-mail inviata con successo!! Attendi qualche secondo e verrai reindirizzato alla pagina precedente...";
    echo "<meta http-equiv="refresh" content="5;url=/private/mediabssp.html" />";

    } else {// ALTRIMENTI...

    echo "Si sono verificati dei problemi nell'invio della mail, riprova pù tardi. Ora verrai reindirizzato alla pagina precedente...";
    echo "<meta http-equiv="refresh" content="5;url=/private/mediabssp.html" />";

    }

    //# NON CAMBIARE NIENTE QUI SOTTO:

    function is_secure($ar) {
    $reg = "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
    if(!is_array($ar)) { return preg_match($reg,$ar);}
    $incoming = array_values_recursive($ar);
    foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
    return true;
    }

    function array_values_recursive($array) {
    $arrayValues = array();
    foreach ($array as $key=>$value) {
    if (is_scalar($value) || is_resource($value)) {
    $arrayValues[] = $value;
    $arrayValues[] = $key;
    }
    elseif (is_array($value)) {
    $arrayValues[] = $key;
    $arrayValues = array_merge($arrayValues, array_values_recursive($value));
    }
    }
    return $arrayValues;
    }

    ?>

    Grazie mille


  • Bannato Super User

    Benvenuta nel forum !


  • User Newbie

    👋