Re: security include from remote server

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

 



Brad Fuller wrote:
Miguel -

If my solution is not viable, is there any other way of hosting my files someplace else, but still access the local database?

Yes.  Your remotely hosted code would call the database on your local
server.  Something like:

<? $link = mysql_connect("foo.com", "bar", "PASSWORD"); ?>

You would also need to allow the connection from the remote host in mysql.

mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';
If you don't want to expose your database directly to the internet, you could have a PHP intermediary service - your local code could be limited to one PHP script that would enforce HTTP authentication (over https to maintain security), and could forward SQL queries and responses from the database. Your remote code could call the local intermediary service.

I personally don't understand why you'd need to store code remotely but execute it locally, unless you're concerned about the office "stealing" your code, or using it without permission...If you aren't concerned about code theft, there are lots of ways you could store code remotely, e.g. a very raw/simple/uncomplicated/ugly:

$src = file_get_contents('http://server/code.php.txt');
file_put_contents('/tmp/code.php',$src);
include('/tmp/code.php');
unlink('/tmp/code.php');

But there are at least a few reasons why I wouldn't recommend doing that...

jon

--
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