πŸ“‘

Smart QR System

Tag Activation & Communication System β€” Structure Reference
v1.0 β€” PHP + MySQL

πŸ—οΈ System Architecture

Four main layers β€” click any card for more details

πŸ›‘οΈ
Admin Layer
Super Admin & Support Agent panel for managing tags, users, analytics, and system configuration.
Super Admin / Support Agent
🌐
Public Layer
QR scan landing, tag activation, and visitor action pages β€” no login required.
No Authentication Required
πŸ‘€
User Layer
Activated users manage their profile, view scan logs, configure tag settings, and download PDF eTag.
Activated Users Only
βš™οΈ
Service Layer
Backend APIs: OTP, PDF generation, SMS, WhatsApp, Callback, and action logging.
API / Backend Services

πŸ“Š Tag Status Flow

Every QR tag passes through these statuses

⬜ Available
β†’
🟑 Assigned
β†’
πŸ”΅ Activated
β†’
πŸ”΄ Blocked
or
⚫ Expired

πŸ”— QR Tag URL Format

All tags share the same URL pattern β€” unique code per QR

🌐 https://yourdomain.com/tag/CAR1001 Same pattern for all tag types

πŸ‘₯ User Roles

πŸ‘‘
Super Admin
Full system access β€” QR generation, user management, settings, billing, and all reports.
🎧
Support Agent
Handles support tickets, callback requests, and assists users with tag issues.
πŸ“±
Activated User
Person who has activated a QR tag. Can manage profile, settings, and download eTag PDF.
πŸ‘οΈ
Public Visitor
Person who scans a QR code β€” can view tag info, send WhatsApp, request callback, or call (masked).

⚑ Tag Activation Flow β€” 10 Steps

Complete journey from QR scan to successful activation

01QR Scan
β†’
02Tag Validate
β†’
03Intro Page
β†’
04Enter Mobile
β†’
05OTP Verify
β†’
06Full Form
β†’
07Tag Mapping
β†’
08PDF Generate
β†’
09Welcome SMS/WA
β†’
10βœ… Success
πŸ’‘
Each activation is logged with IP address, device type, source, and OTP verification status. A PDF eTag is auto-generated and sent via WhatsApp/SMS at the end.

🎯 Smart Action Buttons

Shown on the public page after a tag is activated β€” visitor can choose any action

πŸ“ž
Masked Call
Call owner without revealing real number
πŸ’¬
WhatsApp Message
Send message to owner on WhatsApp
πŸ””
Callback Request
Owner will call back the visitor
πŸ“„
PDF eTag
Download tag info as PDF
πŸ“
Location Share
Share current GPS location with owner
πŸ“±
SMS Fallback
Send SMS if WhatsApp not available
🎧
Live Support
Connect to support agent for help

🌐 Public Frontend Pages

All pages accessible without login β€” main visitor-facing interface

ℹ️
All public URLs are under /public/ or root level. No authentication required. These are the pages a visitor sees after scanning a QR code.
πŸ“²
Tag Landing Page
First page after QR scan. Checks tag status β€” shows action buttons if activated, else starts activation.
/tag/{tag_code}
⚑
Activation Wizard
Multi-step form: intro β†’ mobile β†’ OTP β†’ full profile form β†’ success.
/public/activate.php
🎯
Action Page
Shows smart action buttons for activated tag. Handles WhatsApp, callback, PDF, location, call.
/public/action.php
πŸ””
Callback Request Form
Visitor enters name & number. Request saved to DB and owner gets WhatsApp/SMS notification.
/public/callback.php
πŸ“
Location Share
Captures visitor GPS via browser API and sends coordinates to tag owner via WhatsApp/SMS.
/public/location.php
πŸ“„
PDF eTag Download
Generates and serves the tag owner's PDF eTag for download. Logged in action_logs.
/api/generate-pdf.php

πŸ›‘οΈ Admin Panel Modules

All admin pages under /admin/ β€” requires admin authentication

πŸ“‹ Tags Management

🏷️ Tags List
View all tags, filter by status/batch, search by code. Bulk actions: block, assign, delete.
/admin/tags/list.php
⚑ Bulk QR Generate
Generate 1–1000 QR codes at once with prefix, batch name. Downloads ZIP of QR images.
/admin/tags/bulk-generate.php
πŸ”— Assign Tags
Manually assign available tags to users or agents. Set tag type (vehicle, contact, emergency).
/admin/tags/assign.php

πŸ‘₯ User Management

πŸ“‹ Users List
All activated users with mobile, name, tag code, status. Filter, search, export CSV.
/admin/users/list.php
πŸ‘οΈ User Detail
Full profile, scan logs, action logs, subscription info. Block/unblock user from here.
/admin/users/view.php
πŸ’³ Subscriptions
Manage user plans, validity, feature access. Extend or change subscription manually.
/admin/users/subscriptions.php

πŸ“Š Analytics & Communications

