On other note is about security. Note that you are placing a file that contain 
sensitive password
information under your website's hosted root directory. This is general 
considered a bad idea. If
you have access to the directory above or outside your root then please 
consider moving this file
there. 

What I generally do is keep the db_config.php file in an includes folder 
relative to my root.
Something like 

/includes/db_config.php

The normal include command would work the same. But instead of actually placing 
my config
information in this file it actually just contains an include statement with a 
hard-coded path to
the real include file outside the root.

Hope you follow.

P-


--- Kishore Balla <[EMAIL PROTECTED]> wrote:

> thanx Paul and Tim... It worked.. :)
> 
> On 10/11/05, Paul Menard <[EMAIL PROTECTED]> wrote:
> >
> > For 'include' you do not use the URL. Instead use the physical server
> > path. Something like
> >
> > include $_SERVER['DOCUMENT_ROOT'] . "/connect.php";
> >
> > P-
> >
> >
> >
> > --- Kishore Balla <[EMAIL PROTECTED]> wrote:
> >
> > > Hi all,
> > >
> > > I'm facing a problem with including the database config file..
> > >
> > > I kept database variables in a config file like this..
> > >
> > > connect.php
> > >
> > > <?php
> > >
> > > $dbhost='something';
> > > $dbuser='something';
> > > $dbpass='something';
> > > $dbname='something';
> > > ?>
> > >
> > > then in my home.php file I've included that file ( both connect.php and
> > > home.php are in same folder );
> > >
> > > <?php
> > >
> > > include 'connect.php';
> > >
> > > $db=mysql_connect($dbhost,$dbuser,$dbpass);
> > > mysql_select_db($dbname,$db);
> > >
> > > //some actions
> > >
> > > ?>
> > >
> > > The above thing worked fine until I moved the config file to root
> > > directoryso that It will be available to all scripts..
> > >
> > > the changes I've made to the script.. home.php
> > >
> > > <?php
> > >
> > > include 'http://domain.com/connect.php';
> > >
> > > $db=mysql_connect($dbhost,$dbuser,$dbpass);
> > > mysql_select_db($dbname,$db);
> > >
> > > //some actions
> > >
> > > ?>
> > >
> > > the above code this throwing errors.. what could the problem...
> > >
> > > thanx in advance...
> > >
> > > --
> > > KISHORE
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > >
> >
> >
> >
> >
> > Community email addresses:
> > Post message: [email protected]
> > Subscribe: [EMAIL PROTECTED]
> > Unsubscribe: [EMAIL PROTECTED]
> > List owner: [EMAIL PROTECTED]
> >
> > Shortcut URL to this page:
> > http://groups.yahoo.com/group/php-list
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> KISHORE
> 
> 
> [Non-text portions of this message have been removed]
> 
> 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to