vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   use the config? (https://vborg.vbsupport.ru/showthread.php?t=123805)

frandy 08-12-2006 10:58 PM

use the config?
 
Right so im making my own script, and its going to be located out with the "forum" directory etc so my page will be index and im wanting to use the config file thats found in the /forum/includes/config.php but see...theres one slight problem...how to I make a connection to the database with that config file?

Ive never worked with one such like that, its always been like

$usern = usern;
$pass = pass;

where as vbulletin is like:

$config['masterdb']['username'] =

and so on...if someone can explain how I would connect using this (as I do not wish to make my own config file either)

Cheers

Anyone? I need this for a project :-(

AN-net 08-16-2006 02:57 PM

if i am understanding correctly, it will be out of the forum directory?

if so use this:
PHP Code:

chdir(fullpathtoforums); 

now your full path to your forums maybe something like this:
/home/frandy/public_html/forums/

if you are not sure, make a new php file executing this:
PHP Code:

echo "My path info is:" getcwd(); 

upload that file to your forum directory and run it, this will echo your file path of your forum directory.

copy that and place it in the chdir() function. then for easy access to vb variables and the database vbulletin uses just require_once() global.php, like so:
PHP Code:

chdir(fullpathtoforums);
require_once(
'./global.php'); 

then if you need access files in the same directory as your new script
simply run this:
PHP Code:

chdir(getcwd()); 

and then include files from your current directory.

more info on chdir() and getcwd():


All times are GMT. The time now is 02:20 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00935 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete