Skip to content

6arshid/linkbox-php-cms-category-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— LinkBox PHP CMS

A clean, secure, full-stack link directory CMS built with PHP & MySQL

GitHub PHP MySQL Bootstrap License

Developed by 6arshid

Features β€’ Installation β€’ Configuration β€’ Security


✨ Features

🌐 Public Side

  • Browse approved links with search and category filtering
  • Paginated listing β€” 10 links per page
  • Submit links β€” pending admin approval before going live
  • Screenshot image upload per link
  • Click-through visit tracking
  • Fully responsive Bootstrap 5 design
  • No login required for visitors

πŸ” Admin Panel

  • Dashboard with live stats and Chart.js charts
  • Approve / Reject / Edit / Delete submitted links
  • Category management β€” create, edit, delete
  • Statistics β€” 30-day chart, hourly heatmap, top links, visit log
  • Secure login with CSRF protection

πŸš€ Installation

βœ… Super Simple β€” Just 3 Steps!

No manual SQL import needed. The setup wizard does everything automatically.

Step 1 β€” Copy files to htdocs

Extract and place all files directly inside htdocs\:

C:\xampp\htdocs\
β”œβ”€β”€ index.php
β”œβ”€β”€ submit.php
β”œβ”€β”€ goto.php
β”œβ”€β”€ setup.php        ← Run this first!
β”œβ”€β”€ admin\
β”œβ”€β”€ assets\
β”œβ”€β”€ includes\
β”œβ”€β”€ uploads\
└── ...

⚠️ Place files directly in htdocs\, not inside a subfolder.

Step 2 β€” Run the Setup Wizard

Make sure Apache + MySQL are running in XAMPP, then open:

http://localhost/setup.php

The wizard will:

  • βœ… Connect to your MySQL
  • βœ… Create the linkbox database automatically
  • βœ… Create all tables (admins, categories, links, link_visits)
  • βœ… Insert default categories
  • βœ… Save your config to includes/config.ini
  • βœ… Create your admin account with a secure bcrypt password

Step 3 β€” Delete setup.php

After the wizard completes, delete setup.php from your server.


πŸŽ‰ Done! Access your site:

URL Description
http://localhost/ Public homepage
http://localhost/submit.php Submit a link
http://localhost/admin/login.php Admin panel

βš™οΈ Configuration

Settings are stored in includes/config.ini (auto-generated by setup wizard).

db_host   = "localhost"
db_name   = "linkbox"
db_user   = "root"
db_pass   = ""
site_name = "LinkBox"
site_url  = "http://localhost"

config.ini is listed in .gitignore and will never be committed to Git.

To change settings after installation, either edit includes/config.ini directly or re-run:

http://localhost/setup.php?force=1

πŸ—‚οΈ Project Structure

htdocs/
β”œβ”€β”€ index.php               ← Homepage (public, no login required)
β”œβ”€β”€ submit.php              ← Link submission form
β”œβ”€β”€ goto.php                ← Visit tracker & redirect
β”œβ”€β”€ setup.php               ← Setup wizard (delete after install!)
β”œβ”€β”€ .htaccess               ← Security rules
β”œβ”€β”€ .gitignore              ← Keeps config.ini and uploads out of Git
β”‚
β”œβ”€β”€ admin/
β”‚   β”œβ”€β”€ login.php           ← Admin login
β”‚   β”œβ”€β”€ logout.php          ← Admin logout
β”‚   β”œβ”€β”€ dashboard.php       ← Stats dashboard
β”‚   β”œβ”€β”€ links.php           ← Manage links
β”‚   β”œβ”€β”€ link-edit.php       ← Edit a single link
β”‚   β”œβ”€β”€ categories.php      ← Category CRUD
β”‚   β”œβ”€β”€ stats.php           ← Charts & analytics
β”‚   └── pages/
β”‚       β”œβ”€β”€ header.php      ← Admin sidebar layout
β”‚       └── footer.php      ← Admin footer
β”‚
β”œβ”€β”€ includes/
β”‚   β”œβ”€β”€ config.php          ← Dynamic config loader
β”‚   β”œβ”€β”€ config.ini          ← Your settings (auto-created, gitignored)
β”‚   └── helpers.php         ← CSRF, auth, upload, sanitization
β”‚
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ css/public.css      ← Public styles
β”‚   β”œβ”€β”€ css/admin.css       ← Admin styles
β”‚   β”œβ”€β”€ js/public.js        ← Public scripts
β”‚   └── js/admin.js         ← Admin + Chart.js
β”‚
β”œβ”€β”€ uploads/screenshots/    ← Uploaded images (auto-created)
└── database.sql            ← Manual backup schema (not required for install)

πŸ—ƒοΈ Database Tables

Table Description
admins Admin user accounts
categories Link categories
links All submitted links with status
link_visits Per-visit log for analytics

πŸ”’ Security

Feature Implementation
SQL Injection PDO prepared statements on every query
CSRF Tokens on all POST forms
XSS htmlspecialchars() on all output
Passwords password_hash() bcrypt cost 12
File Uploads MIME type + extension + size validation
PHP in uploads Blocked via .htaccess
Directory listing Disabled via Options -Indexes
Session security httponly, samesite=Strict cookies
Config file config.ini blocked from web access via .htaccess

🌐 Deploying to a Live Server

  1. Upload all files to your server's public root
  2. Run the setup wizard: https://yourdomain.com/setup.php
  3. The wizard auto-detects your URL β€” just verify it's correct
  4. Delete setup.php after installation
  5. Make sure uploads/screenshots/ is writable (chmod 755)

πŸ› οΈ Customization

What Where
Site name Re-run setup or edit includes/config.ini
Links per page $perPage in index.php
Max upload size MAX_FILE_SIZE in includes/config.php
Public colors CSS variables in assets/css/public.css
Admin colors CSS variables in assets/css/admin.css

πŸ“ License

This project is open source under the MIT License.


Made with ❀️ by 6arshid · PHP, MySQL & Bootstrap 5

⭐ Star this repo if you find it useful!

πŸ”— github.com/6arshid/linkbox-php-cms-category-view

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors