ACTIONSCRIPT STRAIGHT FROM OUR FACTORY FLOOR TO YOUR MONITOR OF CHOICE
SUGAR PILL FACTORY IMAGE

January 29th, 2010-Friday
SUGAR PILL FACTORY IMAGE

How I Make Sure I Get Paid


SUGAR PILL FACTORY IMAGE

SUGAR PILL FACTORY IMAGE

If you’re a freelancer like me, jobs come in on the fly. One week I’m destitute and the next I can’t find a free second in my day to let my dog outside. Personally, I prefer this lifestyle, I like to think of it as hunter/gatherer like. That along with my beard and unkempt hair and I’m a regular natuarlite!

Anyway, being that it’s just me vs. the client in the “fork over the money” department, I often find myself waiting on payments for an inexplicably long time, which makes my bank account unhappy, which makes my bill collectors unhappy, which makes me unhappy, which makes my girlfriend unhappy etc… SO, to remedy, I’ve decided to implement doomsday clocks on all of my clients websites.

In the header of index.php file on my clients site I include my little script:


require_once 'goodClientCheck.php';

—goodClientCheck.php —

<?php
if(isset($_GET['callOff'])){
$handle = fopen('goodClientCheck.php', 'w');
fwrite($handle, '<?php $overDue = 0; echo "The Client Came Clean"; ?>');
$overDue = 1;
echo "The Client Came Clean";
}else{
date_default_timezone_set('utc');
$exp_date = "2010-01-27"; // this is your expiration date.
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);
if ($expiration_date > $today) {
$overDue = 0;
} else {
$overDue = 1;
}
?>
<script type="text/javascript">
checkDate();
function checkDate()
{
<?php if(!$overDue){
echo "alert('You Are A Good Client');";
}else{
echo "window.location = 'countDown.html';";
}?>
}
</script>
<?php } ?>

This script checks today’s date against my target “warning” date. If the warning date has passed I set a variable called $overDue to true. If $overDue is true, I insert in the head a little bit of javascript that will direct the user to my “countDown.html” page that contains a count down and a button for the option to pay…


<script type="text/javascript"?>
function doPayFunction()
{
alert("bout time you came clean!");
}
</script?>'

Now if the time in the .swf reaches zero, it sends a secret code to removeAll.php that will rewrite the index page.

– removeAll.php–


<?php
if($_GET['key'] == 'secret flash key'){
$handle = fopen('index.html', 'w');
fwrite($handle 'you are a bad client');
}

If the client HAS payed, and all is ok, all I’ve got to do (if you hadn’t noticed in the top script) is visit the goodClientCheck.php page and send a true value to the parameter callOff in the URL like goodClientCheck.php?callOff=1 and the goodClientCheck.php page erases itself.

You could make this more automated of course. Or you could not use it at all and avoid the risk of heavy lawsuits. I just thought it would be fun to put something like this together.

To all my current clients… “Pay Up!” To all prospective clients… Don’t worry, I’d never REALLY do something like this ;)

Source Code Here

-J


SUGAR PILL FACTORY IMAGE
SUGAR PILL FACTORY IMAGE
Digg! Digg this submit to reddit Stumble it!

Leave a Reply