Admin Header
Admin Header Include
ct/includes/header.phpOverview
The Admin Header include file (header.php) is the master template that renders the top navigation, license verification, announcement ticker, and all CSS/JavaScript dependencies for every admin page. It provides two navigation modes (Classic and Modern), handles session management, license verification with the ComusThumbz license server, and dynamically generates dropdown menus from the database.
Key capabilities include:
- Dual navigation system (Classic image map + Modern CSS dropdown)
- Real-time license verification with caching
- Credits balance display with auto-refresh
- Announcement ticker with remote API integration
- Dynamic menu generation from
tblMenusdatabase - Session management and authentication handling
- Navigation preference persistence (database + localStorage)
- CSS/JavaScript dependency loading
System Requirements
PHP Requirements
PHP Extensions Required
mysqli- Database connectivitysession- Session managementjson- JSON encoding/decoding for license cachecurl- License verification API calls
PHP Functions Required
sessionstart()- Session initializationsetcookie()- Cookie management for preferencesfilegetcontents()/fileputcontents()- License cache file operationscurlinit(),curlexec(),curlclose()- API communication
PHP Settings
session.autostart = Off
date.timezone = Your/Timezone
allowurlfopen = On
External Dependencies
- Font Awesome 6.4+ - Icon library (loaded via CDN)
- Google Fonts - Orbitron and Rajdhani fonts for modern navigation
- ComusThumbz License API - Remote license verification
- ComusThumbz Announcements API - Remote announcement ticker
Menu Parent Categories
The navigation system uses these parent menu categories:
Required Folders
Features & UI Elements
Modern Navigation
[Screenshot: header-modern-nav]
The modern navigation provides a clean, dropdown-based interface:
Top Bar Elements:
- Logo with brand icons (film, images, video, heart, fire)
- ComusThumbz brand name with tagline
- Quick access buttons (New Links, View Site)
- Notification bell with dropdown
- User profile dropdown
Main Navigation:
- Horizontal menu bar with 12 parent categories
- Dropdown menus on hover
- Active state highlighting based on current page
- Icon + text for each menu item
- Badge support for notifications
Classic Navigation
[Screenshot: header-classic-nav]
The classic navigation uses an image map:
Header Image:
- 800px wide header graphic
- 12 clickable regions for menu categories
- Dropdown menus appear on mouse hover
- Green color scheme (#e3f7db background)
Dropdown Menus:
- JavaScript-powered dropdown positioning
- Auto-hide on mouse out (250ms delay)
- Browser edge detection for positioning
- Unique menu arrays per category
License Status Bar
[Screenshot: header-license-status]
Displays license verification status:
Credits Display:
- Shows current credits balance
- Auto-refreshes every 30 seconds
- "Buy Credits" button with pulse animation
Navigation Toggle
[Screenshot: header-nav-toggle]
Toggle switch between Classic and Modern navigation:
- Saves preference to database (
tblSettings.navstyle) - Syncs with localStorage for backup
- Applies immediately without page reload
- Available in both navigation modes
Announcement Ticker
[Screenshot: header-announcement-ticker]
Scrolling announcement bar:
- Fetches announcements from ComusThumbz API
- Auto-refreshes every 60 seconds
- Pauses on hover
- Click tracking for action links
- Type-specific icons (info, success, warning, error, sale, update, maintenance)
- Priority badges for urgent announcements
Notification Bell
[Screenshot: header-notification-bell]
In modern navigation, displays unread notifications:
- Badge shows unread count (max 99+)
- Dropdown shows latest 5 notifications
- Priority-based ordering (urgent first)
- Color-coded icons by priority
- Links to full notifications page
Step-by-Step Usage
Switching Navigation Modes
- Look for the toggle switch in the license status bar
- Toggle between "Classic" and "Modern"
- Preference saves automatically
- Takes effect immediately
Understanding Menu Constants
The header defines menu constants for active state:
Adding Menu Items
- Navigate to Admin Panel → Settings → Menu Configuration
- Or insert directly into database:
INSERT INTO tblMenus (parent, title, url, iconclass, optionmask, priority, menuorder)
VALUES ('Tools', 'New Tool', 'newtool.php', 'fas fa-wrench', 0, 0, 10);
License Verification Flow
- Header checks for
$licenseconfigarray - Looks for cached verification in
ct/dat/licensecache.json - If cache valid (< 1 hour), uses cached result
- If cache expired, calls license API
- Stores result in cache and displays status
cacheduration in licenseconfig.Best Practices
Performance Optimization
- License Caching: Don't reduce cacheduration below 300 seconds
- Menu Queries: Menu items are queried once per page load
- Credits Refresh: Auto-refresh interval is 30 seconds
- Announcement Refresh: Ticker refreshes every 60 seconds
Security Considerations
- Session Validation: Always starts session if not active
- Cookie Authentication: Validates login cookie against password hash
- CSRF Protection: Not directly in header, but session is initialized
- Output Buffering: Cleans unwanted output from includes
$pwhash is set correctly in config.inc.php.Custom Menu Items
When adding custom menu items:
- Use consistent
parentnames (Help, Import, Database, etc.) - Set appropriate
optionmaskfor visibility rules - Use Font Awesome 6 icon classes
- Keep
priorityvalues unique within parent
Troubleshooting
Common Issues
Navigation Dropdown Not Appearing
Cause: JavaScript error or missing menu arrays
Solutions:
- Check browser console for JavaScript errors
- Verify
tblMenustable has data - Check that menu arrays are generated correctly:
SELECT DISTINCT parent, COUNT(*)
FROM tblMenus
GROUP BY parent;
- Clear browser cache and refresh
License Status Shows Error
Cause: API communication failure or invalid credentials
Solutions:
- Verify
$licenseconfigin config.inc.php - Check that curl extension is enabled
- Test API connectivity:
curl -X POST https://comusthumbz.com/projects/api.php/auth/verify \
-H "Content-Type: application/json" \
-d '{"licensekey":"YOURKEY","domain":"YOURDOMAIN","email":"YOUREMAIL"}'
- Check
ct/logs/php-error.logfor detailed errors
Modern Navigation Not Switching
Cause: Database or JavaScript sync issue
Solutions:
- Check
tblSettings.navstylecolumn exists:
SELECT navstyle FROM tblSettings WHERE id = 1;
- Verify
getnavpreference.phpis accessible - Clear localStorage:
localStorage.removeItem('navpreference') - Check browser console for AJAX errors
Announcements Not Loading
Cause: API access or license verification issue
Solutions:
- Check browser console for fetch errors
- Verify license key is set (announcements require valid license)
- Check network tab for API response
- Test API directly:
fetch('https://comusthumbz.com/projects/announcementsapi.php?action=get&location=header')
.then(r => r.json())
.then(console.log);
Credits Not Displaying
Cause: Credits balance API call failing
Solutions:
- Check
getcredits.phpexists and is working - Verify license is verified (credits require valid license)
- Check credits balance in license dashboard
- Review error logs for API failures
Debug Queries
-- Check menu structure
SELECT parent, title, url, optionmask, priority
FROM tblMenus
ORDER BY parent, priority;
-- Check navigation preference
SELECT navstyle FROM tblSettings WHERE id = 1;
-- Check notifications
SELECT notificationid, title, priority, isread
FROM tblUserNotifications
WHERE userid = 1
ORDER BY createdat DESC
LIMIT 10;
-- Check license cache timestamp
-- (View the file ct/dat/licensecache.json)
Security Considerations
Authentication
- Validates
$COOKIE['login']against$pwhash - Support cookie (
support=ok) grants elevated access - Session ID used as fallback user identifier
Output Sanitization
- Uses
htmlspecialchars()for output encoding - Menu URLs sanitized before rendering
- JavaScript variables escaped with
addslashes()
API Security
License API uses HTTPS
- SSL verification disabled for compatibility (
CURLOPTSSLVERIFYPEER = false) - API responses validated before use
Translatable Strings
{
"headercomusthumbz": "COMUSTHUMBZ",
"headertagline": "High Powered Website Automation",
"headernewlinks": "New Links",
"headerviewsite": "View Site",
"headernotifications": "Notifications",
"headerviewall": "View All",
"headerallcaughtup": "All caught up!",
"headernonotifications": "No new notifications",
"headerprofilesettings": "Profile Settings",
"headerlicenseinfo": "License Info",
"headerlogout": "Logout",
"headerlicenseverified": "License Verified",
"headerlicenseerror": "License Error",
"headercredits": "Credits",
"headerbuycredits": "Buy Credits",
"headernoskim": "No Skim",
"headerskimpercent": "{percent}% Skim",
"headerfullversion": "Full Version",
"headerfreeregistered": "Free Registered",
"headerclassic": "Classic",
"headermodern": "Modern",
"headerannouncements": "Announcements",
"headerloadingannouncements": "Loading announcements...",
"headernoannouncements": "No announcements at this time",
"headernovalidlicense": "No Valid License Key Found",
"headerbadkey": "Bad Key"
}
Related Documentation
- Admin Footer - Footer include with comments and bug reports
- Navigation Preference AJAX - Navigation preference handler
- Modern Navigation Styles - Modern navigation CSS
- License Configuration - License setup