Codes need !!

 

Hi,

after a couple of checking I have an autolog in my chat systeme and the bd is already integrate but for the autolog option there missing some compatibility code in the script ,It contain Dolphin and Dolphin4 part of code for the complet log but nothing for D7 version. I put the  code present in the script now for the autolog option and write red notes where i think there are a missing codes but maybe need more change too .Maybe its a good idea to precise that a Gchat visichat system.

 

 

<?php
include_once("library/factory.php");
class visichat_autologin{
var $factory;
var $db;
var $setting;
var $members_table;
var $id_field;
var $username_field;
var $password_field;
var $integrate;
var $integrate_prefix;
var $username    = "";
var $password    = "";
function visichat_autologin(){
$this->factory    = new factory();
$this->db         = $this->factory->get_db();
$this->setting    = $this->factory->getInstance("setting");
$this->members_table = $this->setting->get("members_table");
$this->id_field = $this->setting->get("id_field");
$this->username_field = $this->setting->get("username_field");
$this->password_field = $this->setting->get("password_field");
$this->integrate = $this->setting->get("integrate");
$this->integrate_prefix = $this->setting->get("integrate_prefix");
if($this->integrate != ""){
$this->getUser();
$this->getPass();

}
}

function getUser(){
if($this->integrate == "custom"){

// Edit This Place if you have your own script
}
if($this->integrate == "phpbb 2"){
// Edit This
$sid = $_COOKIE["phpbb2mysql_sid"];
// End Edit
$uid=0;
$res = $this->db->run_query("select * from ".$this->integrate_prefix."sessions where session_id='".$this->db->escape_string($sid)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$uid = $row["session_user_id"];
}
$this->db->free_result($res);
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->id_field."=".$uid);
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $row[$this->username_field];
$this->password = $row[$this->password_field];
}
$this->db->free_result($res);
}
if($this->integrate == "emeeting"){
$this->username = $_SESSION["username"];
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate == "joovili"){

}
if($this->integrate == "osdate"){
$this->username = $_SESSION["UserName"];
}
if($this->integrate == "PHP-Fusion"){
if($_COOKIE["fusion_user"] != ""){
$tmp = split("\.",$_COOKIE["fusion_user"]);
if(count($tmp)==2){
$this->username = $this->getUserById($tmp[0]);
$this->password = $tmp[1];
}
}
}
if($this->integrate == "PostNuke"){
$sid = $_COOKIE["POSTNUKESID"];
$uid=0;
$res = $this->db->run_query("select * from ".$this->integrate_prefix."session_info where pn_sessid='".$this->db->escape_string($sid)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$uid = $row["pn_uid"];
}
$this->db->free_result($res);
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->id_field."=".$uid);
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $row[$this->username_field];
$this->password = $row[$this->password_field];
}
$this->db->free_result($res);
}
if($this->integrate == "joomla 1"){
// Edit This
require($_SERVER['DOCUMENT_ROOT']."/configuration.php");
// End Edit
$sessionCookieName = md5( 'site'.$mosConfig_live_site);
$session_id = md5($_COOKIE[$sessionCookieName].$_SERVER['REMOTE_ADDR']);
$res = $this->db->run_query("select * from ".$this->integrate_prefix."session where session_id='".$this->db->escape_string($session_id)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $row["username"];
$this->password = $this->getPassByUser($this->username);
}
$this->db->free_result($res);
}
if($this->integrate == "joomla 1.5"){
// Edit This
require($_SERVER['DOCUMENT_ROOT']."/configuration.php");
// End Edit
$sessionCookieName = md5( 'site'.$mosConfig_live_site);
$session_id = $_COOKIE[$sessionCookieName];
$res = $this->db->run_query("select * from ".$this->integrate_prefix."session where session_id='".$this->db->escape_string($session_id)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $row["username"];
$this->password = $this->getPassByUser($this->username);
}
$this->db->free_result($res);

Some code are missing here something start like -> || $this->integrate =="dolphin7" inside the ()  of the first line below   And maybe set the seconde one

}        
if($this->integrate == "dolphin" || $this->integrate == "dolphin4"){
$this->username = $this->getUserById($_COOKIE["memberID"]);
}

 

if($this->integrate == "vbulletin"){
require($_SERVER['DOCUMENT_ROOT']."/includes/config.php");
$sid = $_COOKIE[$config['Misc']['cookieprefix']."sessionhash"];
$uid=0;
$res = $this->db->run_query("select * from ".$this->integrate_prefix."session where sessionhash='".$this->db->escape_string($sid)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $this->getUserById($row["userid"]);
$this->password = $this->getPassByUser($this->username);
}
$this->db->free_result($res);
}
if($this->integrate =="Softbiz Dating"){
$this->username = $_SESSION["sbdtng_username"];
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate =="PHPNuke"){
$info = split(":",base64_decode($_COOKIE["user"]));
$this->username = $info[1];
$this->password = $info[2];
}
if($this->integrate =="MyBB"){
$sid = $_COOKIE["sid"];
$res = $this->db->run_query("select * from ".$this->integrate_prefix."sessions where sid='".$this->db->escape_string($sid)."'");
$uid=0;
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$uid = $row["uid"];
}
$this->db->free_result($res);
$this->username = $this->getUserById($uid);
$this->password = $this->getPassByUser($this->username);        
}
if($this->integrate =="x-cart"){
$res = $this->db->run_query("select * from ".$this->integrate_prefix."sessions_data where sessid='".$this->db->escape_string($_COOKIE["xid"])."'");
$row = $this->db->fetch_assoc($res);
$val = unserialize($row["data"]);
$this->username = $val["username"];
$this->password = $this->getPassByUser($this->username);
$this->db->free_result($res);
}
if($this->integrate =="DZOIC Handshakes"){
$this->username = $this->getUserById($_COOKIE["mem_id"]);
}
if($this->integrate =="SMF (Simple Machines Forum)"){
// Edit here
$data = unserialize(stripslashes($_COOKIE["SMFCookie428"]));
$this->username = $this->getUserById($data[0]);
if(sha1($this->getPassByUser($this->username).$this->getFieldById($data[0],"passwordSalt")) == $data[1]){
$this->password = $this->getPassByUser($this->username);
}
}

