/
/
home
/
u523034047
/
domains
/
commerciesconsultancy.com
/
public_html
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.130
PHP 8.3.16
Dir:
/home/u523034047/domains/commerciesconsultancy.com/public_html
Edit:
/home/u523034047/domains/commerciesconsultancy.com/public_html/mail.php
<?php include('admin/conn.php'); // ✅ DB Connection if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : ''; $email = isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; $mobile = isset($_POST['mobile']) ? htmlspecialchars($_POST['mobile']) : ''; $gender = isset($_POST['gender']) ? htmlspecialchars($_POST['gender']) : ''; $city = isset($_POST['city']) ? htmlspecialchars($_POST['city']) : ''; $state = isset($_POST['state']) ? htmlspecialchars($_POST['state']) : ''; $studying = isset($_POST['studying']) ? htmlspecialchars($_POST['studying']) : ''; $to = "Commerciesconsultancy@gmail.com"; $subject = "New Resume Submission from $name"; // ✅ Upload folder $upload_dir = __DIR__ . "/resume_docs/"; $resume_link = "No file uploaded"; // File upload handling if (isset($_FILES['resume']) && $_FILES['resume']['error'] == 0) { // create folder if not exists if (!is_dir($upload_dir)) { mkdir($upload_dir, 0777, true); } $allowed_ext = ['pdf','doc','docx']; $file_ext = strtolower(pathinfo($_FILES['resume']['name'], PATHINFO_EXTENSION)); $file_size = $_FILES['resume']['size']; if (in_array($file_ext, $allowed_ext) && $file_size <= 10*1024*1024) { $file_name = time() . "_" . preg_replace("/[^a-zA-Z0-9\._-]/", "_", $_FILES['resume']['name']); $file_path = $upload_dir . $file_name; if (move_uploaded_file($_FILES['resume']['tmp_name'], $file_path)) { $resume_link = "https://commerciesconsultancy.com/resume_docs/$file_name"; } else { $resume_link = "❌ File upload failed"; } } else { $resume_link = "❌ Invalid file type or size > 10MB"; } } // ✅ Insert into DB $stmt = $connection->prepare("INSERT INTO users (`name`,`state`,`email`,`mobile`,`gender`,`city`,`studying`,`resume`) VALUES (?,?,?,?,?,?,?,?)"); $stmt->bind_param("ssssssss", $name, $state, $email, $mobile, $gender, $city, $studying, $resume_link); $stmt->execute(); $stmt->close(); // ✅ Message with Resume Link $message = " <h3>New Resume Submission</h3> <p><b>Name:</b> $name</p> <p><b>Email:</b> $email</p> <p><b>Mobile:</b> $mobile</p> <p><b>Gender:</b> $gender</p> <p><b>City:</b> $city</p> <p><b>State:</b> $state</p> <p><b>Studying:</b> $studying</p> <p><b>Resume File:</b> <a href='$resume_link' target='_blank'>$resume_link</a></p> "; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: <$email>" . "\r\n"; $sent = mail($to, $subject, $message, $headers); if ($sent) { echo "<h3>✅ Thank you, $name! Your resume has been submitted successfully.</h3>"; // ✅ Redirect to Thank You Page header("Location: thank-you.php"); } else { echo "<h3>❌ Sorry, mail could not be sent. Please try again.</h3>"; } } ?>
Ukuran: 3.2 KB