Forums / Cotonti / Extensions / Flashchat Plugin Autologin

scriptor
#1 2010-02-12 23:48
I use the flashchat with the old plugin from seditio. it works good, but when i´m logged in and want to open the chat i must login me in the chat too... and about the cotonti auth system i don´t know enough to repair it self.

Here the file that looks if you logged in:
<?php
// integration class for Seditio v100+ (http://www.neocrome.net/)

//error_reporting(E_ALL);
$seditio_root_path = realpath(dirname(__FILE__) . '/../../../') . '/';

include($seditio_root_path . 'datas/config.php');

class seditioCMS {

  var $userid;
  var $loginStmt;
  var $getUserStmt;
  var $getUsersStmt;

  function seditioCMS() {

    $this->loginStmt      = new Statement("SELECT user_id AS id, user_name AS login, user_password AS password FROM {$GLOBALS['db_prefix']}users WHERE user_name=? LIMIT 1");
    $this->getUserStmt    = new Statement("SELECT user_id AS id, user_name AS login, user_maingrp, user_avatar, user_gender  FROM {$GLOBALS['db_prefix']}users WHERE user_id=? LIMIT 1");
    $this->getUsersStmt   = new Statement("SELECT user_id AS id, user_name as login FROM {$GLOBALS['db_prefix']}users");

    $this->userid = NULL;
    if(isset($_SESSION['rsedition']))  $this->userid = $_SESSION['rsedition'];

  }


  function isLoggedIn() {
    return $this->userid;
  }

  function getRoles($status) {
   
    $rv = ROLE_NOBODY; // Banned by default

    if($status['user_maingrp'] == 1)  $rv = ROLE_ANY; // Guests = no access
    if($status['user_maingrp'] == 2)  $rv = ROLE_ANY; // Inactive = no access
    if($status['user_maingrp'] == 3)  $rv = ROLE_NOBODY; // Banned = no access

    if($status['user_maingrp'] == 4)  $rv = ROLE_USER; // Member = user access
    if($status['user_maingrp'] == 7)  $rv = ROLE_USER;
    if($status['user_maingrp'] == 8)  $rv = ROLE_USER;

    if($status['user_maingrp'] == 5)  $rv = ROLE_ADMIN; // Administrators = admin access
    if($status['user_maingrp'] == 6)  $rv = ROLE_MODERATOR; // Moderators = moderator access
    if($status['user_maingrp'] == 10)  $rv = ROLE_MODERATOR;

// Additional user groups (replace x with grpid) = user access
//  if($status['user_maingrp'] == x)  $rv = ROLE_MODERATOR; // Additional user groups (replace x with grpid) = moderator access
//  if($status['user_maingrp'] == x)  $rv = ROLE_ADMIN; // Additional user groups (replace x with grpid) = admin access

    return $rv;
  }

  function getUserProfile($userid) {

    if ($userid == SPY_USERID) $rv = NULL;

    elseif ($user = $this->getUser($userid)) {
      $rv  = "../flashchat_sed_users.php?m=details&id=" . $userid;
    }

    return $rv;
  }


  function getUser($userid) {
    $rv = NULL;

    if(($rs = $this->getUserStmt->process($userid)) && ($rec = $rs->next())) {

      $rec['roles'] = $this->getRoles($rec);
      $rv = $rec;
    }
    return $rv;
  }

  function login($login, $password) {

    $rs = $this->loginStmt->process($login);
    $this->userid = null;

    if ( ($rec = $rs->next()) &&
         ($rec['password'] == md5($password))
       ) $this->userid = $rec['id'];

    return $this->userid;
  }

   function userInRole($userid, $role) {

          if($rs = $this->getUser($userid)) return ($this->getRoles($rs) == $role);
          return false;
  }

  function logout() {

  }

  function getUsers() {
   return $this->getUsersStmt->process();
  }

  function getGender($userid) {
        // 'M' for Male, 'F' for Female, NULL for undefined

$sex = $this->getUserStmt->process($userid);
if($gender = $sex->next()) {
if($gender['user_gender'] == 'F') return 'F';
if($gender['user_gender'] == 'M') return 'M';
}
        return NULL;
  }

