John Knowles - Development Blog

PHP 5 from PHP 4 - My transition to registered globals:off

Post by: John Knowles On 2006-11-03 12:01:41

As some of you may know there are quite a few transitions between PHP 4 and PHP 5. As I have just changed hosting companies and my new host supports both PHP 4 and PHP 5 I decided to upgrade.

At first I thought this would be an easy transition (I had lured myself into a false sense of security) and uploaded my site. To my surprise non of it worked.

I looked into my code and realized it was pretty badly wrote as I didn’t name the globals I was just saying $hello rather than $_GET[hello] if I wanted to get the data from the URL.

So I set about going through all my code changing all the variables to global variables and low and behold my site was fully operational again. I then went to login to my my blog system (Which I also wrote as i’m not much of a fan of using an open source blog. which would be overkill for what I want and I also wanted to keep my site pretty simple looking) and just kept getting the HTTP Authorization login. This confused me at first but I looked at the code and did a bit of research into the $AUTH variables and added the simple $_SERVER around them. I then upload and try to login and get the same thing.

I spent hours trawling through the code trying to find where the error was and spent even longer adding error reporting systems all over the place with it but I had no success.

Today I was that sick of not being able to update my Blog I decided to write a new login script using cookies as I also get bored of having to login every time I update, when only I used my laptop.

The new login system took about 5 hours to write including debugging. I did no note planning of this script and surprisingly it worked without much major alteration. Just a tweak here and there to make it more secure.

I can now finally login to my blog and portfolio system and update.

I would post my script but it would make my home page about 5 pages long and I’m sure someone would have all too much fun ripping into it and finding a hole.






Correct use of HTML - Don't get stuck in the dark ages

Post by: John Knowles On 2006-10-30 13:06:18

The correct use of HTML is something which is being looked at more and more by developers. It is surprising how many people use HTML wrong.

From my experience of browsing the internet I would say that most of the websites on the internet are still using old standards which have been known as bad practice for 4 years or more.

The internet is constantly changing and developers / designers need to adapt with it and not get stuck in the dark ages.

The biggest problem and my pet hate is tables for layouts this is about this worst thing you can do. Tables are for displaying tabular data. Not for putting your Photoshop cut up images into a design which you call a “website”. Most of the websites out there still use tables for their layout and use attributes such as align=“center”. If you look on the W3C website or w3schools you will find a full list of the current tags and which ones are deprecated.

http://www.w3schools.com/tags/default.asp

My second pet hate is FRAMES and IFRAMES and as with tables. I am not alone many respected developers agree that frames are bad and should die a long slow painful death. The problem is people still use them. Why use such bad technology when we have beautiful languages such as ASP.NET and PHP.

All the websites I have made over the past year have all conformed to XHTML 1.0 Strict or HTML 4.01 strict. I now make all my websites validate to XHTML 1.0 strict as it conforms to a better standard.
List of Recommended Doctypes by W3C

Don’t get stuck in the dark ages keep your HTML and standards up to date.






Delicious - No not what I had for dinner

Post by: John Knowles On 2006-10-29 10:15:15

Delicious aka del.icio.us. Is a new form of searching/bookmarking. Rather than getting who is the best cooperation at SEO or with the most money from google and other search engines you find things which other people bookmark and tag them self.

The more people who bookmark them the more popular they are when you search for them. You can add people that you know/are looking for the same things as you to your network this allows you to see there bookmarks and also save bookmarks for people in your network which you think may help them.

It is completely free and when you register you need to install a program into your browser which allows you to bookmark and view your bookmarks. It installed fine into Firefox 2.0 and I’ve seen it working in IE.

I have only been using this for a few days yet I already feel the need to help it get out into the broader community.

It was featured in .NET Magazine:
.NET Article

del.icio.us website