prochat login smf members

Started by clyght, May 08, 2009, 08:48:33 AM

Previous topic - Next topic

clyght

hello somebody help me.
im new to php.

i dont know whats the meaning of this.

on my prochat script here is the code for integrate.

<?php

include("globals.php");



// INTEGRATION NOTES FOR CUSTOM DEVELOPERS

// You can insert your existing CMS user Global values into the
// login procedure. Simply replace the values $_FOO['username']
// and $_FOO['userid'] with your SESSION, COOKIE or MySQL results.

// Example:

// define('C_CUSTOM_USERNAME',$_FOO['username']); // username
// define('C_CUSTOM_USERID',$_FOO['userid']); // userid

// You will be able to link directly to the chat room by adding
// an <a href> link to your web pages like shown below and only
// registered users will be able to auto-login to your chat room.

// <a href="http://yoursite.com/prochatrooms">Chat Room</a>


## CUSTOM INTEGRATION SETTINGS ##############


// Enable custom login details

define('C_CUSTOM_LOGIN','0'); // 0 OFF, 1 ON


// Enter your CMS Global values below

define('C_CUSTOM_USERNAME',$_FOO['username']); // username
define('C_CUSTOM_USERID',$_FOO['userid']); // userid


## DO NOT EDIT BELOW THIS LINE ##############


// if remote login via CMS

if($remotely_hosted){

// check username isset
if(!isset($_COOKIE["uname"])){

header("Location: error.php");
die;

}

// if userid is null, assign userid
if(!isset($_COOKIE["uid"])){

$uid='-1';

}else{

$uid=$_COOKIE["uid"];

}

}

// if custom login

if(C_CUSTOM_LOGIN){

// assign username
$uname = C_CUSTOM_USERNAME;

if(!C_CUSTOM_USERID){

// userid empty
$uid = '-1';

}else{

// assign userid
$uid = C_CUSTOM_USERID;

}

}

// if default login

if(!$remotely_hosted && !C_CUSTOM_LOGIN){

?>

<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
if(GetCookie("login") == null){
window.location="error.php";
}
// -->
</SCRIPT>

<?php }?>


they tell

// You can insert your existing CMS user Global values into the
// login procedure. Simply replace the values $_FOO['username']
// and $_FOO['userid'] with your SESSION, COOKIE or MySQL results.

so this is the code that need to change

define('C_CUSTOM_USERNAME',$_FOO['username']); // username
define('C_CUSTOM_USERID',$_FOO['userid']); // userid

what code should i change here
$_FOO['username']
$_FOO['userid']

sorry i dont what the cookie and session..

sorry for my english.. :P

JBlaze

Hello, just going through some old support topics. Do you still require assistance with this issue?
Jason Clemons
Former Team Member 2009 - 2012

krl1

Hello
Can you delp me with this problem?
I want to integrate pro chat rooms v4.0.2 with smf 1.1.9.
I cannot find any documentation.....
thanks

Kindred

Add this up at the top of the file, just after the other include

require_once('path/to/SSI.php');


and then, in place of FOO, use


define('C_CUSTOM_USERNAME',$user_info['username']); // username
define('C_CUSTOM_USERID',$user_info['id']); // userid
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

krl1

Excellent suport!
Thanks,i will do that.I will let you know the results!

krl1

Thanks for your hxxp:help.works [nonactive].
Only one problem.If you can help me with this one too...
I have username and display hxxp:name.in [nonactive] smfis set to be the hxxp:same.in [nonactive] joomla they are diferent :
Name: John    Username :John123
The chat collect the real name,John,any chance to chnge that to John123?
Any way,thanks for your help!

Kindred


define('C_CUSTOM_USERNAME',$user_info['name']); // username
define('C_CUSTOM_USERID',$user_info['id']); // userid
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

krl1

#7
No,not working.I have cleared the cookies,logout,log in again.
Show real name,john,not john 123.But in SMF show corect,john 123,only in chat show john....
Here is the cms.php
<?php

include("globals.php");
require_once(
'/home/xxxxxxxxxx/public_html/forum/SSI.php');



// INTEGRATION NOTES FOR CUSTOM DEVELOPERS

// You can insert your existing CMS user Global values into the
// login procedure. Simply replace the values $_FOO['username']
// and $_FOO['userid'] with your SESSION, COOKIE or MySQL results.

