Check out the Latest Articles:

fuseEver done you web development work and didn’t get paid for it ? Did you client response for withholding you payment was “the work not up to what we expected” ?

You dont need to worry now,  because why not control the application  it from your webserver and turn it on or off based on the client’s account standing. The credits for this excellend idea goes to Bill D’Alessandro who blogs at BillDA

Lets see how we accomplish this with s small PHP snippet or a function. The concept of this simple idea is that when the application is initialized it check on your server via XML and based on the client’s standing run the application or stop it.

We are using XML-RPC (remote procedure call) and a small PHP code to accomplish this. Lets see the breakdown

Part One: We will be creating an virtual RPC Server on your end. Just create a new php file and put this code in. Your server should be a fast reliable host so that you don’t want to slow down the remote application. We have made the script run if there is no response from your server just in case your server downtime doesn’t cause downtime at the remote application. You also need the file xml-rpc.php to run this script. Just download it put it in the same directory to ensure the script to work. (rename xml-rpc.phps to xml-rpc.php

require('XMLRPC.inc.php');
function checkapp($the_app)
{
$deactivateMe = ""; // to disable a webapp, enter it's short code here
if (isset($the_app) && $the_app == $deactivateMe)
return true; // Application Disabled
else
return false; // All systems go
}
$server = new IXR_Server(array('activation.checkapp' => 'checkapp'));

Part Two: Now we need to make our application in such way that it checks the server each time for the response before initializing to make sure the application is whitelisted to run.  Now add this code to the client’s application, preferably where the application starts. One again you need to download the xml-rpc.php and put it in the same directory as of the file.

require('XMLRPC.inc.php');
$appname = "UNIQUE_APP_SHORTCODE";
$client = new IXR_Client('http://path_to_file_created_earlier.php');
if (!$client->query('activation.checkapp', $appname)) {
if($client->getResponse() )
{
die("Application Disabled. Please pay your web developer.");
}
}

We’re Done! Now each time your client ever doesn’t pay you, and you want to shutdown the site you developed for them, just set $deactivateMe in Part One to the “UNIQUE_APP_SHORTCODE” you entered in the code in Part 2.

This code is limitated one remote site at a time. But if you’be the concept of using arrays in PHP you can simply expand it  to allow you to disable multiple sites at once

Related posts:

  1. How to Measure an Application's Startup Time with AppTimer
  2. MS DOS Tutorials – How to Create, Delete, Change, Rename Directory and Files


  1. It‘s quite in here! Why not leave a response?