HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //home/nyiet8349bzl/www/journalofbusinessstudies.in/PHP
<?php
// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

$message = ''; // Initialize message variable

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Capture and sanitize input
    $author = htmlspecialchars(trim($_POST['author']));
    $email = htmlspecialchars(trim($_POST['email']));
    $country = htmlspecialchars(trim($_POST['country']));
    $affiliation = htmlspecialchars(trim($_POST['affiliation']));
    $article = htmlspecialchars(trim($_POST['article']));

    // Validate email
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $message = "Invalid email format.";
    } else {
        // File upload handling
        if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
            $fileTmpPath = $_FILES['file']['tmp_name'];
            $fileName = basename($_FILES['file']['name']);
            $fileSize = $_FILES['file']['size'];
            $fileType = $_FILES['file']['type'];

            // Allowed file types
            $allowedTypes = ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/msword'];

            if (in_array($fileType, $allowedTypes)) {
                // Prepare the email
                $to = 'manvendrasingh@sbs.du.ac.in';
                $subject = 'New Registration Form Submission';
                $body = "<html><body>
                    <p>You have received a new registration submission:</p>
                    <table>
                        <tr><td>Corresponding Author:</td><td>$author</td></tr>
                        <tr><td>Email:</td><td>$email</td></tr>
                        <tr><td>Country:</td><td>$country</td></tr>
                        <tr><td>Affiliation:</td><td>$affiliation</td></tr>
                        <tr><td>Article Title:</td><td>$article</td></tr>
                    </table>
                    </body></html>";
                $headers = "MIME-Version: 1.0" . "\r\n";
                $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
                $headers .= "From: mdnadimkhalid732@gmail.com" . "\r\n";

                // Send the email
                if (mail($to, $subject, $body, $headers)) {
                    // Redirect after successful email sending
                    header('Location: submit-artical.php');
                    exit;
                } else {
                    $message = "Email sending failed.";
                }
            } else {
                $message = "Invalid file type. Only PDF and Word documents are allowed.";
            }
        } else {
            $message = "No file uploaded or there was an upload error.";
        }
    }
}

// Display error message if it exists
if ($message) {
    echo "<script>alert('$message');</script>";
}
?>