08 Apr 2009 @ 3:35 PM 

I am starting to really dislike the PHP function isset().  Today, I was working on a registration system in CakePHP and my password validation was not working.  If I left the password field blank and clicked submit, it would come back with other errors, but then the password would come back populated with a long string – a hashed version of an empty string!

After some investigation, I discovered that the AuthComponent in CakePHP was doing an isset() check on the username and password fields.  If isset() returned true for both, it would hash the password. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 08 Apr 2009 @ 03:35 PM

EmailPermalinkComments (11)
Tags
Tags: ,
Categories: CakePHP, php
 19 Mar 2009 @ 12:17 PM 

I was recently tasked with a situation where I needed to populate about 10 different “Settings” for every user in the current database.

This example is specifically for CakePHP, however, it could easily be used elsewhere.  My goal was the following, I had an array that was key value paired as follows:

array(
 [0] => array(
  ’User’ => array(
   ’id’ => 1)
  ),
 [1] => array(
  ’User’ => array(
   ’id’ => 2)
  ),
 [2] => array(
  ’User’ => array(
   ’id’ => 3)
  ),
 [3] => array(
  ’User’ => array(
   ’id’ => 4)
  ),
)

The result I needed was as follows:

array(
 [0] => array(
  ’UserSetting’ => array(
   ’user_id’ => 1)
  ),
 [1] => array(
  ’UserSetting’ => array(
   ’user_id’ => 2)
  ),
 [2] => array(
  ’UserSetting’ => array(
   ’user_id’ => 3)
  ),
 [3] => array(
  ’UserSetting’ => array(
   ’user_id’ => 4)
  ),
)

With a few simple lines of code, I was able to quickly and easily achieve this, let me show you how. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 18 Mar 2009 @ 06:22 PM

EmailPermalinkComments (2)
Tags
Tags: , ,
Categories: CakePHP, php
 09 Mar 2009 @ 5:20 PM 

In today’s article we are going to create a very basic blog that allows people to create a post and posts comments on that post via AJAX.  We are going to keep it extremely basic and just focus on that actual AJAX functionality.

Ready? Let’s begin.  We are going to start by creating two database tables: posts and posts_comments.  Below is a sample create statement for the posts table: More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 09 Mar 2009 @ 05:23 PM

EmailPermalinkComments (10)
Tags
Tags: , ,
Categories: AJAX, CakePHP, php
 08 Mar 2009 @ 2:06 PM 

At the end of part one, we had a working CMS.  Well, at least it was saving files and they could be displayed to the public.  In today’s article, we are going to further advance our CMS.  We will cover the following items:

  1. fckEditor
  2. Revisions

More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 08 Mar 2009 @ 02:07 PM

EmailPermalinkComments (3)
Tags
Tags: , ,
Categories: CakePHP, php
 07 Mar 2009 @ 5:17 PM 

I really enjoying writing code and I find that snippets just don’t always cut it for me.  So in today’s article, I am going to describe the process of creating a CMS (Content Management System) with CakePHP.

This will be a two part article, in part one we will focus on getting the basics working.  The basics will include ability to add, edit, and delete static content pages.

Part two will advance on our basis and allow us to create drafts and revert back to previous versions.

To begin, let’s download the latest release of CakePHP.  After you’ve downloaded it, extract it to a folder of your choice.  In my case it will be c:\xampplite\htdocs\CMS.  I can now access my new web site by browsing to http://localhost/CMS. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 07 Mar 2009 @ 05:17 PM

EmailPermalinkComments (1)
Tags
Tags: , ,
Categories: CakePHP, php
 02 Mar 2009 @ 3:14 PM 

Ever want to build a chat application or perhaps even a game? If so, a socket server will help you get started. Once you understand the underlying functionality of creating the server, enhancing it is just as easy.

The way a socket server works is, it will be running continously and waiting for a client to connect to it. When a client connects, our server will add it to our list of clients and begin waiting for messages from that client.

Without further adieu, here is the full source code:

More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 02 Mar 2009 @ 03:14 PM

EmailPermalinkComments (6)
Tags
Tags: , ,
Categories: Theory, php

 Last 50 Posts
 Back
Change Theme...
  • Users » 8
  • Posts/Pages » 72
  • Comments » 198
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight