Re: [PHP] security include from remote server



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
.



Relevant Pages

  • Challenging ADO.NET situation (long)
    ... need to import those records into the local database. ... depending on a "type" column in the master (ie some records ... independantly, but data is always transfered from remote to local, not the ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Challenging ADO.NET situation (long)
    ... need to import those records into the local database. ... depending on a "type" column in the master (ie some records ... independantly, but data is always transfered from remote to local, not the ...
    (microsoft.public.dotnet.framework.adonet)
  • A Way Forward?
    ... Lets say that the remote databases have an autonumber for the local computer ... reference ID in the Procurement and Purchase Order table AND another column ... but this database design seems to be a very complex problem. ... Setting incremental numbering based on Australian FY set ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Please help with remote access to FM Pro Server 7
    ... But if it is to access a database from a remote location, ... - both local and remote computers are simply connected to internet. ... on the local network. ...
    (comp.databases.filemaker)
  • Re: Help on performance question
    ... from the remote DB in a second dataset. ... database and cannot change any structure. ... I have been told that retriveind requested data in an SQL querry is faster ...
    (microsoft.public.dotnet.framework.adonet)