Category: PHP

  • Recent Guest Posts on PHPMaster.com

    I’ve had the pleasure of being a guest writer at a fantastic site called phpmaster.com.  This site is a subsidiary site to one of the most popular technology blogging sites sitepoint.com.

    The first article I wrote is an excellent extension of the various CakePHP articles I’ve written about in the past.  It discusses a variety of ways to improve the speed of CakePHP applications.  The latest article (that was just released a few days ago) discusses creating your very own OAuth server.  Since OAuth2 is still in a draft state, the article is for creating an OAuth1 server.

    In case you are not a regular of this site, here is a quick preview of the articles. (more…)

  • PHP: Single Quotes versus Double Quotes

    I always enjoy doing interviews and asking potential candidates what the difference between single quotes and double quotes are in PHP.  Most people have the basic understanding that single quotes are not interpreted by the compiler whereas double quotes are processed while the page is being executed.  The follow up question is typically which one they prefer; this answer is always 50/50.  I have always been a fan of single quotes thinking them to be faster…

    (more…)

  • Upgrading my Blog – The Final Saga!

    Several of my recent posts have been discussing my recent move to Amazon EC2 and updating, first to a LEMP stack, and then to a LEPP stack, which all provided great speed increases.  However, can you really be satisfied with a slightly faster loading WordPress blog, especially when my CPU was dying regularly with 100% usage?  I certainly couldn’t, especially when YSlow was giving me such a bad rating that I had really no control over…

    Firstly, a big shout out must go to Nesbot.com; he was so kind to share his custom blog code that he built using SlimPHP.  Of course I had to add a few features myself – including my fancy Twitter slider – and an importer from my WordPress blog into this new blog structure.

    If you look at the screenshot to the right, you can see  exactly when I switched two other sites to use this code on the 22nd of September!

    (more…)

  • The Best Way to Prevent SQL Injection

    If you use a framework of some sort, you probably haven’t thought about SQL injection for some time – in fact it almost seems dated to even discuss it.  However, security should never be overlooked and it’s important to not trust third party applications and people by default!  So what is the best way to prevent SQL injection?

    Have you noticed how I haven’t specified a specific language?  This is done purposely, because at the end of the day – all languages – should be able to follow this paradigm…

    (more…)

  • CakePHP 2.x Login System

    Well, since one of my most popular all-time blog posts is Login system with CakePHP in under 10 minutes I think it’s time that I update it to version 2.x (currently 2.2 at the time of writing).  The original post was probably written for version 1.2 or 1.1 and there have been several changes made, especially with breaking changes to the AuthenicateComponent.

    The beautiful part is the changes are extremely limited.  In fact, only the UsersController requires a few minor changes.

    (more…)