Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/newsfeed/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/newsfeed/index.php

<?php
require_once 'config/config.php';

// Redirect to dashboard if already logged in
if (is_logged_in()) {
    redirect('dashboard.php');
}

$database = new Database();
$conn = $database->getConnection();
$user = new User($conn);
$category = new Category($conn);

$error = '';
$success = '';

// Handle login
if ($_POST['action'] ?? '' === 'login') {
    $login = sanitize_input($_POST['login'] ?? '');
    $password = $_POST['password'] ?? '';
    
    if (empty($login) || empty($password)) {
        $error = 'Please fill in all fields';
    } else {
        $user_data = $user->authenticate($login, $password);
        if ($user_data) {
            $_SESSION['user_id'] = $user_data['id'];
            $_SESSION['user_name'] = $user_data['name'];
            $_SESSION['account_type'] = $user_data['account_type'];
            $_SESSION['location_type'] = $user_data['location_type'];
            $_SESSION['location_name'] = $user_data['location_name'];
            
            redirect('dashboard.php');
        } else {
            $error = 'Invalid login credentials';
        }
    }
}


$categories = $category->getAll();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>COP News Portal - Church of Pentecost</title>
    <link rel="stylesheet" href="assets/css/style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
    <header class="header">
        <nav class="navbar">
            <a href="index.php" class="logo">
                <i class="fas fa-church"></i>
                COP News Portal
            </a>
            <ul class="nav-links">
                <li><a href="#home">Home</a></li>
                <li><a href="#news">News</a></li>
                <li><a href="#about">About</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <section class="landing-hero" id="home">
            <div class="container">
                <h1>Church of Pentecost News Portal</h1>
                <p>Stay connected with the latest news and updates from COP communities worldwide</p>
            </div>
        </section>

        <section class="container" style="margin-top: -2rem; position: relative; z-index: 10;">
            <div class="flex justify-center">
                <!-- Login Card -->
                <div class="card" style="max-width: 400px; margin: 0 auto;">
                    <div class="card-header">
                        <h2><i class="fas fa-sign-in-alt"></i> Login</h2>
                    </div>
                    <div class="card-body">
                        <?php if ($error): ?>
                            <div class="alert alert-error">
                                <i class="fas fa-exclamation-circle"></i> <?php echo $error; ?>
                            </div>
                        <?php endif; ?>
                        
                        <?php if ($success): ?>
                            <div class="alert alert-success">
                                <i class="fas fa-check-circle"></i> <?php echo $success; ?>
                            </div>
                        <?php endif; ?>

                        <form method="POST" action="">
                            <input type="hidden" name="action" value="login">
                            
                            <div class="form-group">
                                <label for="login" class="form-label">Email or Username</label>
                                <input type="text" id="login" name="login" class="form-control" 
                                       value="<?php echo $_POST['login'] ?? ''; ?>" required>
                            </div>
                            
                            <div class="form-group">
                                <label for="password" class="form-label">Password</label>
                                <input type="password" id="password" name="password" class="form-control" required>
                            </div>
                            
                            <button type="submit" class="btn btn-primary w-full">
                                <i class="fas fa-sign-in-alt"></i> Login
                            </button>
                        </form>
                        
                    </div>
                </div>
            </div>
        </section>

        <!-- News Submission Section -->
        <section class="container mt-4" id="news">
            <div class="card">
                <div class="card-header">
                    <h2><i class="fas fa-newspaper"></i> Submit News</h2>
                </div>
                <div class="card-body">
                    <p class="text-center mb-3" style="color: var(--primary-grey);">
                        Have news to share with the COP community? Please login to submit your news articles.
                    </p>
                    <div class="text-center">
                        <a href="#home" class="btn btn-outline">
                            <i class="fas fa-sign-in-alt"></i> Login to Submit News
                        </a>
                    </div>
                </div>
            </div>
        </section>

        <!-- About Section -->
        <section class="container mt-4" id="about">
            <div class="card">
                <div class="card-header">
                    <h2><i class="fas fa-info-circle"></i> About COP News Portal</h2>
                </div>
                <div class="card-body">
                    <div class="grid grid-3">
                        <div class="text-center">
                            <i class="fas fa-users" style="font-size: 3rem; color: var(--primary-blue); margin-bottom: 1rem;"></i>
                            <h3>Community Driven</h3>
                            <p>Connect with COP members from Areas, Districts, and Assemblies worldwide.</p>
                        </div>
                        <div class="text-center">
                            <i class="fas fa-newspaper" style="font-size: 3rem; color: var(--primary-blue); margin-bottom: 1rem;"></i>
                            <h3>Latest News</h3>
                            <p>Stay updated with the latest programs, events, and announcements from your local church.</p>
                        </div>
                        <div class="text-center">
                            <i class="fas fa-shield-alt" style="font-size: 3rem; color: var(--primary-blue); margin-bottom: 1rem;"></i>
                            <h3>Secure Platform</h3>
                            <p>Your information is protected with modern security measures and audit trails.</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <footer style="background: var(--white); margin-top: 4rem; padding: 2rem 0; text-align: center; color: var(--primary-grey);">
        <div class="container">
            <p>&copy; 2024 Church of Pentecost News Portal. All rights reserved.</p>
            <p>Connecting COP communities worldwide through digital communication.</p>
        </div>
    </footer>

    <script>
        // Smooth scrolling for navigation links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                const target = document.querySelector(this.getAttribute('href'));
                if (target) {
                    target.scrollIntoView({
                        behavior: 'smooth',
                        block: 'start'
                    });
                }
            });
        });

    </script>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists