Home / Blog

BlogNifty

In honor of this release's compatibility with nanoweb and the new SQLite PDO driver, I've written the first part of an article dealing with how to write your own virtual host control panel, or other embedded PHP servers.

You can build a PHP-CGI binary for 1 platform, compile in PDO and SQLite (since sqlite is just a C client library and not a server), and ship it with nanoweb. Now you have a full Web application stack in only about 14 Mb (depending on what you throw into the php-cgi and how much you compile statically).

Live Cheatsheet Brings Tutorials to Life

trying to put another "r" in RAD

I've just added a new "live cheat sheet" to the http://cognifty.com/index.php/tutorial/ section. I've seen some other projects which have these so-called "cheat sheets", but the cheat sheet is simply a huge PDF. These PDFs usually show a graphical representation of the software system as a set colored blocks and arrows with tiny variables written inside the blocks. These variables are supposed to help you remember which functions are available at which points in the system.

Is Your MVC MIA When it Comes to 404s?

Dealing with missing pages in Web applications.

How can we capture 404 errors in MVC frameworks? Apache always finds the index.php file that kicks off the MVC application. So, should a missing controller constitute an error at all? Is sending a 404 the "right" thing to do?

Addslashes(): don't call it a comeback

still number one for escaping SQL statements

I've seen a lot of people talking about mysql_real_escape_string() vs addslashes() vs addcslashes(). There seems to be a lot of real confusion about what these functions do (even with the php.net manual around), especially when it comes to character sets. I feel that some people are being scared into using some escaping methods with which they are not very familiar. So, I've decided to lay it all out in a few charts so there is no confusion about what each function does and how each can help protect against SQL injection attacks.

Paging Dr. Active Record

getting the total number of records from a query

Release 10 of Cognifty has a nice little database feature that I haven't noticed in other libraries. I'm not saying they don't have them, but they don't really announce useful tools to developers, just the same old stuff about OOP and some directory structure loosely based on LogiCreate.

The feature about which I'm talking is the getUnlimitedCount() method. When working with data items, or active records, or SQL abstraction, or whatever you want to call it, the getUnlimitedCount method runs the query it would normally run, but it selects the total number of records without including the LIMIT or ORDER BY clauses.