Archive for category PHP

PHP’s Classes and Objects

blocksBefore start working with classes and objects, we must first know the difference between traditional programming and object oriented programing (OOP).  In traditional programming problems are solved performing one action after the other, in other words, you write a program where some actions are executed one by one to solve a problem.

For Example,  if you want to add two numbers in PHP, it’s enough the following code:

// Define the numbers
$a = 2;
$b = 3;
// Add both numbers
$c = $a + $b;
echo "a+b=".$c;

Read the rest of this entry »



Automatic full backup on cPanel

logo_cpanelYesterday I had some issues with the WordPress 2.8 update and, supposedly,  qtranslate (a plugin to support several languages). The thing is I could restore WordPress 2.7.1 from an old backup, but I realized it dated from a month ago…bad, bad. I decided to do a research on automatic full-backup with cpanel and I came across the Automatic cPanel backup (domain & MySQL) with cron & PHP post by Justin Cook .This is a php script to perform the cPanel‘s full backup request with ftp redirection to a remote host. Due to I don’t have an ftp server, I changed some lines to make the backup locally, so I could get those backups from cPanel full-backup tool. Here’s what I did:

PHP Script

You can download the script from Github here.

Cron jobs

In order to have the backup made every 15 days just save the above script as fullbackup.php and set cron in cPanel‘s tool as shown next: