I was checking my inbox today and got a message from someone asking to get my custom validation class because the link had expired. Well, I have long since moved to another framework so I figured I would post all my CI code for you guys to have. It’s probably sloppy, and I don’t know how many people it will help, but there is some good nuggets in there. I think CI is a great framework but I have moved on to another framework.
Anyway, enough about that. Here is the code I used when I *started* development with CI. I hope it can be of use to some people. Oh, and I think I was using CI v1.53 or something along those lines. So some of this might need adjusting for v1.54. Also, I cannot provide support for this. Use it at your own risk.
First is my validation class. You can read about it here:
Download Mirror1: http://rapidshare.com/files/59154081/MY_Validation.php.html
Download Mirror2: http://www.megaupload.com/?d=0A6MG8BP
Also, I included a sample validation file. To use it, create a “validators” folder in your CI directory as such: “\system\application\validators” and then throw in your custom validation files. Here is a sample:
Download Mirror1: http://rapidshare.com/files/59156654/account_validator.php.html
Second is my session class. You can read about it here:
I am pretty proud of it; while the code could use some tweaking, I believe it is really secure. Also, you can find the MySQL table insert code at the bottom of the file in comments.
Download Mirror1: http://rapidshare.com/files/59155573/Session.php.html
Download Mirror2: http://www.megaupload.com/?d=KUT8XS2I
Third is a zip file with a helper file called multi_helper.php with a few useful things in it, including a SHA256 function. What is neat is it checks for hash() first, then mhash(), and finally if neither exist then it uses a custom library plugin to generate the SHA256 even if your version of php does not support it! Pretty cool stuff. I didn’t write the plugin, but I included it in the file.
Download Mirror1: http://rapidshare.com/files/59156098/system.zip.html
Download Mirror2: http://www.megaupload.com/?d=9AIYW9N9
Here are three controllers I made. They are hardly finished, and extremely basic. But at least they show how to integrate the above files with your controllers.
Download Mirror1: http://rapidshare.com/files/59157151/controllers.zip.html
Here are three views I made for testing purposes. There isn’t much in them, but they might help you get your views started.
Download Mirror1: http://rapidshare.com/files/59157508/views.zip.html
Finally, to the core v1.53 CI code, I patched three things. Here is a file detailing the patches. The last one, which deals with the session is the most important.
Download Mirror1: http://rapidshare.com/files/59158161/custompatches.txt.html
Well that’s it. Of the month or two I spent on CI, I used most of my time learning its inner-workings, making the custom validation class, and the session class. The rest of the files could be used as a good jump-start to someone new to MVC and frameworks, who maybe has a lot of questions about how to go about something but don’t know really where to start. Anyway, I hope some of this is useful.