rendered paste body // fuck it, I'm gonna throw exceptions as opposed to implementing an event handler.. class UExcept extends Exception { const INTERNAL = 2; const GENERIC = 0; const WARNING = 1; public $definitions = array(); public $messages; public $code = self::INTERNAL; public function __construct($message = null, $code = self::INTERNAL) { $this->messages = array(); return parent::__construct($message, $code); } public function getmessage() { if(is_numeric($this->message) && array_key_exists($self::definitions, $this->message)) return $this->messages[$this->message]; elseif(is_array($this->message)) { foreach($this->message as $key) array_push($this->messages, $self::definitions[$this->message] ? $self::definitions[$this->message] : ); return (array)$this->messages(); } else return parent::getmessage(); } public function format($format = " - %s<br />\n") { $r = ''; $t = $this->getmessage(); if(!is_array($t)) $t = (array)$t; foreach($t as $v) $t .= sprintf($format, $v); return $t; } public function register($list) { $self::definitions = array_merge((array)$self::definitions, $list); } public function uexit($message=null) { if($message) print '<b>' . $message . '<\b>' . "\n"; } } UExcept::register(array( user::ERR_EXISTS => 'The username you requested is already in use. Please, choose another.', user::ERR_INVALID_USER => 'The username you requested contains invalid characters. Please choose another. <i>(Acceptable characters include A-Z, 0-9, _, - and .)</i>', user::ERR_INVALID_PWD=> 'Password must be atleast ' . UACCOUNT_PWDMIN . ' characters long.', user::ERR_INVALID_EMAIL => 'The email address you supplied is invalid.'));