Fixed!
Looks like I fixed the PHP code on my website just in time to get a post in for 2010.
Post of the Year
Whoa, 2009 is almost over and I haven't posted a single thing.
Summary of Cubs Opening Day
I got snow in my nachos and they lost.
Gift Wrapping Lesson 1: DVD
First, find a nice clean area to begin wrapping your gift. I am using the floor of my room.

Find the wrapping paper of your choice and your favorite roll of duct tape, proceed to wrap the gift in its first layer.

Next, we use a piece of bubble wrap along with clear packaging tape, not duct tape, since we don't want to hide the pretty bubbles. This is to make sure the gift is not damaged. Many people are sneaky and like to shake their gifts before Christmas to try to determine what's inside.


The next step is to place the gift into a suitable box. This is also a good time to get rid of random garbage laying around in your room. I've added some plastic and random papers. Think of these as bonus gifts or getting someone else to throw away your trash.

And place the gift inside.

It would be a shame if the package accidentally opened before Christmas. Get your duct tape and properly secure the package.


Next, we neatly cut a sheet of wrapping paper for the beautiful outer layer.

Just 2 hours later, a beautiful, professional looking, wrapped present. Someone is going to be awfully happy!

The final touch, a custom, hand created gift tag.


Find the wrapping paper of your choice and your favorite roll of duct tape, proceed to wrap the gift in its first layer.

Next, we use a piece of bubble wrap along with clear packaging tape, not duct tape, since we don't want to hide the pretty bubbles. This is to make sure the gift is not damaged. Many people are sneaky and like to shake their gifts before Christmas to try to determine what's inside.


The next step is to place the gift into a suitable box. This is also a good time to get rid of random garbage laying around in your room. I've added some plastic and random papers. Think of these as bonus gifts or getting someone else to throw away your trash.

And place the gift inside.

It would be a shame if the package accidentally opened before Christmas. Get your duct tape and properly secure the package.


Next, we neatly cut a sheet of wrapping paper for the beautiful outer layer.

Just 2 hours later, a beautiful, professional looking, wrapped present. Someone is going to be awfully happy!

The final touch, a custom, hand created gift tag.

Basic Security with the Zend Framework
I have a "secret project" that I'm working on. I'm being cutting edge and using the new Zend Framework. One thing I needed to figure out was an easy way to add some security to the admin portion of the site. As far as I know, the Zend Framework does not currently provide this functionality built in. The method I'm using (someone who knows more about security might say this is completely wrong, feel free to tell me why this is no good...) is to create my own Controller object. Any of the controllers in my project that I want to be secure such as the 'AdminController' will extend my custom Security Controller.
abstract class Security_Controller_Action extends Zend_Controller_Action
{
protected $filterPost;
protected $view;
function __construct()
{
// generic stuff used in all my controllers
$this->filterPost = new Zend_InputFilter($_POST);
$this->view = new Zend_View();
// check if the user has sent authentication values
if( !isset( $_SERVER['PHP_AUTH_USER'] ) )
{
// they havent. so ask them to, or reject them if they hit cancel
header('WWW-Authenticate: Basic realm="MySite"');
header('HTTP/1.0 401 Unauthorized');
echo 'Please go away. Thanks.';
exit;
}
else
{
// the user has sent authentication values, so
// check the username and password sent in with stored
// values in a database or hardcoded values in this case
if( $_SERVER['PHP_AUTH_USER'] != "user" || $_SERVER['PHP_AUTH_PW'] != "pass" )
{
header('HTTP/1.0 401 Unauthorized');
echo 'Please go away. Thanks.';
exit;
}
}
}
}
and then for any of your 'secure' sections, have the Controller extend the Security_Controller_Action class.
Zend::loadClass('Security_Controller_Action');
Zend::loadClass('Zend_View');
class AdminController extends Security_Controller_Action
{
}

