Web Framework

April 18th, 2008

Attached is a copy of a very very alpha stage web framework I just made. I took most of the code from a site I’m developing, and removed the site specific stuff from it. It’s fairly advanced, just not fully complete.

Features includes:

An interactive command line mode (pipe your email, run cron jobs, all through the same application, with complete separation from the web interface)
An advanced controller/view architecture (no models yet).
Controllers run in a fully virtual environment (virtual IP, session, etc), allowing unit testing of practically anything.
A database revision system
An advanced exception model for comprehensive error reporting and logging
Maximum security with session hijacking and HTML/SQL injection prevention

Keep in mind, this is not CakePHP or Ruby on Rails. It doesn’t do as much for you, but in turn it provides maximum flexibility. This is not a “for dummies” framework, you have to know what you’re doing but it has major potential. Absolutely every line of code is written with maximum flexibility and modularity in mind.

It’s attached in a zip. Barely any documentation, if you have any questions at all though feel free to ask me.

Alpha Web Framework

Updated type hinting patch

April 15th, 2008

Added type checking for default values and disallowing of null values on parameters without a null default.

Scalar Type Hinting Patch (04-15-2008)

URL Builder Class

April 12th, 2008

This class allows you to build URLs using an easy object oriented interface.

Example:

// My blog

$url = new sb_url;
$url -> setDomain(’www.sambarrow.com’);

echo $url -> generate() . ‘<br />’;

// My blog archives

$url -> setPath(’/archives’);

echo $url -> generate() . ‘<br />’;

// My blog (using SSL)

$url -> setPath(’/');
$url -> setProtocol(sb_protocol_https);

echo $url -> generate() . ‘<br />’;

Download:

URL Builder Class

Fully object oriented + strongly typed PHP

April 11th, 2008

I wrote a few classes today allowing you to use all of your types as objects (like in Java).

$string = new vstring(’Hello!’);
$upper = $string -> upper();
echo $upper -> get();

This will output “HELLO!”

Strong PHP Types

New type hinting patch

March 31st, 2008

This new type hinting patch includes support for objects with __toString methods, allowing them to pass a string type hint.

Scalar Type Hinting Patch (March 31, 2008)

Brute force login attack protection system

March 30th, 2008

This script allows a user X failed logins. After this, their account is locked for N minutes. After the lock ends, they are allowed X more failed logins, and the process starts from the beginning. All logins are logged with IP address and timestamp.

This script is specific to a site I recently made, so it will have to be adapted to your login system. I can do this if you are interested, charging for my time, or you can do it, just replace my site specific functions (alerts_add, app_redirect, and db_*) and create the tables.

Login Protection System Script
Login Protection System SQL Export

Common matching functions

March 30th, 2008

These are 3 functions that will match zip codes, alphanumeric strings, and email address.

Common matching functions

Database Select Query Builder

March 27th, 2008

Just something I was messing around with. I made a class that allows you to build your own queries, with full support for conditionals. Pretty interesting, take a look. It’s all done using object oriented.

Database Select Query Builder

Database Security Functions

March 11th, 2008

These two functions escape data for sql queries, and apply backticks to table/column names. They can be used in conjunction with the mysql functions for easy updating, insertion, etc. that I will be posting soon.

DB Security Functions

My Ubuntu Hardware Site

March 11th, 2008

Many of you may have heard of my Ubuntu Linux hardware compatibility site. For those that are not aware, I did a complete from-scratch rewrite a couple of weeks back, along with new hosting. You can check out the new site at ubuntuhcl.org.

Contribute!
Leave a review on your Ubuntu hardware and contribute to our database of hundreds of reviews.

Access the hardware review rss feed at ubuntuhcl.org/reviews/rss.