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

FeaturesInstallationConfigurationSecurity


✨ 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