if($this->integrate =="phpbb 3"){
// Edit This
$sid = $_COOKIE["phpbb3_ip7hu_sid"];
// End Edit
$uid=0;
$res = $this->db->run_query("select * from ".$this->integrate_prefix."sessions where session_id='".$this->db->escape_string($sid)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$uid = $row["session_user_id"];
}
$this->db->free_result($res);
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->id_field."=".$uid);
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$this->username = $row[$this->username_field];
$this->password = $row[$this->password_field];
}
$this->db->free_result($res);        
}
if($this->integrate =="phpfox"){
$userid = $_SESSION["Mod_Account"]["phpfox_id"];
if($userid != "" && is_numeric($userid)){
$this->username = $this->getUserById($userid);
$this->password = $this->getPassByUser($this->username);
}
}
if($this->integrate == "e-marvel"){
$this->username = $_SESSION["user"];
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate =="SocialEngine"){
// You might need to add in index.php session_id("your SE Session ID");
/*
example code to add in index.php before session_start():
session_id($_COOKIE["d21058bd083ea3deb73808280d60a23e"]);
*/
if(isset($_COOKIE["user_id"])){
$userid = $_COOKIE["user_id"];
if($userid != "" && is_numeric($userid)){
$this->username = $this->getUserById($userid);
$this->password = $_COOKIE["user_pass"];
if($this->password == ""){
$this->password = $_COOKIE["se_user_pass"];
}
}    
}else{
$userid = $_SESSION["__default"]["user_id"];
if($userid != "" && is_numeric($userid)){
$this->username = $this->getUserById($userid);
$this->password = $this->getPassByUser($this->username);
}
}

}
if($this->integrate == "e107"){

list($uid, $upw)=(isset($_COOKIE['e107cookie']) && $_COOKIE['e107cookie'] ? explode(".", $_COOKIE['e107cookie']) : explode(".", $_SESSION['e107cookie']));
if (!empty($uid) && !empty($upw) && is_numeric($uid) && ($uid)>0 && $uid!="") {
$this->username = $this->getUserById($uid);
if(md5($this->getPassByUser($this->username)) == $upw){
$this->password = $this->getPassByUser($this->username);
}
}
}
if($this->integrate =="moodle"){
session_destroy();
// Change this if auto login doesnt work
session_save_path ("../sessions");
// End change
session_id($_COOKIE["MoodleSession"]);
session_start();
$this->username = $_SESSION["USER"]->username;
$this->password = $_SESSION["USER"]->password;            
}    
if($this->integrate == "AbleDating"){
// Change this if required
$session_prefix = ".".$_SERVER["SERVER_NAME"];
// End change
$this->username = $this->getUserById($_SESSION[$session_prefix."_user_id"]);
$this->password = $this->getPassByUser($this->username);        
}
if($this->integrate == "vldPersonals"){
$this->username = $_SESSION["username"];
$this->password = $this->getPassByUser($this->username);
}        
if($this->integrate == "SocialMedia"){
$this->username = $_COOKIE["username"];
$this->password = $_COOKIE["password"];
}
if($this->integrate == "SkaDate"){
if(isset($_SESSION["profile_id"])){
$this->username = $this->getUserById($_SESSION["profile_id"]);
}else{
$this->username = $this->getUserById($_SESSION["%http_user%"]["profile_id"]);
}
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate == "clip-share"){
/*
if you enable this option, you may need to add these lines in your index.php before session_start(); line.
ini_set('session.name', 'Your Session Name');
ini_set('session.save_path', dirname(dirname(__FILE__)). '/tmp/sessions');
*/
$this->username = $_SESSION["USERNAME"];
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate == "datingpro"){
$this->username = $_COOKIE["dp_login"];
$this->password = $_COOKIE["dp_pass"];
}
}
function getPass(){
if($this->integrate == "joovili"){
//$this->password =  $this->getPassByUser($this->username);
}
if($this->integrate == "osdate"){
$this->password = $this->getPassByUser($this->username);
}
if($this->integrate == "dolphin"){
$this->password = $_COOKIE["memberPassword"];
}
if($this->integrate == "dolphin4"){
if(crypt($this->getPassByUser($this->username),'secret_string')==$_COOKIE["memberPassword"]){
$this->password = $this->getPassByUser($this->username);
}

And  code for DOLPHIN7 here to after those two one

}        
if($this->integrate =="DZOIC Handshakes"){
$this->password = $_COOKIE["password"];
}

}

function getUserById($id){
if($id == ""){
return "";
}
$username = "";
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->id_field."=".$this->db->escape_string($id));
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$username = $row[$this->username_field];
}
$this->db->free_result($res);
return $username;
}
function getPassByUser($username){
if($username == ""){
return "";
}
$pass = "";
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->username_field."='".$this->db->escape_string($username)."'");
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$pass = $row[$this->password_field];
}
$this->db->free_result($res);
return $pass;
}
function getFieldById($id,$field){
if($id == ""){
return "";
}
$value = "";
$res = $this->db->run_query("select * from ".$this->members_table." where ".$this->id_field."=".$this->db->escape_string($id));
if($this->db->get_num_rows($res)>0){
$row = $this->db->fetch_assoc($res);
$value = $row[$field];
}
$this->db->free_result($res);
return $value;    
}
}



?>

Quote · 2 Mar 2011

danro,

you most likely need to post this one on the jobs market, and see if you can get you a developer to get this done for you. try YobiLab and see what he can do with this. this is a third party customization you are inquiring about here in the dolphins forums, i doubt you are going to get the assistance that would benefit you from here.

 

wish i could help, but i dont mess with unknown modules, and being that this is something you are trying to hack off yourself, i would be leary of it.

When a GIG is not enough --> Terabyte Dolphin Technical Support - Server Management and Support
Quote · 2 Mar 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.