Friday 13 February 2009

Doing some work on my website

This morning I did some more work on my website and also took some photos of a bird I've not seen before in the back garden.

I was trying to find a way to stop spambots picking up my email address from the website. I found a good article on all the different methods available: Methods to hide email addresses from page source. After reading this article: Hide email address from spammers it seems that hex coding email addresses doesn't work. I didn't see the point in using a javascript solution since you're still going to need your email address in the page for people who don't have javascript enabled.

In the end I cut up my email address using <span> tags and encoded part of it in ASCII Hex, part in Unicode Hex and part not encoded. I put all this as a php variable, so I just need to echo the variable when I want to print my email address. I didn't include an anchor tag with mailto: href, just it's just plain text. If I want to add the link I'll probably do that via javascript. I doubt this will actually stop spammers picking up my email, but worth a try.

After that I had some trouble getting my registration script working. Eventually I found the problem was that I was calling $id = $stmt->insert_id() when it should be $id = $stmt->insert_id (No brackets).

Then when I got the script working I noticed that the PEAR debug info for sending the registration email looked a bit weird, for the html email links it had href=3D"http://mysite.com". I checked my email and the actual email seemed to have correct links (didn't view source, just hovered over them). I googled for it and found this useful thread explaining it: <A HREF=3D"http://........". It seems it's just a term used in links in emails.

After lunch I went on Animal for about an hour, then did some more work on my website.

I was still working on getting my registration script fixed, I had some trouble with not being able to login that took me a while to work out why - it was because I'd changed the hash method from md5 to sha256, and my database field was only 32 chars, when sha256 is 64 chars.

Then I had some trouble trying to make a link so if you try and login but haven't validated your email address, you can click the link and it will send you the validation email again. I did some googling, and it seems the only way to pass POST data from one page to another is by using a form. I guess I could have used $_SESSION or $_GET variables instead.

Making the form invisible and the submit button look like a link took quite a while, and then I decided to try and style my error messages. I googled and found this very nice tutorial: CSS Message Boxes for different message types, so I basically just copied the error box they'd done. I looked through my pog images to see if there was a suitable pogman picture to use for an error icon, but couldn't really see one, so I decided to just make a standard style error icon.

After dinner I finished making my error icon (just an exclamation mark in a triangle), then put it in the error message box. While I was looking for examples of icons, I found this page that has a lot of examples: Web 2.0 Icons.

After that I made a tick in a green box (success) icon and added some css to my site to style the success messages (again, based on CSS Message Boxes for different message types. Then I did some googling to see if I could find any other good examples of error/success messages styling.

The weather today was sunny most of the day, but a bank of cloud built up in front of the sun at sunset, so there wasn't much of a sunset.

Food
Breakfast: Pink grapefruit marmalade toast sandwich; cup o' tea.
Lunch: Breaded ham with crunchy salad sandwich; apple; milk chocolate fake kitkat; cup o' tea.
Dinner: Battered fish portion; peas; potatoes; salt; ground black pepper. Pudding was a small apple pie with custard. Coffee.

No comments: