During the days of PHP4, the most common way of showing the files in a directory was like so:
PHP:
-
if ($handle =
opendir('/home/fernando/temp')) {
-
while (false !==
($file =
readdir($handle))) {
-
if ($file != "." && $file != "..") {
-
-
}
-
}
-
-
}
However, if your PHP version has now been upgraded to PHP 5, you can take advantage of DirectoryIterator instead. This class (don't get scared) is part of the SPL library that is now bundled within PHP 5.
May 18th, 2006
PEAR, the PHP Extension and Application Repository, has been around since 1999, and has several functions. According to the 'About PEAR' page:
The purpose of PEAR is to provide:
- A structured library of open-sourced code for PHP users
- A system for code distribution and package maintenance
- A standard style for code written in PHP
- The PHP Extension Community Library (PECL)
- A web site, mailing lists and download mirrors to support the PHP/PEAR community
Getting Started
For most PHP coders, including myself at one point, PEAR seemed to be a bit of a mystery for those who shy away from object orientated programming. The first point to remember is this: you don't need OOP knowledge to use PEAR! Yup, no lies, you can use it if you have an ounce of intelligence, and can read the documentation! So, to calm the fear of PEAR, I'm going to take a step by step approach to installation, and the usage of several PEAR classes in a series of posts.
Continue Reading May 10th, 2006
A critical bug with $_POST array handling as well as the FastCGI sapi have been discovered in PHP 5.1.3. A new PHP release 5.1.4 is now available to address these issues. All PHP users are encouraged to upgrade to this release as soon as possible.
May 5th, 2006
After what seems like an eternity, PHP 5.1.3 has been released. Among the changes, the new release comes with improved date / time facilities, improvements to GD, CURL, SPL and a number of security fixes. More information can be found in the PHP Release Docs.
Along with this release sees a collection of PECL binaries available as a collection for Windows users. You can download PHP 5.1.3 from your closest mirror now!
May 2nd, 2006
Although not directly PHP-related, I'm aware that a lot of people who look over this blog are freelance or part time coders. It's always important to make sure that both you and your client stand on the same level, and as such, MediaSurgery have been kind enough to release their web design contract (checked by a lawyer) for free. The contract is available in both Open Office and Microsoft Word formats. Go get it!
May 2nd, 2006
Spurred on by Jason's plan, I thought that I would do something similar. I thought it would might be useful if I wrote a small series based upon a set plan. Maybe write up 5-10 (or more?) articles, say one a week, and hopefully get some people thinking about how they should be coding up their scripts, in terms of security, database structure and so on.
A few topics I've thought of:
- A basic user administration program with multiple levels of access
- A guestbook
- Regular Expressions
- Classes 101
- New features in PHP 5
- Database Structuring
- ...
April 28th, 2006
Ilia has posted up a PDF copy of his slides used in the recent PHP|Tek conference. Its well worth a quick read over. On another note, Ilia's book on PHP security is a must have for any serious coder. It is full of useful information and my well thumbed copy has been a life saver and taught me a few things I hadn't really considered. Nice one Ilia!
April 28th, 2006
Quite a few of the people that read this blog are coders who work either part time, or full time, mostly from home but some in an office. However, most if not all have coded an ecommerce site, but maybe not looked at all the angles. Jason Chance is going to be looking at these concepts based upon his own experience:
I don’t want these articles to focus on what so-called “experts” say are the best practices, or what you can read in some business book you pick up at the bookstore. These articles instead will focus on my personal experience as I have worked with various companies setting up their online operations.
April 28th, 2006
Google is clearly the better search engine overall - I've never had a problem with it. That was until I decided to syndicate some of its news feeds. Google has taken it upon themselves to provide their newsfeeds in html format. And its not even good HTML. Each item is packed with tables, and font tags where it would be simpler to just provide these news snippets as plain text. There is more than enough allowance in the RSS 2.0 specifications to allow for images to be placed outside the description, yet they fall down on this part. You'll find images placed besides news articles that are sometimes hardly relevant.
April 27th, 2006
Its quite common for people to have one main template, and 'include' their content into the main content area. This works well for small informational sites, where the main content is the bit that changes on each page.
You can spot these sites a mile away with their URL's all following a similar pattern:
http://www.domain.com/index.php?page=home
There's nothing wrong with this as such, however, the issue is when the input isn't validated. First, lets see the code on index.php that pulls in our main content
Continue Reading April 21st, 2006
Next Posts
Previous Posts