How to run code before every controller in CodeIgniter

I have been working on my side project PostRecycler recently which I have re-written to use the CodeIgniter framework. I came across an interesting challenge where I needed to run some code before every other controller.

What I wanted was to prevent a user from moving away from the dashboard page if their account had expired but what I didn’t want to do was to have to remember to put that into every controller. I guess I could have done it as a helper function but that still would have meant putting a call to it in every controller. MY_Controller … Read the rest

How to store UNICODE in a non-UNICODE database

For a side project I am working on (Glad you asked! PostRecycler which makes the most of your social posts) I needed to all entry of unicode characters for just one field.

This left me in a bit of a quandary as I really didn’t want to have to convert the whole of my database to UTF-8 just so I could have this one column accept unicode characters.

Then I remembered something I had discovered in our companies web app which accepted unicode characters but I knew the database wasn’t unicode enabled. However, I knew that this column was encrypted … Read the rest

Setting the Codeigniter Environment for both CLI and Browser

I’ve recently been getting to grips with the Codeigniter framework after years of using a home-grown monstrosity. I was becoming more and more concerned about the level of security in my own framework and decided I would be better off with something that’s maintained.

I researched the many PHP frameworks to find one that was going to work for me. I toyed with the idea of using Symfony, which is what our products are based on, but the time to get up-to-speed with it was greater than I wanted to invest. I therefore settled on Codeigniter which looked easier … Read the rest