Skip to content

Latest commit

Β 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TechForum

Modern lightweight PHP/MySQL discussion platform for threaded discussion and lightweight community knowledge sharing.


🌍 Live Deployment

Production / public instance (frontend view):

➑️ https://bhavyhomes.tech

If the site is temporarily unavailable (maintenance / hosting sleep), you can still explore locally by following the Quick Start section below.

Tip: Replace SITE_URL in your untracked config/config.php with https://bhavyhomes.tech (or your own domain) when deploying.


🌐 Live Web View (Conceptual Walkthrough)

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: ![Auth Portal](docs/screenshots/auth.png) etc.


✨ Features

  • 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_id vs author_id, optional views column)
  • View counter with session throttling to prevent spam inflation
  • External post management (My Posts via posts.php?view=my instead of profile tab)
  • About / help page for onboarding
  • Migration helper (migrate_add_views.php) for adding views column lazily

πŸš€ Quick Start

  1. Clone repository
  2. Copy config/config.example.php β†’ config/config.php and set DB credentials
  3. Create MySQL database (default name: techforum)
  4. Run any migration scripts if needed (e.g. migrate_add_views.php once)
  5. Place project under Apache root (e.g. C:/xampp/htdocs/techforum)
  6. Navigate to http://localhost/techforum/auth.php to register or sign in
  7. (Admin) Access secure portal via Auth page β†’ β€œAdmin Access” (enter token + credentials)

πŸ” Admin Access Overview

Two steps:

  1. Security Token (gateway) – prevents casual discovery of admin login
  2. 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.


🧭 User Journey Flow

  1. Visitor lands on Home or Auth.
  2. Signs up (username/email/password) β†’ redirected to Dashboard or Posts list.
  3. Creates a new post (new_post.php) with a category.
  4. Other users browse posts.php, click a post β†’ post.php?id=## (views increment).
  5. Users reply; owners/admin can delete their own posts/replies (soft delete where implemented).
  6. User manages their posts via posts.php?view=my (edit/delete actions visible only for owners/admin).
  7. Admin uses secure access path to moderate and review system state.

🧱 Architecture Snapshot

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.


πŸ—„ Database (Typical Minimal Schema)

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.


πŸ”Ž Security Features

  • 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

πŸ’‘ UI Highlights

  • Animated auth panel transitions
  • Gradient buttons & subtle hover elevation
  • β€œMy Post” badge styling in listings
  • Responsive navigation bar with ABOUT entry, uppercase branding

πŸ›  Development Notes

  • 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

Common Scripts / Pages

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

πŸ“ˆ Roadmap (Ideas)

  • 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

πŸ§ͺ Testing Suggestions

Manual sanity checklist:

  1. Register new user β†’ login β†’ create post β†’ verify appears in All & My views
  2. Open post in new tab twice (within throttle window) β†’ views increments only once
  3. Delete post (soft) β†’ verify hidden from standard listing (unless logic includes deleted)
  4. Attempt editing another user’s post β†’ should be blocked
  5. Admin token wrong β†’ access denied, log entry in PHP error log

πŸ” Secrets & Environment

config/config.php and config/db.php are intentionally gitignored. Use the example files to configure your local environment. Never commit real credentials.

InfinityFree Hosting Notes

(Example values – DO NOT publish real production creds publicly)

  • Update DB credentials to your hosting values.
  • Set SITE_URL to 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.

🀝 Contributing

  1. Fork
  2. Create feature branch (git checkout -b feature/your-feature)
  3. Commit changes (git commit -m "Add feature")
  4. Push (git push origin feature/your-feature)
  5. Open Pull Request

Please include a brief rationale for structural changes.


πŸ“„ License

MIT (see LICENSE file)


πŸ“¬ Support / Questions

Open an issue on GitHub or start a discussion thread once discussions are enabled.


πŸ“ Changelog (Condensed)

  • 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

🧭 Quick Demo Script (Narrative)

  1. Register a user (auth.php) β†’ redirected to dashboard.
  2. Create a post (new_post.php) with a category.
  3. View All Posts (posts.php) – note view count 0.
  4. Click post β†’ single view page increments count.
  5. Refresh within throttle window β†’ view count unchanged.
  6. Return to posts list β†’ toggle to My Posts to edit/delete.
  7. Use Admin Access (token + creds) to reach dashboard.

Enjoy building on TechForum! 🧩

About

about web applications like Reddit, GitHub, StackFlow etc.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages