A clean, secure, full-stack link directory CMS built with PHP & MySQL
Developed by 6arshid
Features β’ Installation β’ Configuration β’ Security
- 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!