I've created a php, MySql application about daily staff attendance report which is running on local linux server. I would like to keep my database online so that anyone can access the report remotely outside the office. but the data feeding must be in the local server.Can anybody give me an idea to implement this ? I'm not looking for database replication solution. I need to keep the Data feeding application Local and Database Online.
1 Answer
Add this at the beginning of your data feeding scripts:
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
{
die('Remote access for this section is forbidden...');
}
This code was extracted from the development controller file provided by the Symfony framework
You can play with the array in the if condition to allow access only from certain IP addresses.
Hope to be helpful! Good luck! =)