Beispiel #1
0
}
$sql_boletin = "select contenido from boletines where id=" . $sec;
$rs_boletin = $db->Execute($sql_boletin);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-To: Comunicaciones Supersolidaria <*****@*****.**>\r\n";
$headers .= "Return-Path: Comunicaciones Supersolidaria <*****@*****.**>\r\n";
$headers .= "From: Bolet�n Virtual Supersolidaria<*****@*****.**>\r\n";
$headers .= "Organization: Superintendencia de la Econom�a Solidaria\r\n";
$k = 0;
$error = 0;
$correos_error = "";
$asunto = "Bolet�n Virtual No. ";
$asunto .= $sec;
foreach ($_SESSION['correos'] as $row) {
    if (emailValidator($row) == false) {
        $error++;
        $correos_error .= $row . ",";
        $daralta[] = $row;
    } else {
        mail($row, $asunto, $rs_boletin->fields['contenido'], $headers);
        $nombre_archivo = '../log/correo_boletin_' . $sec . '.txt';
        $contenido = trae_id($row, $db) . ",";
        $gestor = fopen($nombre_archivo, 'a');
        fwrite($gestor, $contenido);
        fclose($gestor);
    }
    $k++;
}
/*
DEPURACION CORREOS DE ERROR SE MARCAN CON 1, PARA QUE EL PROGRAMA NO LOS TOME EN CUENTA
 **
 ** 2. Adaugati doua inputuri in formular first_name si last_name care sa le validati cu tipul name de mai sus.
 ** 3. In cazul in care formularul nu se valideaza precompletati campurile cu valorile introduse de utilizator si aratati erorile cu rosu ca in exemplu.
 ** 4. Dupa validare adaugati userul in baza de date si incercati loginul cu el.
 ** 5. BONUS Validati parola astfel incat sa aiba cel putin 10 caractere si o cifra si un caracter special (#$%^&*)
 **
 ** SUCESS!!!
 **
 */
require_once 'utils.php';
if (isset($_POST["submit"])) {
    $form["email"] = isset($_POST["email"]) ? $_POST["email"] : null;
    $form["password"] = isset($_POST["password"]) ? $_POST["password"] : null;
    $form["repassword"] = isset($_POST["repassword"]) ? $_POST["repassword"] : null;
    // check if email is valid
    if (!emailValidator($form["email"])) {
        $error["email"] = 'Invalid email';
    }
    // check if password is valid
    if (!passwordValidator($form["password"])) {
        if ($form["password"] !== $form["repassword"]) {
            //Validate pass contain at least one digit
            $error["password"] = "******";
        }
    } else {
        $error["password"] = '******';
    }
    if (count($error) == 0) {
        //TODO insert user and pass into db
        //redirect to login
        header("Location: http://188.166.119.187/workspace/Resurse_comune/curs6/login.php");