[TYPO3-dev] include_once(PATH_site .'typo3conf/localconf.php');
Oliver Hader
oh at inpublica.de
Wed Nov 29 09:55:04 CET 2006
Hi Tapio,
Tapio Markula wrote:
> Hi
>
> I needed special SQL- commands
> I tried to get database name, username and password
> using
> include_once(PATH_site .'typo3conf/localconf.php');
> and
> file_get_contents(PATH_site .'typo3conf/localconf.php');
>
> but
> $typo_db_username
> ....
>
> didn't worked from included file, why?
> I must made for a customer project-related hack
> and put those directly,
> which is really bad (and I can newer publish
> public this kind of hack).
> Is there some api method to get
> those issues in order to make own SQL-statements
> for core files using XCLASSing..
Are these special commands so special, that the TYPO3_DB object could
not handle this problem? ;) For security reasons, I'd suggest to have
the parameters checked before pushing them to the DBMS.
According to your problem:
Have you tried $GLOBAL['typo_db_username']? Since the
$GLOBAL['TYPO3_DB'] objects exists, the localconf.php must have been
loaded before.
$GLOBALS['TYPO3_DB'] has a 'link' variable: $GLOBALS['TYPO3_DB']->link
You can use this for your special commands like this:
$res = mysql_query($yourQueryString, $GLOBALS['TYPO3_DB']->link);
olly
--
Oliver Hader
http://inpublica.de/
More information about the TYPO3-dev
mailing list