Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ET chat login problem
12-14-2009, 10:06 PM
Post: #1
ET chat login problem
Hi, I have installed ET chat and edited as the tutorial states (I think) but the one problem i have is correcting the code so that users cant use new chat names. For example, I can access it as 'admin' but then change my name to 'steve'. How do I code it so that users are brought straight to chat using their myBB usernames and privelages? Here is my code:

<?php
session_start();
define("IN_MYBB", 1);
require_once "../global.php";
$group_ids = array(8, 9, 3, 4, 6);
$cur_gid = $mybb->user['usergroup'];
if (in_array($cur_gid, $group_ids)) // Group Member
{
$username = $chatusername;
}
else
{
die("Sorry, you aren't allowed to chat. Please contact for more information.");
}

//*****************************************************************************
// Für die Realisierung der Anbindung des Chats an Ihr Userverwaltungssystem aus einem
// Forum, CMS, usw. müssen Sie lediglich die unten stehenden Sessionvariablen
// in Ihrem System mit dem Usernamen belegen und den User mit einem
// Link auf diese Datei führen. Beachten Sie dass dabei der Username ohne Passwort übertragen wird.
// Sie dürfen also in Chat keine Passwörter für Admins und Mods anlegen. Für einen Chatbenutzer ist die
// Übergabe des Usernamen über die Sessionvar. $_SESSION['etchat_username'] aus Ihrem
// System ausreichend.

//$username = $_SESSION['etchat_username'];
//$gender = $_SESSION['etchat_gender']; //[optional] 'f' or 'm' system default 'n' if unset

// Die Admins und Mods sollen ohne PW im Chat angelegt werden!
// Die class/Index.class.php soll gelöscht werden, damit niemand unbefugt als Afmin rein kann!

//---------------------------------------------------------------------------
// oder als GET oder POST Übergabe, jedoch unsicher und sollte kodiert werden
// $username = $_REQUEST['etchat_username'];
// $gender = $_REQUEST['etchat_gender'];
//---------------------------------------------------------------------------

// Weiterleitung nach dem Logout(die Session bleibt bestehen,
// da sonst der User aus Ihrem System rausfliegt.)
$_SESSION['etchat_v3_logout_url']="../index.php";

##############################################################
# DO NOT EDIT BELOW ###############################################
##############################################################

function __autoload($class_name) {
if (substr($class_name, 0, 5)=="Admin")
require_once ('class/admin/'.$class_name.'.class.php');
else
require_once ('class/'.$class_name.'.class.php');
}

$get_var = array_keys($_GET);
$init_class = (!empty($get_var[0])) ? $get_var[0] : "Index";

// initialise
new $init_class;

?>
Find all posts by this user
Quote this message in a reply
12-15-2009, 03:38 AM
Post: #2
RE: ET chat login problem
$chatusername is not defined in your script and so is $username.

Kind regards
Lennart Sauter

Forum Admin
Visit this user's website Find all posts by this user
Quote this message in a reply
12-15-2009, 10:18 AM
Post: #3
RE: ET chat login problem
Thanks, what or how do I do this? Sorry but Im only learning as I go along. What piece of code should be inserted and where?
Find all posts by this user
Quote this message in a reply
12-16-2009, 03:16 AM
Post: #4
RE: ET chat login problem
instead of:
PHP Code:
You cannot view this code until you login or register
use:
PHP Code:
You cannot view this code until you login or register

Should work.

Forum Admin
Visit this user's website Find all posts by this user
Quote this message in a reply
Today, 00:00 AM
Advertisement
12-16-2009, 08:41 AM
Post: #5
RE: ET chat login problem
I changed that and it did nothing. The exact same options still apear, username and sex then if I use a random name like 'Steve' I get straight in. If I use my admin username it asks for a password which I enter.

Also, my mods are still being told they dont have access rights.
Find all posts by this user
Quote this message in a reply
12-17-2009, 02:36 AM
Post: #6
RE: ET chat login problem
Did you rename the file properly? The above file has to be saved as index.php overwriting the old one.

Please read the instructions carefully.

Forum Admin
Visit this user's website Find all posts by this user
Quote this message in a reply
12-17-2009, 05:19 AM
Post: #7
RE: ET chat login problem
Yes. I redid everything again using your script and all I kept getting were 'invisible' errors but when I use the script by itmanvn I can get chat but it allows the selection of a random 'chat' name. In other words it recognises myBB username but still allows me to pick another name. If I can remove this option I think Im ok. Heres he index script as it stands;

<?php
session_start();
define("IN_MYBB", 1);
require_once "../global.php";
$group_ids = array(8, 9, 3, 4, 6, 1, 2, 5, 7);
$cur_gid = $mybb->user['usergroup'];
if (in_array($cur_gid, $group_ids)) // Group Member
{
$username = "".$mybb->user['username']; // match logged in user
$_SESSION['etchat_username'] = $username;
$_SESSION['etchat_v3_username'] = $username;
}
else
{
die("Sorry, you aren't allowed to chat. Please contact for more information.");
}

//*****************************************************************************
// Für die Realisierung der Anbindung des Chats an Ihr Userverwaltungssystem aus einem
// Forum, CMS, usw. müssen Sie lediglich die unten stehenden Sessionvariablen
// in Ihrem System mit dem Usernamen belegen und den User mit einem
// Link auf diese Datei führen. Beachten Sie dass dabei der Username ohne Passwort übertragen wird.
// Sie dürfen also in Chat keine Passwörter für Admins und Mods anlegen. Für einen Chatbenutzer ist die
// Übergabe des Usernamen über die Sessionvar. $_SESSION['etchat_username'] aus Ihrem
// System ausreichend.

// Die Admins und Mods sollen ohne PW im Chat angelegt werden!
// Die class/Index.class.php soll gelöscht werden, damit niemand unbefugt als Afmin rein kann!

//---------------------------------------------------------------------------
// oder als GET oder POST Übergabe, jedoch unsicher und sollte kodiert werden
// $username = $_REQUEST['etchat_username'];
// $gender = $_REQUEST['etchat_gender'];
//---------------------------------------------------------------------------

// Weiterleitung nach dem Logout(die Session bleibt bestehen,
// da sonst der User aus Ihrem System rausfliegt.)
$_SESSION['etchat_v3_logout_url']="../index.php";

##############################################################
# DO NOT EDIT BELOW ###############################################
##############################################################

function __autoload($class_name) {
if (substr($class_name, 0, 5)=="Admin")
require_once ('class/admin/'.$class_name.'.class.php');
else
require_once ('class/'.$class_name.'.class.php');
}

$get_var = array_keys($_GET);
$init_class = (!empty($get_var[0])) ? $get_var[0] : "Index";

// initialise
new $init_class;

?>
Find all posts by this user
Quote this message in a reply
12-17-2009, 07:41 AM
Post: #8
RE: ET chat login problem
The functions inside the chat are out of my control, sorry.

Forum Admin
Visit this user's website Find all posts by this user
Quote this message in a reply
Today, 00:00 AM
Advertisement
Post Reply 


  • Share
  • heart Add to favourites
  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


This site is property of Lennart Sauter, powered by Zaiendo.de.