Nov 09 2006
I came across a MySpace bulletin that announced itself as “The only bulletin that counts how many times its been posted!”. If read someone elses bulletin all you need to do is click the link at the bottom and it loads up your own bulletin posting form for you to repost the bulletin with the latest posting count.
But how does the count get updated? That’s very simple and comes down to three lines of code:
What happens is when you click the repost bulletin link, the bullcount.php page opens up the count.txt file, reads the number, adds one and saves the number again. It then creates the bulletin post form (including the new count) and submits it for you. Quite simple really.
This is all very nice, however, unless you know what you are doing you’ll never know quite how far the bulletin has got to, even if you have a lot of friends on MySpace you’ll only get the latest count so long as your friends re-post the bulletin. So I propose an upgrade to this simple setup. Whilst it is not possible to dynamically change the number in the bulletin, we can change the number in the body of the bulletin. This can be done using a dynamically generated gif (a graphical representation of the number), which is very trivial in PHP and there are numerous scripts out there which do just this. The result would be that the bulletin title could indicate at which point the users joined the chain, and the image in the bulletin body would indicate how far it has got.
The current implementation relies on a simple text file but this can lead to all sorts of concurrency problems, especially if you have 100,000 users opening it for outputting to the gif, therefore this upgrade may require a change to using a DB that can handle locking but I’ll leave that for someone else to sort out.
If you’re planning on creating your own version the code required for the bulletin posting form is:
<form name="bulletinForm" action="http://mail.myspace.com/index.cfm?fuseaction=bulletin.edit" method="POST" target="_self">
<input type="hidden" name="groupID" value="0">
<input type="hidden" name="hashcode" value="MHsGCisGAQQBgjdYA8igbTBrBgorBgEEAYI3WAMBoF0wWwIDAgABAgJmAwICAMAECMDZad0h0zS3BBBjEFtHHZcIPZ22xHDNx80PBDB/bOdbTVXoblD/iQi1aMqvh//wZuk7RhaHgFKCy/h6bH0MSkrfs7r9H1gdk0fA69k=">
<input type="hidden" name="hash" value="6308J150O169O160O160O153O168O157O162">
<input type="hidden" name="subject" value="
echo("Let's see how big this can get. Repost number: $count");
" size="1" maxlength="50">
<textarea name="body" type="hidden" style="width: 0px; height: 0px;"><Center>
<font face="comic sans ms">
This is the only bulliten that counts how many times its been posted!<br>
So far this bulletin has been posted<br><big>
<?php echo("$count"); ?></big><br>
Click here to repost this bulletin</a><br>
<input type="submit" value="Click here if you're not automatically redirected.">
This code was “borrowed” from here… I assume they don’t mind me re-posting it as they did put the source code online