Re: Remote MySQL connection via PHP file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cajbecu wrote:
i suggest you:

database.conf (the file on another server)

host=localhost
user=test
pass=test
anothervar=anothervalue

have you thought of the security implications of this, a text file with user names/passwords, thats rather insecure I would say,



on your script:

$temp = file(http://....../database.conf);
foreach($temp as $val) {
$temp2 = explode("=",$val);
$$temp2[0] = $temp[1];
}

after that, you`ll have:

$host = 'localhost'
$user = 'test'
$pass = 'test'
$anothervar ='anothervalue';

mysql_connect($host,$user,$pass);

(bla bla)

hope this help;

On 12/1/06, Scott <svinkle@xxxxxxxxx> wrote:
Hi all,

I've been searching around for a while, but cannot find a solution. For
a project of mine, I need to keep the connection information to a MySQL
server database on another server.

Example remote file:

<?php
$user = "joe";
$pass = "1234";
?>

Example local file:

<?php
include "http://www.remoteserver.com/remote_file.php";;
// Use variables $user and $pass somehow...
?>

I've tried including the file which has the username/pass, etc
information via HTTP, but this doesn't seem to work. I assume because it
returns what a web browser would return if this file was loaded into
one, a blank screen.

I've tried using the return statement in the file which houses the
information, but this seems to return a boolean value (1 or 0)... not
sure what's up with that.

Any help with this would be most appreciated.

Thank you.

Scott

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




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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux