Intranet and Internet MySQL Access



Hi guys,

I would like to know if an idea is possible before I suggest it as a possible development route to a small business I am working for part time.

The small group is going to have a new intranet system designed (not internet based as they deal with sensitive data), but would also like a database online for team members who operate from home to use. This is fine, as the two systems are essentially separate, however, ideally the information added online could be accessed from the intranet system, checked, and if approved transferred straight to the main system with a click - without messing with phpmyadmin and sql (they are end users).

I know a little about php and am comfortable developing websites online, or in a virtual environment (XAMP) for my personal testing, but have never tried this sort of thing and would like to advise them on what is possible. So what I would like to know is what sort of set up would be needed to:

a) Run an intranet based system, i.e. accessable by many computers (I'm assuming just apache configured correctly)

b) Access the online database from within the intranet system and move it from the local one, i.e. treat both as local mySQL databases (SSH?).

Any advice is appreciated,

well..everything is possible and, it is pretty much what im planning on doing very soon.

the intranet system may be on a server that is not accessible from the internet (local server) or on the server that is accessible from the internet but with a restriction to those IP addresses that are allowed.

there are actually many different ways of doing it and it is possible to combine them as well..the whole system may, in fact use one and the same database and server: just different user permisions and a bit of logic :)
Many thanks for the quick response.

So assuming I wanted to stick to plan:

a) Run an intranet based system, i.e. accessible by many LAN computers built in PHP using mySQL database

b) Access the internet database from within the intranet system and move it from their to the local one, i.e. treat both as local mySQL databases

What is the best method to undertake this?

The reason they do not want the whole system online is security (data protection), and I know they wont move on this (I would have stuck the whole thing online), however, they definately do want a small online part to the system. Is it possible to make just certain databases accessible to the net in mySQL? or configure apache to have a local part and internet part and host the whole thing on their own server?

I dont want to recommend anything that relies on IP's at all, as the team is distributed is due to travel and may use many different computers.

My personal interest is definately peaked, as it is a topic I had never considered, but I can now think of uses for it, not least testing offline code with the online database.... sick of uploading changes after updates.... and it is probably time i put my home lan to good use....

If you could clarify the best route for this development I would appreciate it, ideally the small part of the intranet system would just contain two sets of db connects:

$db1 = mysql_connect("onlinehostname", "username", "pass");
mysql_select_db("databasename", $db1);

$db2 = mysql_connect("offlinehostname", "username", "pass");
mysql_select_db("databasename", $db2);

but I'm guessing this is impossible.... is there a way to accomplish something similar?

Thanks in advance.
You can configure permissions in mysql so as to allow certain operations to some users and to deny them to others, but i guess you already know that.

If you want only certain information to be accesible via the internet, you could use two different databases (in two different servers). The sensitive information would be in a server only visible to the LAN and the rest of the information in a server visible from the outside. In this way, there is no redundancy (information is only stored in one place) while maintaining separation between sensitive information and the rest. The web servers should also be different (so we are talking about a minimum of two servers in case the apache and the mysql db are in the same server).