HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: /home/mirz4654/public_html/wp-content/themes/mira-yosomite/assets/php/contact.php
<?php

	// Set the recipient email address.
    // FIXME: Update this to your desired email address.
    $recipient = "[email protected]";


    function cleanData($data) {
        return strip_tags(stripslashes(trim($data)));
    }

    function cleanEmail($email) {
        return filter_var(cleanData($email), FILTER_SANITIZE_EMAIL);
    }

    function cleanMultiLines($data) {
        return str_replace(array("\r","\n"), array(" "," "), $data);
    }

    // Only process POST reqeusts.
    if ($_SERVER["REQUEST_METHOD"] == "POST") {

        // Get the form fields and remove whitespace.
		$fname = cleanMultiLines(cleanData($_POST["contactFname"]));
        $lname = cleanMultiLines(cleanData($_POST["contactLname"]));
        $email = cleanMultiLines(cleanEmail($_POST["contactEmail"]));
        $subject = cleanMultiLines(cleanData($_POST["contactSubject"]));
        $message = cleanData($_POST["contactMessage"]);


        // Check that data was sent to the mailer.
        if ( empty($fname) OR empty($lname) OR empty($subject) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
            // Set a 400 (bad request) response code and exit.
            http_response_code(400);
            echo "Please complete the form and try again.";
            exit;
        }

        // Build the email content.
        $email_content = "First Name: $fname\n";
        $email_content .= "Last Name: $lname\n";
        $email_content .= "Email Address: $email\n";
        if (isset($_POST["contactPhone"])) {
            $phone = strip_tags(trim($_POST["contactPhone"]));
            $phone = str_replace(array("\r","\n"),array(" "," "),$phone);
            if (!empty($phone)) {
                $email_content .= "Phone Number: $phone\n";
            }
        }
        $email_content .= "Message:\n$message\n";

        // Build the email headers.
        $email_headers = "From: $fname $lname <$email>";

        // Send the email.
        if (mail($recipient, $subject, $email_content, $email_headers)) {

            /*$file = fopen('mail.txt', 'w');
            fwrite($file, $email_content);
            fclose($file);*/

            // Set a 200 (okay) response code.
            http_response_code(200);
            echo "Thank You! Your message has been sent.";
        } else {
            // Set a 500 (internal server error) response code.
            http_response_code(500);
            echo "Oops! Something went wrong and we couldn't send your message.";
        }

    } else {
        // Not a POST request, set a 403 (forbidden) response code.
        http_response_code(403);
        echo "There was a problem with your submission, please try again.";
    }

?>