How to handle security in POST or GET using CodeIgniter

Well… it’s a huge subject, and I don’t know if I’m the person to ask to regarding this subject, but a reader asked me to approach it. Let’s start with mentioning the features that CodeIgniter offer in this regard. Looking at the manual, we can clearly see that it covers a lot of subjects, including session handling, encryption, security, input, and form validation. Continue reading

The state of my MY_Model. Inserting data directly from forms with from_form() method

Well… it’s a mess, but it works good for now. And I think it’s evolving, one sign of this being the fact that 20 people stared it on the Github repository (https://github.com/avenirer/CodeIgniter-MY_Model).

And now I’ve added a new method to it, namely from_form(), which, by using the form_validation library is taking the data to be inserted from the form. Continue reading

DATETIME validation in CodeIgniter or how to create your own validation rules with callbacks and/or extending the form validation library

I found myself wanting to validate an input field that will be used when inserting the POST values in a table. That input field would have to be a DATETIME type of value. That is to say that if someone will fill the value of an input field, let’s name the input field “published_at”, that value would have to have a DATETIME format: 2015-05-18 15:10:29. Continue reading

Revisiting the multilevel menu in PHP with some additional code (as in… Bootstrap CSS)

It’s been almost a year since I’ve posted a tutorial (Multi-level menu in PHP – how to do it without killing yourself or the database in the process) about how do create a multi-level menu in PHP, but in all that time I’ve never seen anyone complaining about some of the weak points of my approach. Continue reading

Meet MY_Model (again) for CodeIgniter

Revisiting MY_Model in CodeIgniter: Copying from Jamie Rumbelow and looking at Eloquent and Establishing relationships between tables inside the MY_Model in CodeIgniter (1): has_one and has_many relations were really long tutorials, but we ended up creating a good MY_Model, so I thought “why not post this on Github?”

And I did. You can find CodeIgniter MY_Model at the following repository: https://github.com/avenirer/CodeIgniter-MY_Model

I sure hope you will use it and report me any issues you encounter. if you feel smart, you can also do some pull request. I’ll be happy to merge them if they look good.

The instructions about using the MY_Model can be found on Github. Also, you can look and the tutorials I’ve mentioned earlier. Be careful though, as the final code can be different than what you’re seeing on the Github repository.

Establishing relationships between tables inside the MY_Model in CodeIgniter (1): has_one and has_many relations

This tutorial turned into a Github repository.
Please give it a try at:
https://github.com/avenirer/CodeIgniter-MY_Model

Well… the previous tutorial (Revisiting MY_Model in CodeIgniter: Copying from Jamie Rumbelow and looking at Eloquent) was a reeeally long one, so I decided to create a new tutorial that will continue that one. This means that the current tutorial is still taking into consideration the Jamie Rumbelow’s base model, but also keeps looking at Laravel’s Eloquent. Continue reading

Revisiting MY_Model in CodeIgniter: Copying from Jamie Rumbelow and looking at Eloquent

This tutorial turned into a Github repository.
Please give it a try at:
https://github.com/avenirer/CodeIgniter-MY_Model

This tutorial is a work in progress created at 2015.02.11 and updated at 2015.02.17. It’s tested with CodeIgniter 3.

Well… It’s that time when we should stop repeating ourselves. The DRY philosophy tells us that maybe we should use our time doing things faster than repeating the same steps for basic CRUD in our models. I’ve talked about the MY_Model subject in the past, but we can improve a lot on that.

A few years ago, Jamie Rumbelow wrote a great book named CodeIgniter Handbook in three volumes, in which he manages to bring Ruby philosophy in the world of CodeIgniter. In the book he talks about Convention over Configuration, trying to apply design principles like Don’t Repeat Yourself (DRY) and RESTful style to CodeIgniter. Continue reading