ComusThumbz 文档
管理员登录

Admin Header

Admin Header Include

File: ct/includes/header.php
Type: Backend Include File
Access Level: All Admin Pages
Last Updated: 2025-01-02

Overview

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 tblMenus database
  • Session management and authentication handling
  • Navigation preference persistence (database + localStorage)
  • CSS/JavaScript dependency loading

 


System Requirements

PHP Requirements

Requirement Minimum Recommended
PHP Version 7.4+ 8.0+
Memory Limit 64M 128M

PHP Extensions Required

  • mysqli - Database connectivity
  • session - Session management
  • json - JSON encoding/decoding for license cache
  • curl - License verification API calls

PHP Functions Required

  • sessionstart() - Session initialization
  • setcookie() - Cookie management for preferences
  • filegetcontents() / fileputcontents() - License cache file operations
  • curlinit(), 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:

Parent Icon Description
Help fa-question-circle Help resources and documentation
Import fa-file-import Content import tools
Database fa-database Database management
Engine fa-cogs Page builder engine
Templates fa-file-code Template management
Pages fa-file-alt Page editing
Traffic fa-chart-line Traffic controls
Reports fa-chart-bar Analytics and reports
Robots fa-robot Automated tasks
Tools fa-tools Utilities and maintenance
Multi fa-sitemap Multi-site operations
Settings fa-cog Configuration

Required Folders

Folder Permissions Purpose
ct/dat/ 755 License cache storage
ct/gui/ 755 Header images
ct/includes/ 755 Include files
ct/logs/ 775 Error logging

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:

Status Display Color
Verified (Paid) "Full Version: No Skim ✅" Green
Verified (Free) "Free Registered: 2% Skim ⚠️" Orange
Error License error message Red
Not Found "No Valid License Key Found" Red

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

  1. Look for the toggle switch in the license status bar
  2. Toggle between "Classic" and "Modern"
  3. Preference saves automatically
  4. Takes effect immediately
Tip: The navigation preference is stored in the database and synced with localStorage for reliability across sessions.

Understanding Menu Constants

The header defines menu constants for active state:

Constant Value Menu
HELP 0 Help
IMPORT 1 Import
DATABASE 2 Database
DNA 3 DNA (Templates)
ENGINE 4 Engine
PAGES 5 Pages
TRAFFIC 6 Traffic
ROBOTS 7 Robots
REPORTS 8 Reports
TOOLS 9 Tools
MULTI 10 Multi
SETTINGS 11 Settings

Adding Menu Items

  1. Navigate to Admin Panel → Settings → Menu Configuration
  2. 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

  1. Header checks for $licenseconfig array
  2. Looks for cached verification in ct/dat/licensecache.json
  3. If cache valid (< 1 hour), uses cached result
  4. If cache expired, calls license API
  5. Stores result in cache and displays status
Note: License verification happens on every page load but uses caching to minimize API calls. Cache duration is configurable via cacheduration in licenseconfig.

Best Practices

Performance Optimization

  1. License Caching: Don't reduce cacheduration below 300 seconds
  2. Menu Queries: Menu items are queried once per page load
  3. Credits Refresh: Auto-refresh interval is 30 seconds
  4. Announcement Refresh: Ticker refreshes every 60 seconds

Security Considerations

  1. Session Validation: Always starts session if not active
  2. Cookie Authentication: Validates login cookie against password hash
  3. CSRF Protection: Not directly in header, but session is initialized
  4. Output Buffering: Cleans unwanted output from includes
Warning: The login cookie uses a simple hash comparison. Ensure $pwhash is set correctly in config.inc.php.

Custom Menu Items

When adding custom menu items:

  • Use consistent parent names (Help, Import, Database, etc.)
  • Set appropriate optionmask for visibility rules
  • Use Font Awesome 6 icon classes
  • Keep priority values unique within parent

Troubleshooting

Common Issues

Navigation Dropdown Not Appearing

Cause: JavaScript error or missing menu arrays

Solutions:

  1. Check browser console for JavaScript errors
  2. Verify tblMenus table has data
  3. Check that menu arrays are generated correctly:
SELECT DISTINCT parent, COUNT(*)

   FROM tblMenus

   GROUP BY parent;
  1. Clear browser cache and refresh

License Status Shows Error

Cause: API communication failure or invalid credentials

Solutions:

  1. Verify $licenseconfig in config.inc.php
  2. Check that curl extension is enabled
  3. 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"}'
  1. Check ct/logs/php-error.log for detailed errors

Modern Navigation Not Switching

Cause: Database or JavaScript sync issue

Solutions:

  1. Check tblSettings.navstyle column exists:
SELECT navstyle FROM tblSettings WHERE id = 1;
  1. Verify getnavpreference.php is accessible
  2. Clear localStorage: localStorage.removeItem('navpreference')
  3. Check browser console for AJAX errors

Announcements Not Loading

Cause: API access or license verification issue

Solutions:

  1. Check browser console for fetch errors
  2. Verify license key is set (announcements require valid license)
  3. Check network tab for API response
  4. 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:

  1. Check getcredits.php exists and is working
  2. Verify license is verified (credits require valid license)
  3. Check credits balance in license dashboard
  4. 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/license
cache.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
Warning: SSL verification is disabled for license API calls. This is for compatibility but reduces security. Consider enabling in production environments with proper SSL certificates.

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"
}


Version History

Version Date Changes
1.0.0 2024-01-15 Initial classic navigation
1.1.0 2024-06-01 Added license verification
1.2.0 2024-09-01 Added modern navigation option
1.3.0 2024-11-15 Added announcement ticker
1.4.0 2024-12-01 Added notification bell
1.5.0 2025-01-02 Fixed navigation preference sync, improved page-to-menu mapping