# Web Publication System A simple, clean web publication system built with PHP and MariaDB. This system allows you to create, manage, and publish articles or blog posts with categories, search functionality, and a responsive admin interface. ## Features - **Admin Panel**: Secure login and dashboard for managing publications - **Publication Management**: Create, edit, delete, and publish articles - **Categories**: Organize publications with categories - **Search**: Full-text search across publications - **Responsive Design**: Mobile-friendly interface for both admin and public sites - **User Authentication**: Secure login system with password hashing - **SEO Friendly**: Clean URLs and meta information ## Requirements - PHP 7.4 or higher - MariaDB 10.3+ or MySQL 5.7+ - Web server (Apache, Nginx, or PHP built-in server) - PHP extensions: PDO, PDO_MySQL, mbstring ## Installation ### 1. Setup Database Create a database and user for the system: ```sql CREATE DATABASE webpub; CREATE USER 'webpub_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON webpub.* TO 'webpub_user'@'localhost'; FLUSH PRIVILEGES; ``` ### 2. Web Server Setup Place the files in your web root or a subdirectory. For example: ``` /var/www/html/web-pub-system/ ``` ### 3. Run Setup Script 1. Ensure the `setup/` directory is accessible via web browser 2. Navigate to: `http://your-domain.com/web-pub-system/setup/` 3. Follow the installation wizard: - Enter database connection details - Set site title and admin credentials - Complete the installation ### 4. Secure Installation After successful installation: 1. **Delete the setup directory** for security: ```bash rm -rf /path/to/web-pub-system/setup/ ``` 2. **Set proper file permissions**: ```bash chmod 755 /path/to/web-pub-system/ chmod 644 /path/to/web-pub-system/includes/config.php ``` ## Directory Structure ``` web-pub-system/ |-- admin/ # Admin interface files | |-- index.php # Dashboard | |-- login.php # Login page | |-- edit.php # Create/edit publications | |-- logout.php # Logout handler | |-- publications.php # Publication management | |-- categories.php # Category management |-- public/ # Public-facing pages | |-- index.php # Homepage with publication list | |-- publication.php # Individual publication view | |-- search.php # Search results | |-- categories.php # Category listings |-- includes/ # Core PHP classes | |-- config.php # Configuration (created during setup) | |-- database.php # Database connection class | |-- auth.php # Authentication class | |-- publication.php # Publication model class |-- css/ # Stylesheets | |-- style.css # Main stylesheet |-- setup/ # Installation files (delete after use) | |-- setup.php # Setup wizard | |-- database.sql # Database schema |-- README.md # This file ``` ## Usage ### Admin Panel 1. Access the admin panel at: `http://your-domain.com/web-pub-system/admin/` 2. Login with the credentials you created during setup 3. From the dashboard you can: - Create new publications - Edit existing publications - Manage categories - View statistics ### Creating Publications 1. Click "Create New Publication" from the dashboard 2. Fill in the publication details: - Title (required) - Summary (optional, for preview) - Content (required) - Author (defaults to logged-in user) - Status (Draft, Published, or Archived) - Categories (optional) 3. Save the publication ### Public Site The public site is available at: `http://your-domain.com/web-pub-system/public/` Features: - Browse all published publications - Filter by categories - Search publications - View individual publications - Responsive design for mobile devices ## Configuration The main configuration is stored in `includes/config.php` and is created during setup. Key settings include: ```php // Database configuration define('DB_HOST', 'localhost'); define('DB_NAME', 'webpub'); define('DB_USER', 'your_db_user'); define('DB_PASS', 'your_db_password'); // Site configuration define('SITE_TITLE', 'Web Publication System'); define('SITE_URL', 'http://your-domain.com/web-pub-system/'); define('ADMIN_EMAIL', 'admin@example.com'); ``` ## Security Considerations 1. **Delete setup directory**: Always remove the `setup/` directory after installation 2. **Strong passwords**: Use strong admin passwords 3. **File permissions**: Ensure proper file permissions on sensitive files 4. **HTTPS**: Use HTTPS in production for secure login 5. **Regular updates**: Keep PHP and MariaDB updated ## Customization ### Styling Edit `css/style.css` to customize the appearance. The CSS is organized with clear sections for: - Base styles and typography - Admin interface styles - Public site styles - Responsive design breakpoints ### Database Schema The database schema is defined in `setup/database.sql`. You can extend it by: 1. Adding new tables to the SQL file 2. Updating the Publication model class 3. Modifying forms and templates as needed ### Adding Features The system is built with an object-oriented approach, making it easy to extend: - **New Models**: Create new model classes in the `includes/` directory - **Admin Pages**: Add new admin pages in the `admin/` directory - **Public Pages**: Add new public pages in the `public/` directory ## Troubleshooting ### Common Issues 1. **Database Connection Error** - Check database credentials in `includes/config.php` - Ensure database server is running - Verify user permissions 2. **Blank Pages** - Check PHP error logs - Ensure all required PHP extensions are installed - Verify file permissions 3. **Login Issues** - Clear browser cookies and session - Check if sessions are properly configured - Verify password was correctly hashed ### Error Logging Enable PHP error logging for debugging: ```php // Add to top of index.php or config.php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); ``` ## License This project is open source and available under the MIT License. ## Support For issues and questions: 1. Check this README file 2. Review the code comments 3. Test with the sample data provided during setup ## Version History - **v1.0.0**: Initial release with basic publication management - Admin interface with authentication - Publication CRUD operations - Category system - Search functionality - Responsive design - Setup wizard