πŸ“ˆ
Analytics Dashboard
Total scans, activations, actions by type. Charts for daily/weekly/monthly trends.
/admin/analytics/
πŸ”
Scan Logs
Every QR scan with device type, IP, GPS coordinates, timestamp. Filterable by tag or date.
/admin/analytics/scan-logs.php
πŸ””
Callback Requests
All pending/contacted/closed callbacks. Assign to agents. Update status after contact.
/admin/communications/callbacks.php
🎧
Support Tickets
User-raised issues. Assign to agents, set priority, track resolution. Internal notes supported.
/admin/communications/tickets.php
βš™οΈ
Settings
SMTP, SMS API, WhatsApp API, Telephony API keys. Site config, OTP expiry, plan limits.
/admin/settings/

πŸ‘€ User Dashboard Pages

Accessible only to activated users (OTP-based session login)

πŸ”
Users do not have a password. Login is done via mobile OTP. Session is maintained after OTP verification. All user pages are under /user/.
🏠
Dashboard Home
Welcome screen showing tag status, recent scans, quick links to profile and settings.
/user/dashboard.php
✏️
Edit Profile
Update name, WhatsApp, vehicle number, emergency contacts, address, and profile photo.
/user/profile.php
πŸ”§
Tag Settings
Toggle: Masked Call, WhatsApp, SMS, Callback, Location Share, Live Support on/off.
/user/settings.php
πŸ“‹
Scan Logs
View all scans of own tag with timestamp, device type, location. See who scanned and when.
/user/scan-logs.php
πŸ“Š
Action Logs
WhatsApp clicks, PDF downloads, callback requests, calls β€” all visitor actions in one view.
/user/action-logs.php
πŸ“„
PDF eTag
Download or regenerate personal PDF eTag with QR code embedded. Share or print for physical use.
/user/pdf-etag.php
πŸ””
Callback Requests
View incoming callback requests from visitors. Mark as contacted or close after resolution.
/user/callbacks.php
🎧
Support Tickets
Raise issues with support team. View ticket status and agent replies.
/user/support.php

πŸ—„οΈ Database Schema

15 core tables β€” MySQL. PK = Primary Key, FK = Foreign Key, UK = Unique Key

tags Core table β€” every QR code is a row here
ColumnTypeNotes
id PKINT AUTO_INCREMENTPrimary identifier
tag_code UKVARCHAR(20)Unique code e.g. CAR1001
statusENUMavailable / assigned / activated / blocked / expired
assigned_user_id FKINT NULL→ users.id
tag_typeVARCHAR(30)vehicle / contact / emergency / visitor
batch_nameVARCHAR(50)Bulk generation batch label
qr_imageVARCHAR(255)Path to QR image file
created_atTIMESTAMPAuto-set on insert
users Activated users β€” mobile is the unique identifier
ColumnTypeNotes
id PKINT AUTO_INCREMENT
mobile UKVARCHAR(15)Used for OTP login
full_nameVARCHAR(100)
whatsapp_numberVARCHAR(15)Can differ from mobile
statusENUMactive / blocked
created_atTIMESTAMP
user_profiles Extended profile + feature toggles per tag
ColumnTypeNotes
id PKINT AUTO_INCREMENT
user_id FKINT→ users.id
tag_id FKINT→ tags.id
vehicle_numberVARCHAR(20)For vehicle tags
masked_call_enabledTINYINT(1)Toggle ON/OFF
whatsapp_enabledTINYINT(1)Toggle ON/OFF
sms_enabledTINYINT(1)Toggle ON/OFF
callback_enabledTINYINT(1)Toggle ON/OFF
support_enabledTINYINT(1)Toggle ON/OFF
location_enabledTINYINT(1)Toggle ON/OFF
activations One row per activation event
ColumnTypeNotes
id PKINT AUTO_INCREMENT
tag_id FKINT→ tags.id
user_id FKINT→ users.id
otp_verifiedTINYINT(1)1 = verified, 0 = skipped
ip_addressVARCHAR(45)IPv4 or IPv6
activation_sourceVARCHAR(50)web / android / ios
activated_atTIMESTAMP
scan_logs Every QR scan is recorded here
ColumnTypeNotes
id PKINT AUTO_INCREMENT
tag_id FKINT→ tags.id
device_typeVARCHAR(30)mobile / desktop / tablet
latitudeDECIMAL(10,7)GPS coordinate
longitudeDECIMAL(10,7)GPS coordinate
ip_addressVARCHAR(45)
scan_timeTIMESTAMPAuto-set
action_logs All visitor actions on activated tags
ColumnTypeNotes
id PKINT AUTO_INCREMENT
tag_id FKINT→ tags.id
action_typeVARCHAR(50)whatsapp_click / pdf_download / callback / call / location
visitor_mobileVARCHAR(15)Optional β€” if provided by visitor
statusVARCHAR(20)success / failed / pending
created_atTIMESTAMP
callback_requests Visitor callback requests awaiting owner response
ColumnTypeNotes
id PKINT AUTO_INCREMENT
tag_id FKINT→ tags.id
visitor_nameVARCHAR(100)
visitor_mobileVARCHAR(15)
statusENUMnew / contacted / closed
created_atTIMESTAMP
admins Admin and support agent accounts
ColumnTypeNotes
id PKINT AUTO_INCREMENT
email UKVARCHAR(100)Login email
passwordVARCHAR(255)bcrypt hashed
roleENUMsuper_admin / support_agent
is_activeTINYINT(1)1 = active
plans + subscriptions Plan definitions and per-user subscription tracking
ColumnTypeNotes
plans.id PKINT
plans.nameVARCHAR(50)Basic / Standard / Premium
plans.max_tagsINTMax tags per user
plans.validity_daysINT365 / 730 etc.
subscriptions.user_id FKINT→ users.id
subscriptions.plan_id FKINT→ plans.id
subscriptions.expires_atDATEExpiry date
subscriptions.payment_statusENUMpaid / pending / free
settings Global system configuration (key-value store)
ColumnTypeNotes
id PKINT AUTO_INCREMENT
setting_key UKVARCHAR(100)e.g. smtp_host, sms_api_key
setting_valueTEXTStored as text, cast in PHP
updated_atTIMESTAMPLast modified

