PEAK XOOPS - autologin and chat program : fatal error in englishin japanese

autologin and chat program : fatal error

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2006/3/10 0:26
Svaha  企霹始   Posts: 4
Hi GIJoe, I use your autologin hack on xoops 2.2.4 and it's great.
However, I installed a seperate chatprogram (x7chat) and link from my xoops site to that chatprogram.
The chatprogram uses the xoopsdatabase and session to retrieve user name and password.

This is done through a xoops auth file

[code<?PHP
///////////////////////////////////////////////////////////////
//
// X7 Chat Version 2.0.0
// Released July 27, 2005
// Copyright (c) 2004-2005 By the X7 Group
// Website: http://www.x7chat.com
//
// This program is free software. You may
// modify and/or redistribute it under the
// terms of the included license as written
// and published by the X7 Group.
//
// By using this software you agree to the
// terms and conditions set forth in the
// enclosed file "license.txt". If you did
// not recieve the file "license.txt" please
// visit our website and obtain an official
// copy of X7 Chat.
//
// Removing this copyright and/or any other
// X7 Group or X7 Chat copyright from any
// of the files included in this distribution
// is forbidden and doing so will terminate
// your right to use this software.
//
////////////////////////////////////////////////////////////////EOH
?><?PHP
// For xoops 2.2.4

// This file holds data on authentication
$auth_ucookie = "X7C2U";
$auth_pcookie = "X7C2P";
$auth_register_link = "../register.php";
$auth_disable_guest = true;

// Get the Xoops config file
$xoopsOption['nocommon'] = 1;
require("../mainfile.php");

// Make a database connection to the Xoops database
$xoopsdb = new x7chat_db(XOOPS_DB_HOST,XOOPS_DB_USER,XOOPS_DB_PASS,XOOPS_DB_NAME);
$table_prefix = XOOPS_DB_PREFIX."_";

if(isset($_COOKIE["PHPSESSID"])){
$cvalue = $_COOKIE["PHPSESSID"];
$q = $xoopsdb->DoQuery("SELECT sess_data FROM {$table_prefix}session WHERE sess_id='$cvalue'");

$cinfo = $xoopsdb->Do_Fetch_Row($q);
if($cinfo[0] != ""){
// Get user ID
eregi("^xoopsUserId|[^;]*",$cinfo[0],$match);
$match[0] = eregi_replace("xoopsUserID\|","",$match[0]);
$suid = unserialize($match[0]);

// changed uname to loginname
$q = $xoopsdb->DoQuery("SELECT loginname,pass FROM {$table_prefix}users WHERE uid='$suid'");
$xoopsname = $xoopsdb->Do_Fetch_Row($q);
$_COOKIE['X7C2U'] = $xoopsname[0];
$_COOKIE['X7C2P'] = $xoopsname[1];
}
}

function auth_encrypt($data){
return md5($data);
}

function auth_getpass($auth_ucookie){
GLOBAL $xoopsdb,$table_prefix,$txt,$db,$g_default_settings,$prefix,$x7c;

// Changed uname in loginname
$query = $xoopsdb->DoQuery("SELECT pass FROM {$table_prefix}users WHERE loginname='$_COOKIE[$auth_ucookie]'");
$password = $xoopsdb->Do_Fetch_Row($query);
// Check if they have an X7 Chat account
if($password[0] != ""){
$query = $db->DoQuery("SELECT * FROM {$prefix}users WHERE username='$_COOKIE[$auth_ucookie]'");
$row = $db->Do_Fetch_Row($query);
if($row[0] == ""){
// Create an X7 Chat account for them.
$time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$db->DoQuery("INSERT INTO {$prefix}users (id,username,password,status,user_group,time,settings,hideemail,ip) VALUES('0','$_COOKIE[$auth_ucookie]','$password[0]','$txt[150]','{$x7c->settings['usergroup_default']}','$time','{$g_default_settings}','0','$ip')");
}
}
return $password[0];
}

function change_pass($user,$newpass){
// GLOBAL $table_prefix,$xoopsdb;
// $newpass = auth_encrypt($newpass);
// changed uname in loginname
// $query = $xoopsdb->DoQuery("UPDATE {$table_prefix}users SET pass='$newpass' WHERE loginname='$user'");
}

?>
[/code]
I changed the uname for loginname (because of xoops 2.2.4

Registered users can now enter the chat and are recognised by the chat program. When an 'autologin' user tries to enter the chat, there is a fatal error :

Quote:
Fatal error: Undefined class name 'mytextsanitizer'
in /www/web/include/autologin_main.php on line 442

could you help me with this?
Thank you
Votes:2 Average:10.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/3/10 4:50
GIJOE  黎扦烦菱   Posts: 4110
Though I don't read the code, you can try to fix this error.

Quote:
Fatal error: Undefined class name 'mytextsanitizer'
in /www/web/include/autologin_main.php on line 442

Insert a line before line 442.

include_once XOOPS_ROOT_PATH.'/class/module.textsanitizer.php' ;
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/3/10 9:34
Svaha  企霹始   Posts: 4
Thank you for your quick reply, I did what you wrote and got a little further now, but still ended up in 'fatal error' :

Quote:
Notice: Undefined index: xoopsRequestUri
in /web/include/autologin_main.php on
line 457

Notice: Undefined variable: xoopsConfig
in /web/include/autologin_main.php on
line 503

Warning: main(/web/language//user.php):
failed to open stream: No such file or
directory in
/web/i
nclude/autologin_main.php on line 503

Warning: main(): Failed opening
'/web/language//user.php' for inclusion
(include_path='.:/php/includes:/usr/shar
e/php') in
/web/i
nclude/autologin_main.php on line 503

Fatal error: Call to undefined function:
xoops_gethandler() in
/web/include/autologin_main.php on line
510

Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/3/11 5:00
GIJOE  黎扦烦菱   Posts: 4110
It looks bad position with insert into mainfile.php

good:
	if (!isset($xoopsOption['nocommon']) && XOOPS_ROOT_PATH != '') {
		require XOOPS_ROOT_PATH."/include/common.php";
		require XOOPS_ROOT_PATH."/include/autologin.php";
	}

bad:
	if (!isset($xoopsOption['nocommon']) && XOOPS_ROOT_PATH != '') {
		require XOOPS_ROOT_PATH."/include/common.php";
	}
	require XOOPS_ROOT_PATH."/include/autologin.php";

Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2006/3/11 8:40
Svaha  企霹始   Posts: 4
Yes, that did it, I'm very happy now, thank you GIJOE
Votes:14 Average:5.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!