  function getPhoto($userid) {

$rs = $this->getUserStmt->process($userid);
if($rec = $rs->next()) {

$fileExt = explode(',', $GLOBALS['fc_config']['photoloading']['allowFileExt']);

$oldFile = './nick_image/' . $userid . '.';
$fs = reset($fileExt);
while($fs) {
if(file_exists($oldFile . $fs)) return $oldFile . $fs;
$fs = next($fileExt);
}

if(!empty($rec['user_photo']))  return '../' . $rec['user_photo'];
if(!empty($rec['user_avatar'])) return '../' . $rec['user_avatar'];
}
return '';
  }


}


$GLOBALS['fc_config']['db'] = array(
                 'host' => $cfg['mysqlhost'],
                 'user' => $cfg['mysqluser'],
                 'pass' => $cfg['mysqlpassword'],
                 'base' => $cfg['mysqldb'],
                 'pref' => "sed_fc_",
                 );

$GLOBALS['db_prefix'] = 'sed_';

$GLOBALS['fc_config']['cms'] = new seditioCMS();



foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
  $GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

?>
[url=http://www.freak-forum.de]Freak-Forum.de[/url] - The Freakstyle Community<br />
[url=http://www.adelmann-solutions.com]adelmann-solutions, webdesign Freiburg[/url]
Trustmaster
#2 2010-02-13 00:13
Passwords are still md5, the only thing you need to change is that there is no more $_SESSION['rsedition']. Use this code to get user id instead:
$site_id = 'ct' . substr(md5($cfg['mainurl']), 0, 10); // read $cfg['mainurl'] from config.php
if(!empty($_COOKIE[$site_id]) || !empty($_SESSION[$site_id]))
{
    $u = empty($_SESSION[$site_id]) ? base64_decode($_COOKIE[$site_id]) : base64_decode($_SESSION[$site_id]);
    $u = explode(':_:', $u);
    $u_id = (int) sed_import($u[0], 'D', 'INT');
    $u_passhash = sed_import($u[1], 'D', 'ALP');
    $this->user_id = $u_id;
}
This is not very correct, because the password should be checked if using cookie. I see, it's a mistake in Cotonti and user_id should be also stored in session to simplify integration with such scripts.
May the Source be with you!
tensh
#3 2010-02-14 21:49
Can you upload this integration and point to this chat script? :)
scriptor
#4 2010-02-16 19:59
hm it dont work. no autologin is possible... hmmm

Added 1 day later:

Here the official tufat Flashchat Website: http://www.tufat.com/s_flash_chat_chatroom.htm
Anyone a idea how to script a autologin?
[url=http://www.freak-forum.de]Freak-Forum.de[/url] - The Freakstyle Community<br />
[url=http://www.adelmann-solutions.com]adelmann-solutions, webdesign Freiburg[/url]

Dit bericht is bewerkt door scriptor (2010-02-18 18:27, 14 jaren ago)
Kaan
#5 2010-02-18 21:06
I `m more then upload Seditio version Flash chat integration
scriptor
#6 2010-02-18 21:14
Flash chat is a payd chat. But the integration script is here: http://www.cotonti.com/datas/users/flashchat_283.rar
But only the auto-Login do not work :(
[url=http://www.freak-forum.de]Freak-Forum.de[/url] - The Freakstyle Community<br />
[url=http://www.adelmann-solutions.com]adelmann-solutions, webdesign Freiburg[/url]
Kaan
#7 2010-02-18 21:34
Page: http://www.seditio-eklenti.com/page.php?id=135
Aotu Login version.
Down: http://www.seditio-eklenti.com/page.php?id=135&a=dl
Site login and download hotlink security active

Added 2 minutes later:

cotonti site no upload

My Personal File Space

Total size : 0KB / 10240KB (0%) Maximum size for a file : 1024KB

Chat file 2 mb sory upload.
scriptor
#8 2010-02-18 22:13
Tricky to understand a turkey site when you don´t speak turkey... can you set the seditiocms script from inc/cmses here as code please?

Added 2 days later:

Okay, the new script from kaan includes the old integration that do not allow the autologin. I don´t know what to do. no one a idea?
[url=http://www.freak-forum.de]Freak-Forum.de[/url] - The Freakstyle Community<br />
[url=http://www.adelmann-solutions.com]adelmann-solutions, webdesign Freiburg[/url]

Dit bericht is bewerkt door scriptor (2010-02-21 02:10, 14 jaren ago)