// Example:

// define('C_CUSTOM_USERNAME',$_FOO['name']); // username
// define('C_CUSTOM_USERID',$_FOO['userid']); // userid

// You will be able to link directly to the chat room by adding
// an <a href> link to your web pages like shown below and only
// registered users will be able to auto-login to your chat room.

// <a href="http://yoursite.com/prochatrooms">Chat Room</a>


## CUSTOM INTEGRATION SETTINGS ##############


// Enable custom login details

define('C_CUSTOM_LOGIN','0'); // 0 OFF, 1 ON


// Enter your CMS Global values below

define('C_CUSTOM_USERNAME',$user_username['name']); // username
define('C_CUSTOM_USERID',$user_info['id']); // userid


## DO NOT EDIT BELOW THIS LINE ##############


// if remote login via CMS

 
if($remotely_hosted){

     
// check username isset
     
if(!isset($_COOKIE["uname"])){

       
header("Location: error.php");
        die;

     }

     
// if userid is null, assign userid
     
if(!isset($_COOKIE["uid"])){

       
$uid='-1';

     }else{

       
$uid=$_COOKIE["uid"];

     }

  }

// if custom login

 
if(C_CUSTOM_LOGIN){

     
// assign username
     
$uname = C_CUSTOM_USERNAME;

     if(!
C_CUSTOM_USERID){

       
// userid empty
       
$uid = '-1';

     }else{

       
// assign userid
       
$uid = C_CUSTOM_USERID;

     }

  }

// if default login

 
if(!$remotely_hosted && !C_CUSTOM_LOGIN){

 
?>

      <SCRIPT LANGUAGE="JavaScript1.2">
      <!--
      function getCookieVal (offset) {
           var endstr = document.cookie.indexOf (";", offset);
           if (endstr == -1)
           endstr = document.cookie.length;
           return unescape(document.cookie.substring(offset, endstr));
      }
      function GetCookie (name) {
           var arg = name + "=";
           var alen = arg.length;
           var clen = document.cookie.length;
           var i = 0;
           while (i < clen) {
             var j = i + alen;
             if (document.cookie.substring(i, j) == arg)
             return getCookieVal (j);
             i = document.cookie.indexOf(" ", i) + 1;
             if (i == 0) break;
           }
           return null;
      }
      if(GetCookie("login") == null){
         window.location="error.php";
      }
      // -->
      </SCRIPT>

<?php }?>

Orstio

QuoteI have username and display name.In smfis set to be the same.In joomla they are diferent

If your username and real name are set to be the same in SMF, you will get the same results from both fields.

Perhaps you are looking for an integration between prochat and Joomla instead of prochat and SMF?

krl1

should integrate with smf.With joomla is nothing around ;).....and i have found here suport for smf,doesnt really mater which one of them,joomla or smf.Just need to work!

Orstio

define('C_CUSTOM_USERNAME',$user_username['name']); // username

There's most likely your problem.  That's supposed to be $user_info.

krl1

I have updated the cms file,now is ok,i think.
But same problem john instead of john123.Any think else i can do?
<?php

include("globals.php");
require_once(
'/home/xxxxxxxxx/public_html/forum/SSI.php');



// INTEGRATION NOTES FOR CUSTOM DEVELOPERS

// You can insert your existing CMS user Global values into the
// login procedure. Simply replace the values $_FOO['username']
// and $_FOO['userid'] with your SESSION, COOKIE or MySQL results.

// Example:

// define('C_CUSTOM_USERNAME',$_FOO['name']); // username
// define('C_CUSTOM_USERID',$_FOO['userid']); // userid

// You will be able to link directly to the chat room by adding
// an <a href> link to your web pages like shown below and only
// registered users will be able to auto-login to your chat room.

// <a href="http://yoursite.com/prochatrooms">Chat Room</a>


## CUSTOM INTEGRATION SETTINGS ##############


// Enable custom login details

define('C_CUSTOM_LOGIN','0'); // 0 OFF, 1 ON


// Enter your CMS Global values below

define('C_CUSTOM_USERNAME',$user_info['name']); // username
define('C_CUSTOM_USERID',$user_info['id']); // userid


## DO NOT EDIT BELOW THIS LINE ##############


