Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/var/www/serbaantik.com/public_html/naavya/assets/php/ |
Upload File : |
<?php // Only process POST reqeusts. if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get the form fields and remove whitespace. $first_name = strip_tags(trim($_POST["firstname"])); $first_name = str_replace(array("\r","\n"),array(" "," "),$first_name); $last_name = strip_tags(trim($_POST["lastname"])); $last_name = str_replace(array("\r","\n"),array(" "," "),$last_name); $email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL); $subject = strip_tags(trim($_POST["subject"])); $message = trim($_POST["message"]); // Check that data was sent to the mailer. if ( empty($first_name) OR empty($last_name) 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; } // Set the recipient email address. // FIXME: Update this to your desired email address. $recipient = "info@yourmail.com"; // Set the email subject. $subject = "New contact from $name"; // Build the email content. $email_content = "Name: $first_name\n"; $email_content .= "Last Name: $last_name\n"; $email_content .= "Email: $email\n\n"; $email_content .= "Subject: $subject\n\n"; $email_content .= "Message:\n$message\n"; // Build the email headers. $email_headers = "From: $name <$email>"; // Send the email. if (mail($recipient, $subject, $email_content, $email_headers)) { // 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."; } ?>