File Manager V1.5

[SYSTEM@ROOT]: /home/ketechno/dakotaoilug.com/
INJECT_FILE:
NEW_ENTRY:

FILE_CONTENT: submit-blog.php

<?php
include 'header.php';
require_once 'admin/functions.php';

$success_message = '';
$error_message = '';

// Handle form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST['title']) || empty($_POST['content']) || empty($_POST['author']) || empty($_POST['email'])) {
        $error_message = "All fields are required.";
    } else {
        $image_file = isset($_FILES['image']) ? $_FILES['image'] : null;
        if (submitPublicBlogPost($_POST, $image_file)) {
            $success_message = "Thank you for your submission! Your blog post will be reviewed and published soon.";
            $_POST = array(); // Clear form
        } else {
            $error_message = "Error submitting blog post. Please try again.";
        }
    }
}
?>

<section class="submit-blog-section" style="margin-top:10%; padding: 50px 0;">
    <div class="auto-container">
        <div class="sec-title text-center mb-5">
            <h2>Submit Your Blog Post</h2>
            <p class="text-muted">Share your automotive knowledge and experiences with our community</p>
        </div>

        <?php if ($success_message): ?>
            <div class="alert alert-success"><?php echo $success_message; ?></div>
        <?php endif; ?>
        <?php if ($error_message): ?>
            <div class="alert alert-danger"><?php echo $error_message; ?></div>
        <?php endif; ?>

        <div class="row justify-content-center">
            <div class="col-lg-10">
                <form method="post" enctype="multipart/form-data" class="bg-light p-4 rounded" style=" border:2px solid #2ed0b0; padding:20px;">
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="title" class="form-label">Blog Title *</label>
                            <input type="text" class="form-control" id="title" name="title" 
                                   value="<?php echo isset($_POST['title']) ? htmlspecialchars($_POST['title']) : ''; ?>" 
                                   required>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="author" class="form-label">Your Name *</label>
                            <input type="text" class="form-control" id="author" name="author" 
                                   value="<?php echo isset($_POST['author']) ? htmlspecialchars($_POST['author']) : ''; ?>" 
                                   required>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="email" class="form-label">Your Email *</label>
                            <input type="email" class="form-control" id="email" name="email" 
                                   value="<?php echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; ?>" 
                                   required>
                            <small class="text-muted">We'll notify you when your post is published</small>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="image" class="form-label">Featured Image</label>
                            <input type="file" class="form-control" id="image" name="image" accept="image/*">
                            <small class="text-muted">Optional. Maximum file size: 2MB</small>
                        </div>

                        <div class="col-12 mb-3">
                            <label for="content" class="form-label">Blog Content *</label>
							
							
                             <textarea class="form-control" id="content" name="content"  placeholder="Your Feedback *" required></textarea>
                        </div>

                        <div class="col-12">
                            <button type="submit" class="theme-btn btn-style-one">
                                Submit Blog Post
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>

<script>
tinymce.init({
    selector: '#content',
    height: 400,
    plugins: [
        'advlist autolink lists link image charmap print preview anchor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table paste code help wordcount'
    ],
    toolbar: 'undo redo | formatselect | bold italic backcolor | \
        alignleft aligncenter alignright alignjustify | \
        bullist numlist outdent indent | removeformat | help',
    menubar: false
});
</script>

<!-- Add custom styles -->
<style>
.submit-blog-section {
    background: #f9f9f9;
}
.theme-btn.btn-style-one {
    background: #ff5e14;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    transition: all 0.3s ease;
}
.theme-btn.btn-style-one:hover {
    background: #e04d0f;
}
.tox-tinymce {
    border-radius: 5px;
}
</style>

<?php include 'footer.php'; ?>
[ KEMBALI ]