When a member logins into your content management system (CMS for short), normally several login values are stored as PHP session values ($_SESSION). These values are unique to the logged in user, so what we can do is use these values and enter them into the 'prochatrooms/cms.php' file. This allows us to auto-login to the chat room without entering our login details twice as long as we are logged into the content system.
How can we find out what these values are?
... actually is very easy to do even if your a newbie to all this technical stuff, just open your notepad (or any text editor) then copy and paste the code below and save the file as 'showSessions.php'.
/** Show Session Values **/
foreach($_SESSION as $key => $val)
echo $key . " : " . $val . "<br>";
Now upload the 'showSessions.php' file to your server and login to your content system. After logging in, type the url in your browser address bar to the 'showSessions.php' file. You should now see a white page with a list of data in it, something like,
username : somename
userid : 123
... there could be more details but thats the 2 that are the most important (the ones you need to use are username and userid, they might be slightly worded differently, eg instead of userid it might be uid but you should be able to tell which is the username and which is the userid values). Note: If the 'showSessions.php' file is blank (eg. nothing is displayed on the page), then you can stop reading this tutorial as my advice here wont be able to help you integrate the chat room with your content system, sorry about that.
Now we have these values, lets enter them to our 'prochatrooms/cms.php' file,
1) Open the file 'prochatrooms/cms.php' and enable this setting,
// Enable custom login details
define('C_CUSTOM_LOGIN','1'); // 0 OFF, 1 ON
2) Now we enter the values for the users name and id (remember how we found out what this was by using the 'showSessions.php' file?),
// Enter your CMS Global values below
define('C_CUSTOM_USERNAME',$_SESSION['username']); // username
define('C_CUSTOM_USERID',$_SESSION['userid']); // userid
if(!isset($_SESSION['userid']) || isset($_SESSION['userid']) < 1)
die("Please login from the main website");
3) Open the file 'prochatrooms/include/config.php' and edit the settings shown so they match below,
* integrated with CMS
* allows users to auto-login
$CONFIG['CMS'] = '1'; // 0 No, 1 Yes
* enable guest mode
* allows guests to login to chat room
$CONFIG['guestMode'] = '0'; // 0 No, 1 Yes - allow guests to login
Now (in theory and assuming you have entered the correct values for the username and userid), the values for the username and userid are 'hardcoded' into the Pro Chat Rooms and as long as the user is logged into your CMS they will be auto logged into the chat room.
To link to your chat room and auto log your members in, use the url below.
Reason: added check session is set in step 2, prevents blank windows/userlist when not integrated correctly
- Search option isnt just there to look pretty, its your fastest solution.
- Sorry guys, but please do not PM me for help. It helps everyone if you post your questions in the forum as other users may be too shy to ask! lol
Disclaimer: Please note that any views or opinions i express in my forum posts are solely mine and do not necessarily represent those of Pro Chat Rooms.