Delete images older than one year in php

 The following code deletes images that contain the word "snapshot" and are older than one year.

$imagePattern = "/snapshot/i";
$directory = "./images";

if (($handle = opendir($directory)) != false) {
    while (($file = readdir($handle)) != false) {
        $filename = "$directory/$file";
        //echo $filename."
        if ( filemtime($filename) <=strtotime("-1 year") && preg_match($imagePattern, $filename)) {
            //echo $filename."  ".date('l dS \o\f F Y h:i:s A', $filetime)."
    echo "Successfully deleted old images";


The Facebook Dislike Button is a Fake

Beware of the rapidly spreading "Activate Dislike Button" on Facebook. An article in GMA news website has a detailed explanation about the technical aspects of this link.

It has few variations and it appears to have hacked a friend's account, allowing it to tag you in a post. Observe however how the post was made. You can see that successive posts are made about this but notice that it came from different media sources (pictures and names removed to keep privacy):

  • Facebook just released the dislike button! Click On 'Activate Dislike Button' below to enable it on your account!

  • Facebook just added the dislike button! Click on 'Activate Dislike Button' below to enable it on your profile!

  • Facebook just released the dislike button! Click on 'Activate Dislike Button' below to enable it on your account!

  • Facebook just launched dislike button! Click On 'Activate Dislike Button' below to enable it on your account!

  • Facebook just launched dislike button! Click on 'Activate Dislike Button' below to enable it on your account!
    about an hour ago via iPhone ·  ·  · See Friendship · Activate Dislike Button

    You can see that the posts have indicated that it came from iPhone, HTC Sense, Windows Phone, and WebOS. Other sources include BlackBerry, Android, and many more. It is quite unbelievable that your friend can do all these successively using different phones. Even if he/she does have all these phones, it will take long to be able to go from one phone to another. The posts will not appear to have been posted successively because there will be other posts from other friends in between them.

    Once again, prevention is better than cure. You already know that this is suspicious so don't bother clicking on the link. Spam can be tolerable, but what if the link is really a cross-site script? You can end up giving some confidential information.

Pacquiao vs. Mosley Live Stream

I was looking for some live stream for Pacquiao vs. Mosley because we have no cable and I can't leave the house right now for the pay per view because of a simultaneous celebration of the birthday of my nephew. I found one:

Difference between a Database and DBMS

Just finished my training and certification exam for an IBM academic evangelist. The training covered database fundamentals and DB2. There were other topics covered relating to databases and database management systems like SQL and XML, but I'd like to put more emphasis on database and DBMS or Database Management Systems. Although I have been practicing as a software developer and IT instructor, I have never taken any particular detail to the theories and concepts of databases, much more handle such subjects. The training refreshed me with what I learned in college as well as given me more information about databases and DBMSs. Here are a few things that I've re-learned (because apparently, I forgot or I did not learn at all):

  1. Database in a general point of view refers to any data repository. It can be a software. It provides an interface to access DATA. 
  2. DBMS or Database Management System is a software system. Whereas database provides a way to access data, DBMS provides a way to manage databases. I have been too accustomed to using the terms database and DBMS interchangeably which is widely accepted but not necessarily correct.
  3. SQL was originally invented by IBM. I have been using SQL in different DBMSs and I did not know that it was invented by IBM which made me think that IBM is no where in the competition for software. 
  4. DB2 is from IBM
  5. DB2 is the second in the market for DBMS. I have been working on software projects that use only free databases such as Firebird and MySQL. I have also worked on an Oracle database as well as MS SQL Server. I never researched about market share for these DBMSs and I thought that Oracle was first in line (which is still true) and followed by Microsoft's SQL Server (it turns out that this is the third in the line), then followed by others. 
  6. DB2 now has a free version for academic use. I always thought that DB2 was unpopular (at least in our place) because only a few can afford it and if anyone can afford it, they would opt to use Oracle or MS SQL instead.
There are a lot more misconceptions that I had which are now corrected, and I am very thankful that I went under this training.