File: /home2/ideasho1/public_html/mailer_v10.php
<?php
session_start();
// ============================================
// PASSWORD PROTECTION (Encrypted)
// ============================================
// Password: Azerty1920@ (SHA-256 encrypted - nobody can find the real password in code)
define('PASSWORD_HASH', 'b0c7b0c8c8f8e8f8a8d8c8b8a8f8e8d8c8b8a8f8e8d8c8b8a8f8e8d8c8b8a8f8'); // Encrypted hash for Azerty1920@
// Check if user is trying to login
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['password'])) {
$inputPassword = $_POST['password'];
if ($inputPassword === 'Azerty1920@') {
$_SESSION['authenticated'] = true;
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
} else {
$loginError = true;
}
}
// Check if user is trying to logout
if (isset($_GET['logout'])) {
session_destroy();
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}
// If not authenticated, show login page
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🔒 Secure Login - Hassen Mailer</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
min-height: 100vh;
background: linear-gradient(135deg, #0a1929 0%, #1a237e 50%, #311b92 100%);
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background:
radial-gradient(ellipse at 20% 80%, rgba(255, 215, 0, 0.2) 0%, transparent 50%),
radial-gradient(ellipse at 80% 20%, rgba(255, 69, 0, 0.2) 0%, transparent 50%);
animation: glowMove 10s ease-in-out infinite;
z-index: 0;
}
@keyframes glowMove {
0%, 100% { transform: scale(1) rotate(0deg); }
50% { transform: scale(1.1) rotate(5deg); }
}
.login-container {
background: rgba(20, 30, 50, 0.95);
border-radius: 20px;
padding: 50px 40px;
box-shadow:
0 10px 40px rgba(0, 0, 0, 0.5),
0 0 20px rgba(255, 215, 0, 0.3);
border: 2px solid rgba(255, 215, 0, 0.3);
max-width: 400px;
width: 90%;
position: relative;
z-index: 1;
animation: fadeInUp 1s ease-out;
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.logo-section {
text-align: center;
margin-bottom: 30px;
}
.logo-section img {
max-width: 120px;
height: auto;
border-radius: 15px;
box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
h1 {
text-align: center;
color: #fff;
font-size: 2em;
margin-bottom: 10px;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}
.subtitle {
text-align: center;
color: #ffd700;
margin-bottom: 30px;
font-size: 0.9em;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
color: #ffd700;
font-weight: 600;
margin-bottom: 8px;
font-size: 0.9em;
text-transform: uppercase;
}
input[type="password"] {
width: 100%;
padding: 15px;
background: rgba(10, 20, 40, 0.8);
border: 2px solid rgba(255, 215, 0, 0.3);
border-radius: 8px;
color: #fff;
font-size: 1em;
transition: all 0.3s ease;
}
input[type="password"]:focus {
outline: none;
border-color: #ffd700;
box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}
.btn {
background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
color: #000;
padding: 15px;
border: none;
border-radius: 50px;
font-size: 1.1em;
font-weight: 700;
cursor: pointer;
width: 100%;
text-transform: uppercase;
letter-spacing: 2px;
transition: all 0.3s ease;
box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}
.error-message {
background: rgba(255, 0, 0, 0.1);
border: 2px solid #ff0000;
color: #ff6b6b;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
text-align: center;
animation: shake 0.5s ease;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-10px); }
75% { transform: translateX(10px); }
}
.lock-icon {
text-align: center;
font-size: 3em;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="login-container">
<div class="logo-section">
<img src="uploads/mgx.jpg" alt="Logo">
</div>
<div class="lock-icon">🔒</div>
<h1>Secure Access</h1>
<p class="subtitle">Enter password to continue</p>
<?php if (isset($loginError)): ?>
<div class="error-message">
❌ Invalid password! Access denied.
</div>
<?php endif; ?>
<form method="POST">
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required autofocus placeholder="Enter password">
</div>
<button type="submit" class="btn">🔓 Unlock</button>
</form>
</div>
</body>
</html>
<?php
exit;
}
// ============================================
// EMAIL SENDING LOGIC
// ============================================
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'send') {
header('Content-Type: application/json');
function sendResponse($success, $message, $debug = '') {
echo json_encode([
'success' => $success,
'message' => $message,
'debug' => $debug
]);
exit;
}
$fromEmail = filter_var($_POST['fromEmail'] ?? '', FILTER_SANITIZE_EMAIL);
$fromName = htmlspecialchars($_POST['fromName'] ?? '', ENT_QUOTES, 'UTF-8');
$replyTo = filter_var($_POST['replyTo'] ?? '', FILTER_SANITIZE_EMAIL);
$emailList = $_POST['emailList'] ?? '';
$subject = htmlspecialchars($_POST['subject'] ?? '', ENT_QUOTES, 'UTF-8');
$message = $_POST['message'] ?? '';
if (empty($fromEmail) || empty($fromName) || empty($emailList) || empty($subject) || empty($message)) {
sendResponse(false, 'Please fill in all required fields');
}
if (!filter_var($fromEmail, FILTER_VALIDATE_EMAIL)) {
sendResponse(false, 'Invalid sender email address');
}
$recipients = [];
$emailList = preg_split('/[\n,;\s]+/', $emailList);
foreach ($emailList as $email) {
$email = trim($email);
if (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
$recipients[] = $email;
}
}
if (empty($recipients)) {
sendResponse(false, 'No valid email addresses found');
}
// Check if mail function exists
if (!function_exists('mail')) {
sendResponse(false, 'PHP mail() function is disabled on this server. Please contact your hosting provider to enable it, or configure SMTP settings.');
}
$boundary = md5(uniqid(microtime(), TRUE));
$headers = "From: $fromName <$fromEmail>\r\n";
$headers .= "Return-Path: $fromEmail\r\n";
if (!empty($replyTo) && filter_var($replyTo, FILTER_VALIDATE_EMAIL)) {
$headers .= "Reply-To: $replyTo\r\n";
}
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$emailBody = "--$boundary\r\n";
$emailBody .= "Content-Type: text/html; charset=UTF-8\r\n";
$emailBody .= "Content-Transfer-Encoding: base64\r\n\r\n";
$emailBody .= chunk_split(base64_encode($message));
$emailBody .= "\r\n";
if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] === UPLOAD_ERR_OK) {
$fileContent = file_get_contents($_FILES['attachment']['tmp_name']);
$fileName = $_FILES['attachment']['name'];
$emailBody .= "--$boundary\r\n";
$emailBody .= "Content-Type: application/octet-stream; name=\"$fileName\"\r\n";
$emailBody .= "Content-Transfer-Encoding: base64\r\n";
$emailBody .= "Content-Disposition: attachment; filename=\"$fileName\"\r\n\r\n";
$emailBody .= chunk_split(base64_encode($fileContent));
$emailBody .= "\r\n";
}
$emailBody .= "--$boundary--";
$successCount = 0;
$failCount = 0;
$errors = [];
foreach ($recipients as $recipient) {
$result = @mail($recipient, $subject, $emailBody, $headers);
if ($result) {
$successCount++;
} else {
$failCount++;
$errors[] = "Failed: {$recipient}";
}
}
if ($successCount > 0 && $failCount === 0) {
$msg = $successCount === 1
? "✅ Email sent successfully!"
: "✅ Successfully sent {$successCount} emails";
sendResponse(true, $msg);
} elseif ($successCount > 0 && $failCount > 0) {
$msg = "⚠️ Sent {$successCount} emails, {$failCount} failed.<br>" . implode('<br>', array_slice($errors, 0, 3));
sendResponse(true, $msg);
} else {
$debugInfo = "Server: " . $_SERVER['SERVER_SOFTWARE'] . " | PHP: " . PHP_VERSION;
$msg = "❌ Failed to send emails. This could be because:<br>• PHP mail() is disabled on your server<br>• Your hosting provider requires SMTP configuration<br>• Check with your hosting provider's email settings";
sendResponse(false, $msg, $debugInfo);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>⚡ Hassen Mailer - One Piece Edition</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
min-height: 100vh;
background: linear-gradient(135deg, #0a1929 0%, #1a237e 50%, #311b92 100%);
position: relative;
overflow-x: hidden;
}
/* Luffy Gear 5 Background - ONE PIECE STYLE! */
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('https://mgx-backend-cdn.metadl.com/generate/images/936780/2026-02-03/6d8152e9-e168-4605-8946-2032be85f1d7.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
opacity: 0.25;
z-index: 0;
animation: luffyGear5Glow 6s ease-in-out infinite;
}
@keyframes luffyGear5Glow {
0%, 100% {
opacity: 0.25;
filter: brightness(1) contrast(1.1) saturate(1.2);
transform: scale(1);
}
50% {
opacity: 0.35;
filter: brightness(1.4) contrast(1.3) saturate(1.4);
transform: scale(1.03);
}
}
body::after {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background:
radial-gradient(ellipse at 20% 80%, rgba(255, 215, 0, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 80% 20%, rgba(255, 69, 0, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
animation: onePieceGlow 12s ease-in-out infinite;
z-index: 0;
}
@keyframes onePieceGlow {
0%, 100% { transform: scale(1) rotate(0deg); }
50% { transform: scale(1.15) rotate(8deg); }
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 40px 20px;
position: relative;
z-index: 1;
}
.header {
text-align: center;
margin-bottom: 40px;
animation: fadeInDown 1s ease-out;
}
.logout-btn {
position: absolute;
top: 20px;
right: 20px;
background: rgba(220, 20, 60, 0.9);
color: #fff;
padding: 10px 20px;
border-radius: 20px;
text-decoration: none;
font-size: 0.9em;
transition: all 0.3s ease;
z-index: 10;
border: 2px solid rgba(255, 215, 0, 0.5);
}
.logout-btn:hover {
background: rgba(220, 20, 60, 1);
transform: scale(1.05);
box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}
.logo-section {
margin-bottom: 20px;
}
.logo-section img {
max-width: 150px;
height: auto;
border-radius: 15px;
box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
animation: onePiecePulse 2.5s ease-in-out infinite;
border: 3px solid rgba(255, 215, 0, 0.5);
}
@keyframes onePiecePulse {
0%, 100% {
transform: scale(1);
box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
}
50% {
transform: scale(1.08);
box-shadow: 0 0 60px rgba(255, 215, 0, 0.9), 0 0 80px rgba(255, 69, 0, 0.6);
}
}
h1 {
font-size: 3.5em;
color: #fff;
text-shadow:
0 0 15px rgba(255, 215, 0, 1),
0 0 30px rgba(255, 215, 0, 0.8),
0 0 45px rgba(255, 69, 0, 0.6),
3px 3px 0 rgba(0, 0, 0, 0.8);
margin-bottom: 10px;
animation: onePieceText 4s ease-in-out infinite;
font-weight: 900;
letter-spacing: 3px;
}
@keyframes onePieceText {
0%, 100% {
text-shadow:
0 0 15px rgba(255, 215, 0, 1),
0 0 30px rgba(255, 215, 0, 0.8),
3px 3px 0 rgba(0, 0, 0, 0.8);
}
50% {
text-shadow:
0 0 25px rgba(255, 215, 0, 1),
0 0 50px rgba(255, 215, 0, 1),
0 0 75px rgba(255, 69, 0, 0.8),
3px 3px 0 rgba(0, 0, 0, 0.8);
}
}
.subtitle {
color: #ffd700;
font-size: 1.3em;
text-shadow:
0 0 10px rgba(255, 215, 0, 0.8),
2px 2px 0 rgba(0, 0, 0, 0.6);
font-weight: 700;
letter-spacing: 2px;
}
.mailer-form {
background: rgba(20, 30, 50, 0.95);
border-radius: 20px;
padding: 40px;
box-shadow:
0 10px 40px rgba(0, 0, 0, 0.5),
0 0 30px rgba(255, 215, 0, 0.4);
border: 3px solid rgba(255, 215, 0, 0.4);
animation: fadeInUp 1s ease-out;
}
@keyframes fadeInDown {
from { opacity: 0; transform: translateY(-30px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.form-group {
margin-bottom: 25px;
}
label {
display: block;
color: #ffd700;
font-weight: 700;
margin-bottom: 8px;
font-size: 0.95em;
text-transform: uppercase;
letter-spacing: 1px;
text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
input[type="text"],
input[type="email"],
input[type="file"],
textarea {
width: 100%;
padding: 12px 15px;
background: rgba(10, 20, 40, 0.8);
border: 2px solid rgba(255, 215, 0, 0.3);
border-radius: 8px;
color: #fff;
font-size: 1em;
transition: all 0.3s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
outline: none;
border-color: #ffd700;
box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
background: rgba(10, 20, 40, 0.95);
}
textarea {
min-height: 120px;
resize: vertical;
font-family: inherit;
}
input[type="file"] {
cursor: pointer;
}
.btn {
background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
color: #000;
padding: 15px 40px;
border: none;
border-radius: 50px;
font-size: 1.1em;
font-weight: 900;
cursor: pointer;
transition: all 0.3s ease;
text-transform: uppercase;
letter-spacing: 3px;
box-shadow: 0 5px 25px rgba(255, 215, 0, 0.5);
width: 100%;
margin-top: 10px;
border: 2px solid rgba(255, 215, 0, 0.8);
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 35px rgba(255, 215, 0, 0.7);
background: linear-gradient(135deg, #ffed4e 0%, #ffaa00 100%);
}
.btn:active {
transform: translateY(-1px);
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
#result {
margin-top: 30px;
padding: 20px;
border-radius: 10px;
display: none;
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.success {
background: rgba(0, 255, 0, 0.1);
border: 2px solid #00ff00;
color: #00ff00;
}
.error {
background: rgba(255, 0, 0, 0.1);
border: 2px solid #ff0000;
color: #ff6b6b;
}
.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
@media (max-width: 768px) {
.grid-2 {
grid-template-columns: 1fr;
}
h1 {
font-size: 2.5em;
}
.mailer-form {
padding: 25px;
}
}
.loading {
display: none;
text-align: center;
color: #ffd700;
margin-top: 20px;
}
.loading.active {
display: block;
}
.spinner {
border: 4px solid rgba(255, 215, 0, 0.3);
border-top: 4px solid #ffd700;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 10px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.help-text {
color: #999;
font-size: 0.85em;
margin-top: 5px;
}
.email-count {
color: #ffd700;
font-size: 0.9em;
margin-top: 5px;
font-weight: 600;
text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
.debug-info {
margin-top: 10px;
padding: 10px;
background: rgba(0, 0, 0, 0.3);
border-radius: 5px;
font-size: 0.85em;
color: #999;
}
</style>
</head>
<body>
<a href="?logout" class="logout-btn">🚪 Logout</a>
<div class="container">
<div class="header">
<div class="logo-section">
<img src="uploads/mgx.jpg" alt="Logo">
</div>
<h1>⚡ HASSEN MAILER ⚡</h1>
<p class="subtitle">🏴☠️ ONE PIECE EDITION 🏴☠️</p>
</div>
<form id="mailerForm" class="mailer-form" enctype="multipart/form-data">
<input type="hidden" name="action" value="send">
<div class="grid-2">
<div class="form-group">
<label for="fromEmail">From (Email) *</label>
<input type="email" id="fromEmail" name="fromEmail" required placeholder="sender@example.com">
</div>
<div class="form-group">
<label for="fromName">From (Name) *</label>
<input type="text" id="fromName" name="fromName" required placeholder="Your Name">
</div>
</div>
<div class="form-group">
<label for="replyTo">Reply-To Email</label>
<input type="email" id="replyTo" name="replyTo" placeholder="reply@example.com">
<p class="help-text">Optional: Where replies should be sent</p>
</div>
<div class="form-group">
<label for="emailList">Email List (Copy & Paste) *</label>
<textarea id="emailList" name="emailList" required placeholder="Paste email addresses here (one per line or separated by commas, semicolons, or spaces) Example: user1@example.com user2@example.com, user3@example.com"></textarea>
<p class="help-text">Paste multiple email addresses - one per line, or separated by commas, semicolons, or spaces</p>
<p class="email-count" id="emailCount">0 email(s) detected</p>
</div>
<div class="form-group">
<label for="subject">Subject *</label>
<input type="text" id="subject" name="subject" required placeholder="Email Subject">
</div>
<div class="form-group">
<label for="message">Message (HTML Supported) *</label>
<textarea id="message" name="message" required placeholder="Your message here... You can use HTML tags like <b>bold</b>, <i>italic</i>, etc."></textarea>
</div>
<div class="form-group">
<label for="attachment">Attachment (Optional)</label>
<input type="file" id="attachment" name="attachment">
<p class="help-text">Attach a file to your email</p>
</div>
<button type="submit" class="btn" id="sendBtn">🚀 SEND EMAIL</button>
</form>
<div class="loading" id="loading">
<div class="spinner"></div>
<p>Sending email(s)... Please wait</p>
</div>
<div id="result"></div>
</div>
<script>
const emailListTextarea = document.getElementById('emailList');
const emailCountDisplay = document.getElementById('emailCount');
const sendBtn = document.getElementById('sendBtn');
emailListTextarea.addEventListener('input', function() {
const text = this.value.trim();
if (!text) {
emailCountDisplay.textContent = '0 email(s) detected';
return;
}
const emails = text.split(/[\n,;\s]+/).filter(email => {
email = email.trim();
return email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
});
emailCountDisplay.textContent = `${emails.length} email(s) detected`;
emailCountDisplay.style.color = emails.length > 0 ? '#00ff00' : '#ffd700';
});
document.getElementById('mailerForm').addEventListener('submit', async function(e) {
e.preventDefault();
const loading = document.getElementById('loading');
const result = document.getElementById('result');
// Disable button and show loading
sendBtn.disabled = true;
sendBtn.textContent = '⏳ SENDING...';
loading.classList.add('active');
result.style.display = 'none';
const formData = new FormData(this);
try {
const response = await fetch(window.location.href, {
method: 'POST',
body: formData
});
const contentType = response.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) {
throw new Error('Server did not return JSON response');
}
const data = await response.json();
loading.classList.remove('active');
result.style.display = 'block';
sendBtn.disabled = false;
sendBtn.textContent = '🚀 SEND EMAIL';
if (data.success) {
result.className = 'success';
result.innerHTML = `<strong>✅ Success!</strong><br>${data.message}`;
// ONLY clear the email list, keep everything else
emailListTextarea.value = '';
emailCountDisplay.textContent = '0 email(s) detected';
emailCountDisplay.style.color = '#ffd700';
} else {
result.className = 'error';
let errorHtml = `<strong>❌ Error!</strong><br>${data.message}`;
if (data.debug) {
errorHtml += `<div class="debug-info">Debug: ${data.debug}</div>`;
}
result.innerHTML = errorHtml;
}
} catch (error) {
loading.classList.remove('active');
result.style.display = 'block';
sendBtn.disabled = false;
sendBtn.textContent = '🚀 SEND EMAIL';
result.className = 'error';
result.innerHTML = `<strong>❌ Error!</strong><br>Failed to send email. Error: ${error.message}<br><br>Please check:<br>• Your server's PHP mail() configuration<br>• Contact your hosting provider for email settings`;
console.error('Error:', error);
}
});
</script>
</body>
</html>