WEB-PHP CMS Integration
Integration guide for WEB-PHP CMS & WPMobile with SPChat: HMAC SSO tokens, live database connection testing, and automatic role mapping.
The WEB-PHP CMS Integration Module provides seamless Single Sign-On (SSO) and automatic user account synchronization for WEB-PHP CMS / WPMobile version 2.0.0 and higher. When members log in on your WEB-PHP CMS site, they can enter SPChat with one click without re-typing their password.
[!TIP] Free Module: Included in all SPChat licenses at no extra charge.
Core Features
- Live Database Connection Test: Integrated
Connection Testbutton verifies MySQL connectivity directly from the admin panel. - Single Sign-On (SSO): Secure HMAC-SHA256 token verification for one-click authentication.
- Automatic Role Mapping: Maps WEB-PHP user levels to SPChat roles:
- WEB-PHP Level 5 & 6 (Admin) → SPChat Admin
- WEB-PHP Level 4 (Moderator) → SPChat Moderator
- WEB-PHP Level 2 & 3 (Member) → SPChat User
- Auto-Provisioning: Automatically creates a matching SPChat user account upon initial SSO login.
- Seamless CMS Configuration: In WPMobile / WEB-PHP CMS version 2.0.0+, simply paste the generated SSO secret key into the CMS admin settings without touching PHP source code.
Step-by-Step Configuration Guide
Step 1: Configure Database Connection
Enter your WEB-PHP CMS MySQL database connection details into the module settings:
- Database Host / Port: e.g.,
127.0.0.1/3306 - Database Name: CMS database name (e.g.,
web_php_db) - Table Prefix: Table prefix (default:
web_php_1_) - Database User / Password: Database credentials with read access.
Click Test Connection to verify database connectivity.
Step 2: Generate SSO Secret & Save in CMS Settings
- Click Generate under SSO Token Configuration in the SPChat Admin Panel to create a secure secret key.
- Save the module settings in SPChat.
- Open your WEB-PHP CMS / WPMobile (v2.0.0+) admin dashboard and paste the copied SSO token into the dedicated chat integration settings. No source code modifications are required!
[!NOTE] Notice for Custom External Websites: If you wish to integrate SPChat SSO into a custom external website or non-standard PHP application, you can use the sample PHP snippet below (e.g., in your site’s
header.php):
<?php
// Sample snippet for external custom PHP websites (e.g. embed in header.php)
$sso_secret = 'YOUR_SSO_SECRET_KEY_HERE';
$chat_url = 'https://chat.yourdomain.com';
if (isset($_SESSION['sesswebphp']) || !empty($_SESSION['username']) || !empty($username)) {
$cms_username = $_SESSION['username'] ?? $username ?? '';
if ($cms_username !== '') {
$payload = base64_encode(json_encode(['u' => $cms_username, 't' => time()]));
$sig = hash_hmac('sha256', $payload, $sso_secret);
$chat_sso_url = $chat_url . '/sso/web-php-cms?sso_token=' . urlencode($payload) . '&sso_sig=' . $sig;
}
}
?>
<?php if (!empty($chat_sso_url)): ?>
<a href="<?= $chat_sso_url ?>" target="_blank" class="btn-chat">Open Chat</a>
<?php endif; ?>
Frequently Asked Questions (FAQ)
Are SSO tokens secure against tampering?
Yes. Every SSO token is cryptographically signed using HMAC-SHA256 with a unique secret and timestamped to prevent replay attacks.
Do users need pre-created SPChat accounts?
No. When Auto-Registration is enabled, SPChat automatically provisions user accounts and assigns roles upon first SSO redirect.
Still unsure? Test the chat yourself.
The live demo shows the interface and chat flow without installation. Join the waitlist for your own chat.