https://github.com/AndrewChamp/website-killswitch
1) In the clients server, create a killswitch class: killswitch.php
<?php
class killswitch{
// Update 'killswitch.php' w/ the URL of where your 'killswitch.xml' file will reside
// for example: http://juancadima.com/killswitch.xml
public $info;
private $domain;
private $xml = 'http://domain.com/killswitch.xml';
public function __construct($_domain=null){
if($_domain != null):
$this->domain = $_domain;
$this->loadFile();
endif;
}
public function loadFile(){
try{
$xml = simplexml_load_file($this->xml);
$this->info = $xml->{$this->domain};
} catch(Exception $e){
print $e->getMessage();
}
}
}
?>
2) This goes in our server: killswitch.xml
status: true -- site will load fine
status: false -- client is gonna get a message
<?xml version="1.0" encoding="UTF-8"?>
<domains>
<site1.com>
<status>true</status>
<message>Please contact me immediately.</message>
</site1.com>
<!-- Add more sites by adding them to your killswitch.xml file -->
<another-site.com>
<status>false</status>
<message>Please contact me immediately.</message>
</another-site.com>
</domains>
============= Add this at the top of your client's index file ==========
<?php
require_once "killswitch.php"; // from step (1)
$check = new killswitch($_SERVER['HTTP_HOST']);
if($check->info->status == 'false')
exit($check->info->message);
// ... rest of the app continues if status was true