PHP Regular expresssion URL Router

June 23, 2009 No comments yet

In this tutorial we will create a PHP URL router. The developer using the router will be able to define these routes with regular expressions, these will then map to a file, class and method which will be called - very similar to Django’s routing. By using regular expressions to define our URLs we get maximum customizability. /class/method/ based URL routing…

PHP Autoload

May 30, 2009 No comments yet

In large PHP applications you typically see a “classes” directory that only contains classes which are used throughout the application (database, session management, forms etc..). A problem quickly appears: Everytime you wanted to use one of the classes, you would be forced to include() it at the top of the page. __autoload() solves this by automatically including the definition file when a…

Building a Todo List using Code Igniter

April 18, 2009 3 comments

A Query7 reader requested this tutorial to be written. It’s aimed to be a general guide to build ’something’ using Code Igniter. It uses Models, Views, Controllers, Helpers and Libraries and will give you a good idea how Code Igniter works as a whole. I will be posting more advanced Code Igniter tutorials in the future.

Setup

Install and do some basic configuration…

Getting started with Code Igniter

March 29, 2009 3 comments

What is Code Igniter?

Code Igniter is a PHP web framework which assists in creating complex websites. Unlike other web frameworks, Code Igniter doesn’t force you to use all of it’s components. You select and load them as you require. The only feature you have to use is the URL structuring (/controller/method/) which is very helpful anyway.

Code Igniter follows the Model,…

Easy RSS Consumption with Simple Pie in PHP

February 1, 2009 Comments Off

Introduction

RSS Feed consumption has always been a stick point in PHP. Simple Pie is a library that works with both PHP4 and PHP5 that enables you to easily parse and save RSS feeds. Today I’ll show you some common uses of Simple Pie and explain how it runs.

Simple Pie requires:

  • PHP 4.3.0 or higher
  • cURL Enabled.
  • zLib (Caching?)

As well as a few other PHP modules…

Tutorial: Automated Site Backup with PHP and FTP

January 25, 2009 1 comment

In this tutorial we are going to make a PHP script that archives your website into a .tar file, then automatically moves it to an external FTP server for safe keeping. We can then setup a cron for this script which will execute it automatically every day/week/month , however frequent you want it. This will only work on Linux servers…

PHP/jQuery Todo List Part 2

December 8, 2008 4 comments

This is part 2 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery’s AJAX

In part 1 of the tutorial, we covered the PHP and MySQL side of things. In this part we will be enhancing it with jQuery’s AJAX and manipulation functionality. The to-do list will degrade fine - if the user…

PHP + jQuery Todo List Part 1

December 3, 2008 1 comment

This is part 1 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery’s AJAX

In this two part series I’m going to show you how to make a simple to-do list in PHP, and then enhance it using jQuery’s AJAX and manipulation capabilities. This won’t follow any proper coding principles, but will give…

Top 5 PHP Resource Websites

November 30, 2008 No comments yet

PHP is a very vast language. It’s hard to say that you’ve mastered it. For example, do you know how to crop an image using GD and process web requests with XML-RPC off the top of your head? You may know one of them, but probably not both. That being said, there are a lot of resources out there that…

PHP Coding Standards

September 27, 2008 2 comments

Coding standards is a very important thing in web development. Code must be formatted in such a way that everyone can read it. Although you start a project on your own and don’t imagine anyone else seeing the source, there may come a time where you sell the site and a new developer will need to work on it. Or…

jQuery AJAX Tutorial Pt2

May 13, 2008 5 comments

Heres Part 2 of the jQuery AJAX login tutorial. If you haven’t already, i suggest you read part 1 located here.

We are going to start writing the PHP code to process the form. This is fairly basic stuff, using $_POST to get the values from the form, then checking them against pre-assigned values, if they match, then echo approved, if they…

jQuery AJAX Login Series Pt1

May 10, 2008 2 comments

Heyo. This is going to be the first of 4 tutorials on making a jQuery powered AJAX login system with a PHP backend. The series of tutorials will go like so.

  1. Plan, code the form (This tutorial)
  2. Code the PHP backend, make it work
  3. Code the AJAX, implement it.
  4. Tidy it up, make it look snazzy

Ok then. So we will have a forum with…

Securing User Input in PHP

April 21, 2008 2 comments

In nearly all of my PHP tutorials you’ll see me using the secure function to sanitise incoming user data from things like forms, and $_GETs . Its a small function, which no doubt alot of you already have, but here it is anyway.

function secure($string) {
		$string = strip_tags($string);
		$string = htmlspecialchars($string);
		$string = trim($string);
		$string = stripslashes($string);
		$string = mysql_real_escape_string($string);…