Sngine – The Ultimate PHP Social Network Platform is a cool php script.
How to integrate html5 chat into that script ?
Edit the .htaccess file and add these lines:
# Chat
RewriteRule ^chat/?$ chat.php [L,QSA]
Create chat.php file and paste this code:
<?php $webmasterid = xxxx; // your webmasterid html5chat account $password = 'yyyy'; // your html5 chat password require('bootloader.php'); if (!isset($user) || !isset($user->_data) || !isset($user->_data) || !isset($user->_data['user_id'])) { header('Location:/'); } if ($user->_is_admin) { $role = 'admin'; } else if ($user->_is_moderator) { $role = 'moderator'; } else { $role ='user'; } $user = $user->_data; $json = json_encode(array( 'id' => $user['user_id'], 'username' => $user['user_name'], 'password' => $password, 'gender' => $user['user_gender'], 'role' => $role, 'image' => base64_encode($user['user_picture']), 'profile' => "https://yoursite.com/{user['user_name']}" ) ); $encoded = file_get_contents("https://jwt.html5-chat.com/protect/" . base64_encode($json)); ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Chat</title> <style> html, body, #chatContainer { width: 100%; height: 100%; margin: 0; padding: 0; } </style> </head> <body> <div id="chatContainer"> <script src="https://html5-chat.com/script/<?= $webmasterid ?>/<?= $encoded ?>"></script> </div> </body> </html>
Edit the first lines and put your own data
$webmasterid = xxxx; $password = 'yyyy';
Then navigate to yourSite.com/chat
and you should see WHOLE page html5 chat