PHP

TeamO Ranch — Farm & Agribusiness Website

TeamO Ranch is a sustainable farm e-commerce and service-booking website for an agricultural business based in Ibadan, Oyo State, Nigeria. It serves as an online storefront connecting the farm directly with individual buyers, bulk purchasers, restaurants, and businesses seeking fresh produce and professional processing services — all priced in Nigerian Naira and tailored for the University of Ibadan community and broader Ibadan market.

The platform is built on plain PHP 7.4 with a singleton PDO database class, Tailwind CSS 3.4.18 for styling, and Vanilla JavaScript for client-side interactivity. No framework is used — the architecture follows a clean separation between public-facing templates (/templates/pages/), admin pages (/admin/), reusable includes (/includes/), and a config layer with separate local and production configuration files.

A notable data model decision is the three-tier product pricing system: each product stores separate price_live, price_dressed, and price_processed fields, allowing a single farm item (e.g., a chicken) to be priced differently based on its preparation state. The order form dynamically shows the applicable pricing options and captures multi-product baskets under a generated order number (ORD-YYYYMMDD-XXXXXX), while the admin manually updates payment status once funds are received.

The admin panel provides a full dashboard with statistics, CRUD for products and services, order and contact-message management, and multi-admin user support with bcrypt password hashing and last-login tracking. Security is handled manually throughout — CSRF tokens on every form, parameterised SQL queries, file-upload validation, HTTPOnly session cookies, and .htaccess security headers including X-Frame-Options, X-XSS-Protection, and X-Content-Type-Options.


TeamO Ranch — Farm & Agribusiness Website screenshot

Key Features

44 features built into this project

Product catalog with category filtering — Chicken
Fish
Eggs
Feeds
Three-tier product pricing model — live
dressed
and processed prices per item
Multi-product order form with generated order numbers (ORD-YYYYMMDD-XXXXXX)
Service booking inquiry form with status workflow (new
contacted
quoted
confirmed
completed)
Admin dashboard with stats cards — total products
orders
pending
revenue
Product CRUD with image upload (5 MB max
jpg/png/gif/webp validation)
Service management with slug-based routing and display-order control
Order management — view
filter by status
update order and payment status
Contact-message management with status tracking (new
read
replied)
Multi-admin user management — add/delete admins
change password
last-login tracking
Email notifications on order creation sent to both admin and customer
CSRF protection on all public forms using random_bytes(32) tokens
Stock-status indicators — Low Stock (<20 units) and Out of Stock badges
SEO — Open Graph tags
Twitter cards
canonical URLs
geo-location meta tags
Dynamic sitemap generator (sitemap.xml.php) and robots.txt
Gzip compression and browser caching (1-year images
1-month CSS/JS) via .htaccess
HTTP security headers via .htaccess — X-Frame-Options
X-XSS-Protection
X-Content-Type-Options
Lazy-loading images via IntersectionObserver API
Responsive mobile-first design with Tailwind utility grid

Challenges & Solutions

Technical problems encountered during development and how each was resolved.

1

Implementing a flexible product pricing model without a commerce framework required designing three separate price columns (price_live, price_dressed, price_processed) on the products table and building order-form logic that dynamically renders only the price options relevant to each product category. This kept the schema simple while supporting the farm real-world pricing structure where the same animal is sold at different prices depending on whether the buyer wants it live, field-dressed, or fully processed.

2

Without a payment gateway, the order workflow had to bridge the gap between online order placement and offline bank transfers. The solution was to generate a unique order number immediately on submission, email it to both the customer and admin, and give the admin a one-click status panel to manually advance the order through pending, processing, ready, and completed stages and flip the payment flag once funds cleared — keeping the process auditable without requiring real-time payment integration.

3

All security hardening that a framework would provide by default had to be implemented explicitly: PDO prepared statements with ATTR_EMULATE_PREPARES = false for true parameterisation, per-session CSRF tokens validated on every POST, bcrypt password hashing for admin accounts, HTTPOnly and cookie-only session configuration, file-upload MIME-type and size validation before storage, and a comprehensive .htaccess file that blocks direct config access, disables directory listing, adds HTTP security headers, and enforces browser caching and Gzip compression.

4

Deploy-time configuration management was solved with a dual-config pattern: a local config/config.php for development and a config/config.production.php template with clearly marked TODO placeholders for database credentials, SITE_URL, SITE_EMAIL, and SMTP settings. A Hostinger deployment guide documents the full go-live checklist — including folder permissions (755 for uploads, 644 for config) and the admin password reset procedure — so the site can be handed off to a non-technical owner.