// if remote login via CMS

 
if($remotely_hosted){

     
// check username isset
     
if(!isset($_COOKIE["uname"])){

       
header("Location: error.php");
        die;

     }

     
// if userid is null, assign userid
     
if(!isset($_COOKIE["uid"])){

       
$uid='-1';

     }else{

       
$uid=$_COOKIE["uid"];

     }

  }

// if custom login

 
if(C_CUSTOM_LOGIN){

     
// assign username
     
$uname = C_CUSTOM_USERNAME;

     if(!
C_CUSTOM_USERID){

       
// userid empty
       
$uid = '-1';

     }else{

       
// assign userid
       
$uid = C_CUSTOM_USERID;

     }

  }

// if default login

 
if(!$remotely_hosted && !C_CUSTOM_LOGIN){

 
?>

      <SCRIPT LANGUAGE="JavaScript1.2">
      <!--
      function getCookieVal (offset) {
           var endstr = document.cookie.indexOf (";", offset);
           if (endstr == -1)
           endstr = document.cookie.length;
           return unescape(document.cookie.substring(offset, endstr));
      }
      function GetCookie (name) {
           var arg = name + "=";
           var alen = arg.length;
           var clen = document.cookie.length;
           var i = 0;
           while (i < clen) {
             var j = i + alen;
             if (document.cookie.substring(i, j) == arg)
             return getCookieVal (j);
             i = document.cookie.indexOf(" ", i) + 1;
             if (i == 0) break;
           }
           return null;
      }
      if(GetCookie("login") == null){
         window.location="error.php";
      }
      // -->
      </SCRIPT>

<?php }?>

Kindred

if the realname and the name fields in the smf database are actually the same, then no.... nothing you can do.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

yakyakyak

Is there any SMF 2.0 RC3 bridge for Prochat?

No reply from Prochat mail :-/

Kindred

nothing official on this side... so, unless prochat responds, I suspect you may need to write one yourself.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

yakyakyak

thankyou for the prompt reply

would the solution posted above be relevant for SMF 2.0 RC3
or are there differences in what needs passing


I don't know if the above was a fix for 1.1.x ???

yakyakyak

#16
Made progress and now managing to establish members name and cookie being passed ok

But with guests,
using the code below they are logged in chat as "C_CUSTOM_USERNAME"


if($context['user']['is_logged'])
  define('C_CUSTOM_LOGIN','1'); // 0 OFF, 1 ON
else
define('C_CUSTOM_LOGIN','0'); // 0 OFF, 1 ON

if($context['user']['is_logged'])
{
define('C_CUSTOM_USERNAME',$user_info['username']); // username
define('C_CUSTOM_USERID',$user_info['id']); // userid
}


Any help appreciated

thanks

poser3dart

Not to hijack the thread but to answer a few post asked in it.
Pro chat does integrate with 2.0 rc3.

» Integration Instructions For Pro Chat Rooms 5/6- SMF 2.0

Remember to replace YOURWEBSITE with your domain name.

1) Open your SMF file 'Themes/default/index.template.php' and look for line 154, ( do the same in custom templates )

echo '

Directly underneath add the following code (before the </header> tag),
<script language="JavaScript"><!--
var userName = "', $context['user']['name'], '";
var userID = "', $context['user']['id'], '";
var roomID = "Lobby";
// --></script>
<script language="JavaScript" type="text/javascript" src="http://www.YOURWEBSITE.com/prochatrooms/chat.js"></script>

2) Open the SMF file 'Sources/Subs.php' and scroll to line 3680 which looks like,

// Set up the menu privileges.

3) Directly underneath add the following code,

$context['allow_prochatrooms'] = !$user_info['is_guest'];

Scroll down slightly until you see the code below,

'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),

Directly underneath, add the following code,

'prochatrooms' => array(
'title' => 'CHAT',
'href' => 'javascript:launchChat()',
'show' => $context['allow_prochatrooms'],
'sub_buttons' => array(
),
),




A note:  If you have installed other mods the line numbers above will and do change but the area is still close to the same.  Just do a search in the file.
Also if you set members only in (prochat config.php)
// NOTE: if the chat room is integrated with a CMS

// guests will not be allowed to login (see above).



$members_only = "1"; // 0 No, 1 Yes

then only logged in members to your forum will see the chat button and be able to chat.

Hope this helps.

yakyakyak


Kill Em All

 clyght, do you need any further help with this topic?


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Advertisement: