when i add the line:
include( XOOPS_ROOT_PATH . '/modules/protector/include/postcheck.inc.php' ) ;
in mainfile.php
i have this error in any attempt for posting:
db connection failed.
xoops 2.2.4
mysql 4.0.25
php 4.3.11
hi irmtfan.
Quote:
when i add the line:
include( XOOPS_ROOT_PATH . '/modules/protector/include/postcheck.inc.php' ) ;
in mainfile.php
i have this error in any attempt for posting:
db connection failed.
Check the position.
include( XOOPS_ROOT_PATH . '/modules/protector/include/precheck.inc.php' ) ;
if (!isset($xoopsOption['nocommon'])) {
include XOOPS_ROOT_PATH."/include/common.php";
}
include( XOOPS_ROOT_PATH . '/modules/protector/include/postcheck.inc.php' ) ;
It is necessary to add lines both postcheck and precheck.
from my mainfile.php:
define('XOOPS_GROUP_ADMIN', '1');
define('XOOPS_GROUP_USERS', '2');
define('XOOPS_GROUP_ANONYMOUS', '3');
include( XOOPS_ROOT_PATH . '/modules/protector/include/precheck.inc.php' );
if (!isset($xoopsOption['nocommon'])) {
include XOOPS_ROOT_PATH."/include/common.php";
include XOOPS_ROOT_PATH."/include/autologin.php";
}
include( XOOPS_ROOT_PATH . '/modules/protector/include/postcheck.inc.php' );
It looks no problem.
+precheck
+postcheck
you say "DB connection failed"
+precheck
-postcheck
Is it OK?
Anyway try to turn XOOPS_DB_PCONNECT on/off.
define('XOOPS_DB_PCONNECT', 0);
yes with remove postcheck line thats ok.
Quote:
Anyway try to turn XOOPS_DB_PCONNECT on/off.
define('XOOPS_DB_PCONNECT', 0);
where is this constant?
set it to ON or OFF?
hi irmtfan.
Quote:
yes with remove postcheck line thats ok.
It sounds odd again
Try this hack.
modules/protector/include/postcheck.inc.php
function protector_postcommon()
{
global $xoopsUser , $xoopsDB , $xoopsModule ;
// Protector class
require_once( XOOPS_ROOT_PATH . '/modules/protector/class/protector.php' ) ;
$db =& Database::getInstance() ;
$protector =& Protector::getInstance( $db->conn ) ;
$protector =& Protector::getInstance( $xoopsDB->conn ) ;
$conf = $protector->getConf() ;
Quote:
Quote:Anyway try to turn XOOPS_DB_PCONNECT on/off.
define('XOOPS_DB_PCONNECT', 0);
where is this constant?
set it to ON or OFF?
0 or 1.
If you run it with 0, try to change it into 1.
WOW... excellent hack... GIjoe you are rock...works fine now.
do you want to impeliment this hack for the next versions?
and i still cant find the constant:
define('XOOPS_DB_PCONNECT', 0);
where is this?
also a question:
how can i change/translate the "db connection failed" note?
it seems this text shows when the mysql server down.
hi irmtfan.
Quote:
It sounds good!
Perhaps, your $GLOBALS['xoopsDB'] is broken by some reasons.
Quote:
do you want to impeliment this hack for the next versions?
I've already modified my repository of Protector SVN.
Quote:
and i still cant find the constant:
define('XOOPS_DB_PCONNECT', 0);
where is this?
in mainfile.php.
Quote:
also a question:
how can i change/translate the "db connection failed" note?
it seems this text shows when the mysql server down.
Certainly, the messages should be modified into language constants.
I'll fix it.
If you want to modify by yourself, edit class/protector.php
>>Perhaps, your $GLOBALS['xoopsDB'] is broken by some reasons.
what this meant? what is your guess about the reason and is this dangerous?
another question:
i see the metioned line in my mainfile.php:
define('XOOPS_DB_PCONNECT', 0);
now that my problem solved by useing the hack, is this necessary to change it to "1" or not?
Quote:
irmtfan wrote:
>>Perhaps, your $GLOBALS['xoopsDB'] is broken by some reasons.
what this meant? what is your guess about the reason and is this dangerous?
I can't judge at all.
There are too many reasons - modules, core versions, hacks... -
Perhaps it is troublesome instead of dangerous.
Quote:
another question:
i see the metioned line in my mainfile.php:
define('XOOPS_DB_PCONNECT', 0);
now that my problem solved by useing the hack, is this necessary to change it to "1" or not?
You need not.
This is just a method for finding the causes.
The reason why I have to write the parameter of die() in english is "the codes is placed before common.php".
Protector can't know $xoopsConfig['language'] .
If you look the message of 'db connection failed.' frequently, you'd better change the hosting service
.