πŸš€ Build Phases

Start with Phase 1 (MVP) β€” working product in shortest time

P1
Phase 1 β€” MVP Core
Start here β€” everything needed for a working system
DB Setup (all 15 tables)
Admin Auth (login/logout)
Bulk QR Generation
Public Tag Routing (/tag/{code})
OTP Send & Verify API
Tag Activation Flow (all 10 steps)
Tag ↔ User Mapping
Smart Action Page
WhatsApp Button
Callback Request Form
PDF eTag Generator
Scan Logger
P2
Phase 2 β€” User & Analytics
After MVP is working β€” add user experience & reporting
User Dashboard
Profile Edit
Tag Settings (toggles)
Scan Logs (user view)
Action Logs (user view)
Admin Analytics Dashboard
PDF Advanced Template
Support Tickets System
Admin Callback Manager
P3
Phase 3 β€” Advanced & Monetization
Premium features β€” add after core is stable
SMS API Integration
Masked Call API
Plans & Subscriptions
Payment Gateway
Location Share (GPS)
Live Chat / Video Call (optional)
Admin Mobile App (optional)

πŸ“ Folder Structure

Complete project directory layout

πŸ“ /project-root/
β”œβ”€β”€ πŸ“ admin/
β”‚ β”œβ”€β”€ πŸ“ tags/ # list.php, bulk-generate.php, assign.php
β”‚ β”œβ”€β”€ πŸ“ users/ # list.php, view.php, subscriptions.php
β”‚ β”œβ”€β”€ πŸ“ analytics/ # index.php, scan-logs.php
β”‚ β”œβ”€β”€ πŸ“ communications/ # callbacks.php, tickets.php
β”‚ └── πŸ“ settings/ # index.php (SMTP, SMS, WA API keys)
β”œβ”€β”€ πŸ“ user/
β”‚ β”œβ”€β”€ dashboard.php
β”‚ β”œβ”€β”€ profile.php
β”‚ β”œβ”€β”€ settings.php # feature toggles
β”‚ β”œβ”€β”€ scan-logs.php
β”‚ β”œβ”€β”€ action-logs.php
β”‚ β”œβ”€β”€ pdf-etag.php
β”‚ β”œβ”€β”€ callbacks.php
β”‚ └── support.php
β”œβ”€β”€ πŸ“ public/
β”‚ β”œβ”€β”€ activate.php # multi-step activation wizard
β”‚ β”œβ”€β”€ action.php # smart action buttons page
β”‚ β”œβ”€β”€ callback.php # visitor callback form
β”‚ └── location.php # GPS share page
β”œβ”€β”€ πŸ“ api/
β”‚ β”œβ”€β”€ send-otp.php
β”‚ β”œβ”€β”€ verify-otp.php
β”‚ β”œβ”€β”€ activate-tag.php
β”‚ β”œβ”€β”€ save-callback.php
β”‚ β”œβ”€β”€ save-location.php
β”‚ β”œβ”€β”€ log-action.php
β”‚ β”œβ”€β”€ generate-pdf.php
β”‚ └── bulk-generate-tags.php
β”œβ”€β”€ πŸ“ includes/
β”‚ β”œβ”€β”€ db.php # DB connection (PDO)
β”‚ β”œβ”€β”€ config.php # global constants
β”‚ β”œβ”€β”€ auth.php # session / role checks
β”‚ β”œβ”€β”€ functions.php # helper functions
β”‚ β”œβ”€β”€ header.php
β”‚ └── footer.php
β”œβ”€β”€ πŸ“ assets/ # CSS, JS, images
β”œβ”€β”€ πŸ“ uploads/
β”‚ β”œβ”€β”€ πŸ“ qr/ # generated QR images
β”‚ β”œβ”€β”€ πŸ“ pdf/ # generated PDFs
β”‚ └── πŸ“ users/ # user profile photos
└── tag.php # root: /tag/{code} β†’ routes to public/activate or public/action