A clean, secure, full-stack link directory CMS built with PHP & MySQL
Developed by 6arshid
- 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
- 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
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 inhtdocs\, 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
linkboxdatabase 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.
| URL | Description |
|---|---|
http://localhost/ |
Public homepage |
http://localhost/submit.php |
Submit a link |
http://localhost/admin/login.php |
Admin panel |
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.iniis listed in.gitignoreand 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
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)
| Table | Description |
|---|---|
admins |
Admin user accounts |
categories |
Link categories |
links |
All submitted links with status |
link_visits |
Per-visit log for analytics |
| 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 |
- Upload all files to your server's public root
- Run the setup wizard:
https://yourdomain.com/setup.php - The wizard auto-detects your URL — just verify it's correct
- Delete
setup.phpafter installation - Make sure
uploads/screenshots/is writable (chmod 755)
| 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 |
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!