Modern lightweight PHP/MySQL discussion platform for threaded discussion and lightweight community knowledge sharing.
Production / public instance (frontend view):
If the site is temporarily unavailable (maintenance / hosting sleep), you can still explore locally by following the Quick Start section below.
Tip: Replace
SITE_URLin your untrackedconfig/config.phpwithhttps://bhavyhomes.tech(or your own domain) when deploying.
Below is an at-a-glance experience of what a user (and admin) sees when the site is running locally at http://localhost/techforum.
| Page | Route | Purpose | Key UI Elements |
|---|---|---|---|
| Landing / Home | index.php |
Entry point, featured or recent posts | Top nav, hero header, link to sign in / browse |
| Auth Portal | auth.php |
Combined Sign In / Sign Up + Password Recovery toggle | Animated panel switch, Forgot Password flow, Admin Access button, Visit Forum link |
| Password Reset Guide | password_reset.php |
User submits email for manual admin reset | Instructional panel, form submission |
| Posts Listing (All/My) | `posts.php?view=all | my` | Browse or manage posts |
| Single Post View | post.php?id=### |
Read post + replies, increments views | View counter, reply form, owner/admin delete buttons |
| New Post | new_post.php |
Create a post | Title/body/category inputs, validation |
| Edit Post | edit_post.php?id=### |
Modify existing post | Live preview (if implemented), ownership check |
| Popular Posts | popular.php |
(Optional) Highlighted/popular content | Views-based ordering |
| Categories | categories.php |
Category navigation (if categories implemented) | List/grid of categories |
| Profile | profile.php |
User info & admin messages (posts managed externally) | Update profile form, Manage My Posts button |
| About | about.php |
How-to, platform usage & FAQ | Documentation blocks |
| Admin Access (Token Gate) | admin_access.php |
Layer 1 (token) + Layer 2 (fixed credentials) | Token form then credential form |
| Admin Dashboard | admin_dashboard.php |
Administrative management | Placeholder to extend |
Screenshots Placeholder: Create a
docs/screenshots/directory and add annotated images. Then embed:etc.
- User registration & login (session-based)
- Two-layer admin security (gateway token + fixed superadmin credentials)
- Create / edit / soft delete posts (owner & admin control)
- Replies with ownership validation
- Dynamic schema detection (
user_idvsauthor_id, optionalviewscolumn) - View counter with session throttling to prevent spam inflation
- External post management (My Posts via
posts.php?view=myinstead of profile tab) - About / help page for onboarding
- Migration helper (
migrate_add_views.php) for addingviewscolumn lazily
- Clone repository
- Copy
config/config.example.php→config/config.phpand set DB credentials - Create MySQL database (default name:
techforum) - Run any migration scripts if needed (e.g.
migrate_add_views.phponce) - Place project under Apache root (e.g.
C:/xampp/htdocs/techforum) - Navigate to
http://localhost/techforum/auth.phpto register or sign in - (Admin) Access secure portal via Auth page → “Admin Access” (enter token + credentials)
Two steps:
- Security Token (gateway) – prevents casual discovery of admin login
- Fixed Credentials (superadmin) – establishes admin session
See ADMIN_SECURITY_README.md for full operational and rotation guidance.
IMPORTANT: The repository ships with placeholder constants. Replace them immediately for any deployed environment.
- Visitor lands on Home or Auth.
- Signs up (username/email/password) → redirected to Dashboard or Posts list.
- Creates a new post (new_post.php) with a category.
- Other users browse
posts.php, click a post →post.php?id=##(views increment). - Users reply; owners/admin can delete their own posts/replies (soft delete where implemented).
- User manages their posts via
posts.php?view=my(edit/delete actions visible only for owners/admin). - Admin uses secure access path to moderate and review system state.
| Layer | Components |
|---|---|
| Presentation | PHP templates/pages (*.php), CSS in assets/css, JS behaviors in assets/js |
| Application | Session auth, soft delete logic, dynamic SQL query adaptation |
| Data | MySQL tables: users, posts, replies, optional admin_messages, plus migrations |
| Security | Token-gated admin portal, credential checks, session flags, input sanitization (h() helper) |
Dynamic schema logic inspects table columns (e.g., DESCRIBE posts) to determine whether to reference user_id or author_id, and whether a views column exists—enabling flexible deployment against slightly divergent schemas.
High-level (pseudocode):
users(id, username, email, password_hash, created_at, ...)
posts(id, user_id|author_id, title, body, category, views?, is_deleted, created_at, updated_at, deleted_at)
replies(id, post_id, user_id, body, created_at, is_deleted)
admin_messages(id, user_id, message, created_at) // optional
views may be added post-deployment via migrate_add_views.php.
- Hidden admin interface (token gate)
- Hardcoded (placeholder) constants for bootstrap simplicity
- Session-based auth + admin session segregation
- Soft delete avoids immediate data loss
- Basic output escaping helper for XSS mitigation
- Throttled view counting to reduce artificial inflation
Recommended Hardening Next:
- CSRF tokens on state-changing forms
- Password hashing (ensure using
password_hash()in auth handlers) - Rate limiting for login & token form
- Centralized logging & IP-based alerting
- Animated auth panel transitions
- Gradient buttons & subtle hover elevation
- “My Post” badge styling in listings
- Responsive navigation bar with ABOUT entry, uppercase branding
- Local stack: XAMPP (Apache + MySQL) or any LAMP equivalent
- No Composer dependencies currently – pure core PHP
- Add packages (e.g., for dotenv or routing) as project evolves
| File | Purpose |
|---|---|
init.php |
Bootstraps sessions & includes config/db |
includes/functions.php |
Utility functions (escaping, auth helpers) |
posts.php |
Central listing & management of posts |
post.php |
Single post view + replies + view increment logic |
edit_post.php |
Edit existing post (ownership enforced) |
migrate_add_views.php |
Adds views column if absent |
admin_access.php |
Token gate + admin credential form |
- Full-text search & category filtering
- Pagination / infinite scroll for large post sets
- Role-based multi-admin system with granular permissions
- Rich text or Markdown editor
- Email integration for password resets & notifications
- Dark mode toggle
- API endpoints (JSON) for headless integration
Manual sanity checklist:
- Register new user → login → create post → verify appears in All & My views
- Open post in new tab twice (within throttle window) → views increments only once
- Delete post (soft) → verify hidden from standard listing (unless logic includes deleted)
- Attempt editing another user’s post → should be blocked
- Admin token wrong → access denied, log entry in PHP error log
config/config.php and config/db.php are intentionally gitignored. Use the example files to configure your local environment. Never commit real credentials.
(Example values – DO NOT publish real production creds publicly)
- Update DB credentials to your hosting values.
- Set
SITE_URLto your domain (e.g.,https://bhavyhomes.tech). - Upload the project folder to your hosting account
htdocs/. - Ensure file permissions allow PHP to read config files.
- Fork
- Create feature branch (
git checkout -b feature/your-feature) - Commit changes (
git commit -m "Add feature") - Push (
git push origin feature/your-feature) - Open Pull Request
Please include a brief rationale for structural changes.
MIT (see LICENSE file)
Open an issue on GitHub or start a discussion thread once discussions are enabled.
- Added dynamic posts schema detection
- Implemented soft delete & edit capability
- Added view counter & migration
- Moved My Posts management external to profile
- Added About page & admin security hardening
- Sanitized credentials for public repository
- Register a user (auth.php) → redirected to dashboard.
- Create a post (new_post.php) with a category.
- View All Posts (posts.php) – note view count 0.
- Click post → single view page increments count.
- Refresh within throttle window → view count unchanged.
- Return to posts list → toggle to My Posts to edit/delete.
- Use Admin Access (token + creds) to reach dashboard.
Enjoy building on TechForum! 🧩