When developing a product (website, Blog, Facebook App) online, if you have not been able to build an infrastructure development / operations, it may be necessary under certain circumstances put "off-line" service, upgrades, debugging or interventions maintenance. WordPress, for example, can be turned off using simple and convenient Plugin, as Maintenance Mode . In all other cases, let me show you how to allow access to a system, only to yourself or a number of persons who are authorized by simply checking the IP address. What you need is PHP and be able to place the lines of code at the highest point of the system, ie, in that part of the code (or pages) that is called normally always first; type the header of a site to be clear:
1 2 3 4 5 6 7 8 9 10 | / / I build a list of authorized IP address array ( "87.6.45.33" , "234.34.34.2" ) ; // etc... $ AllowIP = array ("87.6.45.33", "234.34.34.2"); / / etc ... / / If the IP is not among those allowed ! in_array ( $_SERVER [ 'REMOTE_ADDR' ] , $allowIP ) { if ( in_array ($ _SERVER ['REMOTE_ADDR'], $ allowIP) { / / Include maintenance mode ; die (); } / / Continue the normal display |










There are no comments for this post
Leave a comment