On Tue, 10 Dec 2002, Stefan Hoelzner wrote:

> Hi folks,
> surely this question has already been answered many times before in
> this ng, but nevertheless: I want to pass variables from one .php to
> another .php script. But I do not want to use either the
> http://localhost/target.php?var1=test&var2=test2 nor the POST method.
> I would like to pass over general variables like usernames and
> passwords for several MySQL-connects;  obviously it is not a good way
> to pass these vars via the mentioned ways.
> What else does PHP offer? Are there any other methods? Can I define
> these vars as some kind of "global variables" in any ini-file?

Use includes.  http://www.php.net/include

  $host = 'localhost';
  $user = 'foo';
  $pass = 'bar';

  include 'dbinfo.inc';

  if (!$conn = mysql_connect($host, $user, $pass)) {

Ideally this include will be outside the document root.  If 
not, make sure it's not viewable or use a php extension such 
as .php  See also the include_path php directive.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to