# 🧠 MentalNet Funnies **A lightweight PHP + SQLite web app for hosting MentalNet Original comic strips.** Built for simplicity, security, and self-hosting β€” no external dependencies, just pure PHP, HTML, and CSS. --- ## πŸš€ Overview **MentalNet Funnies** is a micro-comic CMS that serves as the home for *Debian Osaka*, *Tux*, *Miku*, and other MentalNet.xyz comics. It’s designed for local hosting on Apache + PHP setups and includes a tiny password-protected admin panel for uploads. ### ✨ Features * πŸ–Ό Upload, title, and describe new comics via a web form * πŸ’Ύ SQLite database β€” no external DB needed * πŸ” Password-protected admin area * πŸ“± Mobile-friendly front page (`index.php`) * πŸͺΆ Compact iframe version (`funnies-frame.php`) for embedding * βš™οΈ One-click database initializer (`init_db.php`) --- ## πŸ“ Directory Structure ``` /var/www/html/funnies/ β”œβ”€β”€ index.php # Main public comic viewer β”œβ”€β”€ funnies-frame.php # Small-width iframe-friendly viewer β”œβ”€β”€ uploads/ # Comic image storage β”œβ”€β”€ mentalnet_funnies.db # SQLite database file β”œβ”€β”€ admin/ β”‚ β”œβ”€β”€ auth.php # Login handler β”‚ β”œβ”€β”€ config.php # Config & DB setup β”‚ β”œβ”€β”€ upload.php # Upload interface β”‚ β”œβ”€β”€ init_db.php # Manual DB table initializer └── README.md # This file ``` --- ## βš™οΈ Installation 1. **Create directory & set permissions** ```bash sudo mkdir -p /var/www/html/funnies/uploads sudo chown -R www-data:www-data /var/www/html/funnies sudo chmod -R 755 /var/www/html/funnies ``` 2. **Set up the admin password** Generate a bcrypt hash: ```bash php -r 'echo password_hash("YourStrongPassword", PASSWORD_DEFAULT), PHP_EOL;' ``` Then place that hash inside `admin/config.php` under: ```php $ADMIN_PASS_HASH = '$2y$10$replace_with_real_hash'; ``` 3. **Initialize the database** Visit: `https://yourdomain.com/funnies/admin/init_db.php` Or run the init script via command-line: `php init_db.php` It will create the `comics` table or confirm if it already exists. 4. **Upload a comic** Visit: `https://yourdomain.com/funnies/admin/auth.php` Log in and use the form to upload images and descriptions. 5. **View your comics** * Main gallery: `https://yourdomain.com/funnies/` * Iframe feed: `https://yourdomain.com/funnies/funnies-frame.php` --- ## πŸͺ„ Embedding the Funnies Frame The iframe viewer (`funnies-frame.php`) is optimized for small layouts (β‰ˆ 325 px). Example embed: ```html ``` > πŸ’‘ You can adjust image width inside `funnies-frame.php` (default: 250 px for compact display). --- ## πŸ›‘ Security Notes * Only the admin section (`/admin/`) requires authentication. * Use strong passwords and HTTPS. * The upload form restricts to images only. * SQLite DB and uploads folder should be owned by `www-data` with 755 perms. --- ## 🧩 Customization Ideas * Add a β€œView All Comics →” link inside the iframe version. * Include navigation buttons (Next / Previous comic). --- ## 🧰 License MIT License β€” free to modify and self-host. Created by **MarkMental** as part of the **mentalnet.xyz** web ecosystem. > β€œIn the MentalNet, Tux is root β€” and Miku too.” 🐧🎀