Writing an Event System in PHP

March 6, 2010 No comments yet

In this tutorial you will learn how to create and implement an event system in PHP. You will be able to integrate it with your own web application or framework.

What is an event system?

An event system is a way to call prefined functions at a specified time in your application code. It’s main use is to allow developers to add…

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…

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);…


Loading ...