1
mouacy
passing database information to another config file??
  • 2005/2/18 7:08

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


I am working on a Sprint Tool as module for use with XOOPS. The tool has a config file with the following information:

$GLOBALS['Database User'] = 'username';
$GLOBALS['Database Password'] = 'password';
$GLOBALS['Database Database'] = 'dbname';
$GLOBALS['URL Base'] = 'module_url';
$GLOBALS['Phone Data URL'] = 'phonedata_url';
$GLOBALS['Admin Email'] = 'admin@domainname.com';

I want to do something like this:

$GLOBALS['Database User'] = XOOPS_DB_USER;
$GLOBALS['Database Password'] = XOOPS_DB_PASS;
$GLOBALS['Database Database'] = XOOPS_DB_NAME;

But that doesn't work. Is there another way?

2
karuna
Re: passing database information to another config file??
  • 2005/2/18 7:38

  • karuna

  • Not too shy to talk

  • Posts: 171

  • Since: 2002/5/29


hi u should include "../../mainfile.php"

3
mouacy
Re: passing database information to another config file??
  • 2005/2/18 7:44

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


I added the

include '../../mainfile.php';

to the top of the config.php file too... but that didn't work either.

There's got to be away to assign the username, passwors, and databasename from the mainfile.php to another config file...

4
Dave_L
Re: passing database information to another config file??
  • 2005/2/18 9:25

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You may not be using the right path to mainfile.php. '../../mainfile.php' will only work if your config.php is two levels down from mainfile.php. Try:

error_reporting(E_ALL);#*#DEBUG#

$xoopsOption['nocommon'] = 1// don't include common.php
require_once '/absolute/path/to/xoops/dir/mainfile.php';

if (
defined(XOOPS_MAINFILE_INCLUDED)) { #*#DEBUG#
   
echo 'it worked';
} else {
   echo 
'it did not work';
}


where /absolute/path/to/xoops/dir is the same as the value of XOOPS_ROOT_PATH defined in mainfile.php.

5
mouacy
Re: passing database information to another config file??
  • 2005/2/18 9:45

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Thanks... I figure it out.

I did this and it work:

include("../../mainfile.php");

No explanation, but it works

Login

Who's Online

143 user(s) are online (95 user(s) are browsing Support Forums)


Members: 0


Guests: 143


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits