I just want to help propagate the message to anyone possibly visiting this page from the US, I urge you to visit www.savechristianradio.com and contact your FCC rep and petition the FCC to halt this act of communism.
-
Hi there! To those who actually read my blog every now and then.
I’ve moved it over to a subdomain, blog.artooro.com and upgraded to Wordpress 2.3 at the same shot, not to mention using subversion as an installation and upgrade mechanism.
Not sure what I’ll do with the main domain yet but we’ll see what happens in the coming days and weeks.
Tags: Uncategorized
-
The Israeli security cabinet approved a new aircraft missile defense system to be installed on all civilian aircraft. This decision comes after intelligence reports and the fact that Israel’s enemies having access to more advanced missile technology.
They’re the first nation to do so, and it’ll be interesting to see what progresses.
Tags: Uncategorized
-
In the past I’ve used iTunes for downloading certain songs, but now with Amazon’s new MP3 downloads service, with no DRM, at 256kbps–I’d say they’ve won my first choice.
Tags: Uncategorized
-
Because the third world war is likely going to begin over the next few months.
Tags: Uncategorized
-
Just came back from doing a roof a few hours north of here. The first entire roof I’ve done with Cedar shakes. It looks good.
The lake is no more than 30 ft. behind the cottage.
While we were there, I had an urge to get onto the water and float around. We went all the way to a nearby point and did some fishing on this thing.Tags: Uncategorized
-
I just sent out my tax return (Canada) to the CRA via NETFILE using UFile to prepare the return.
So for those of you who still need to do it, and are wanting to use NETFILE, and you’re using an OS other than Windows such as Mac OS X (me) or Linux?
I highly recommend UFile.ca. For those with incomes under 25000 it’s free.Tags: Uncategorized
-
This $project I’m working on–which has yet to be named, is nigh completion. I expect a live testing site to appear here sometime before or on January 27. We’ll see how it all goes.
Here’s my current todo list:
Complete articles section (search/index/view)Many CheckFields() uses the old buggy API and need to be upgraded.The home page needs to be written.Many administration pages need the delete function to be added.This project needs a name. Got one?Pre-beta rough testing and polishing.
For names I have “illumicore” and “can’t think of another one”. Can you think of any?
Well have a snowy day, I’m post again when something live is available.
Tags: Illumicore, PHP, Uncategorized
-
Welcome to my new web site, artooro.com. This site will replace my blog at blogger. We’ll see how long it lasts.
The current theme is temporary as I’m working on finishing a project right now, it may be March by the time something new appears here.
What is this project? Just to give you a little idea, it’s a web based content management system designed for churches. We’re going to be using it as soon as it’s ready, and then it will be polished for a release to the general public. It will be hosted on Google Code once it’s ready.
Features will include, news/update, events calendar, maps, contact form and information, audio podcasting, web playlist, and audio search; articles, and custom pages. This thing will be awesome for creating church web sites quickly and easily. Of course it will be tailored to our needs initially but as soon as the code is released, anybody can use it and submit code to make it better for everybody.So I hope to make more use of artooro.com and this year progresses. Stay tuned!
Tags: PHP, Uncategorized
-
Mahmoud Abbas, “Aim your rifles at Israel.”
For so long Abbas has been touted as a “moderate”, someone who wants peace but is OK with the idea of Israel staying on the map.
Since Abbas replaced Arafat I’ve been highly critical of the man. It my opinion, it were better a moderate were an extremest in a way, either on one side or the other. If you’re in between, you’ll either get shot or not accomplish anything. Abbas has not accomplished anything since he started his current post. Yet some say “strengthening him” will help the peace process. I hope you see differently now.Tags: Uncategorized
-
As what usually happens when you first right some code, and then put it into real world use, you make some changes to make it more efficient and easier to use. The same thing happened with my CheckFields function posted earlier.
So here’s the code:
'year', 'email' => 'email', 'date' => 'date', 'length=2, int, date' => 'month', 'passwordsmatch' => 'password, confirmpass'); $input = array | example=($_POST || $_GET)*/ class CheckFields { public $lastError; public function __construct($reqs, $input) { foreach ($reqs as $type => $id) { $fields = explode(', ', $id); foreach ($fields as $field) { if (!isset($input[$field]) || $input[$field] == '') { $this->_ret(false, 00, $id, '"' . ucfirst($id) . '" Must be completed in order to continue.'); break(2); //return array(false, $id . ' resulted in err00'); } } $types = explode(', ', $type); foreach ($types as $t) { switch (preg_replace('|(^.+)(\=.*)|', '$1', $t)) { case 'passwordsmatch': $fields = explode(', ', $id); if ($input[$fields[0]] != $input[$fields[1]]) { $this->_ret(false, 06, $id, '"' . ucfirst($fields[0]) . '" must be the same as "' . ucfirst($fields[1]) . '"'); break(3); //return array(false, $id . ' resulted in err06'); } break; case 'date': if (strtotime($input[$id]) === false) { $this->_ret(false, 05, $id, '"' . ucfirst($id) . '" Is not a valid date.'); break(3); //return array(false, $id . ' resulted in err05'); } break; case 'email': if (!eregi("^(.+)(@)(.+)(\.)(.+)$", $input[$id])) { $this->_ret(false, 04, $id, '"' . ucfirst($id) . '" Is not a valid email address.'); break(3); //return array(false, $id . ' resulted in err04'); } break; case 'length': // Make sure the field is the correct length preg_match('|(^.+)(\=)(.*$)|', $t, $m); if (strlen($input[$id]) != $m[3]) { $this->_ret(false, 01, $id, '"' . ucfirst($id) . '" Is not the correct length.'); break(3); //return array(false, $id . ' resulted in err01'); } break; case 'int': if (!is_numeric($input[$id])) { $this->_ret(false, 02, $id, '"' . ucfirst($id) . '" Must be a number and it is not.'); break(3); //return array(false, $id . ' resulted in err02'); } break; case 'text': if (!is_string($input[$id])) { $this->_ret(false, 03, $id, '"' . ucfirst($id) . '" Must be text and it is not.'); break(3); //return array(false, $id . ' resulted in err03'); } break; default: trigger_error('Invalid type provided to checkFields()', E_USER_ERROR); } } } //return array(true, 'err7 - Success'); if (!isset($this->lastError)) { $this->_ret(true, 07, NULL, 'It was a success!'); } } private function _ret($value, $code, $field_name, $description) { $error = array( 'value' => $value, 'code' => $code, 'field' => $field_name, 'description' => $description ); $this->lastError = $error; } public function __get($id) { return $this->lastError[$id]; }}The major revisions include:
- Is now object oriented.
- Does not return a value. To get information use $field_object->value/code/field/description or directly access the lastError array.
- Provides a description suitable to give straight to the client. The error information could be used to highlight fields which failed the requirements using ajax or another JavaScript technique.
So now the example I have earlier, redone would look like this:
$requirements = array( 'date' => 'date', 'text' => 'name', 'email' => 'email', 'date, int, length=4' => 'yearofbirth');$field_check = new CheckFields($requirements, $_POST);print_r($field_check->lastError);
Tags: Uncategorized
-
I wrote a function in PHP that checks submitted form fields for certain requirements. It works by passing in an array of requirements and the array of submitted data such as $_POST or $_GET. The requirements array contains the fields types and names. For example to check for a date field, a name, an email address, and year of birth, you could do this:
$requirements = array( 'date' => 'date', 'text' => 'name', 'email' => 'email', 'date, int, length=4' => 'yearofbirth');$resultArray = checkFields($requirements, $_GET);
It allows you to mix certain types together (where it makes sense) and the function is easy to expand to include new types.
It returns an array. The first key is either true or false depending on how the input validated, and the second key contains an error code and description.Now with no further delay, here’s the code:
/* $reqs = array( type => id 'text' => 'name', 'int' => 'year', 'email' => 'email', 'date' => 'date', 'length=2, int, date' => 'month', 'passwordsmatch' => 'password, confirmpass' ); $input = array | example=($_POST || $_GET)*/function checkFields($reqs, $input) { foreach ($reqs as $type => $id) { $fields = explode(', ', $id); foreach ($fields as $field) { if (!isset($input[$field]) || $input[$field] == '') { return array(false, $id . ' resulted in err00'); } } $types = explode(', ', $type); foreach ($types as $t) { switch (preg_replace('|(^.+)(\=.*)|', '$1', $t)) { case 'passwordsmatch': $fields = explode(', ', $id); if ($input[$fields[0]] != $input[$fields[1]]) { return array(false, $id . ' resulted in err06'); } break; case 'date': if (strtotime($input[$id]) === false) { return array(false, $id . ' resulted in err05'); } break; case 'email': if (!eregi("^(.+)(@)(.+)(\.)(.+)$", $input[$id])) { return array(false, $id . ' resulted in err04'); } break; case 'length': // Make sure the field is the correct length preg_match('|(^.+)(\=)(.*$)|', $t, $m); if (strlen($input[$id]) != $m[3]) { return array(false, $id . ' resulted in err01'); } break; case 'int': if (!is_numeric($input[$id])) { return array(false, $id . ' resulted in err02'); } break; case 'text': if (!is_string($input[$id])) { return array(false, $id . ' resulted in err03'); } break; default: trigger_error('Invalid type provided to checkFields()', E_USER_ERROR); } } } return array(true, 'err7 - Success');}Labels: php
Tags: Uncategorized
Category:
Blogroll:
Archives:
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- March 2007
- February 2007
- January 2007
- December 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- April 2005
- March 2005
- February 2005
- January 2005
- December 2004
- July 2004





