Featured Posts

Getting into Java... I'm starting to make my first Java applications with the aim of being able to program cell phone API and other handheld technologies. I see this as a huge market in years to come and can wait to get my...

Read more

Teaching Intro to Flash at Tunxis Again Looks like I'll be teaching at Tunxis again this semester. Can't wait to get started again as I have a lot of fun the last time we did this. The class is going to be restructured slightly to showcase the...

Read more

The difference between classic and motion tweens in... Here it is: If you're used to doing things "the cs3 way" then you can continue to do so with the classic tween tool. It works the same way as you remember, using key frames as normal, but you cannot...

Read more

PHP: If (equal to AND not equal) - eliminate form spam... Just learned a great function of PHP thats already made my forms a lot better. A while back I wrote an article about eliminating form spam without captchas by using css to hide a text input box for bots...

Read more

Drop Downs, Fly Outs, and Accordion Site Navigation: This last week I was in a meeting discussing a client site. It was a typical business meeting that was going into overtime on a Friday afternoon, and then things turned for the worst... someone suggested...

Read more

twitter

Breaking News

  •  

10 Transition Effects: The art of Showing/Hiding Content

Category : Art & Design, Slick Code

Great archive of different show/hide effects using JQuery, which I gotta say is quickly becoming the new “Flash” of the internet. You dont need a special player for JQuery and it interacts (and even plays nice) with other non JQuery elements, something Flash can never do.

http://devsnippets.com/article/10-transition-effects-the-art-of-showinghiding-content.html

Check out whats possible and then start learning JQuery.

7 Principles Of Clean And Optimized CSS Code

Category : CSS, Slick Code

http://www.smashingmagazine.com/2008/08/18/7-principles-of-clean-and-optimized-css-code/
This is another post from SmachingMagazine. The principles are a pretty good standard ruleset.

#1 (shorthand CSS) is key. I opt for the least amount of whitespace as I can as some of the CSS files I write for larger sites still have a few hundred lines. This is without the IE 6 hacks, which are in a separate CSS file, which they recommend in #2. This allows your code to validate and also be condensed. Both good things.

Thank you Tony White.
Enjoy!

PHP: If (equal to AND not equal) – eliminate form spam without using a captcha

Category : Featured, Slick Code, Technology

Just learned a great function of PHP thats already made my forms a lot better. A while back I wrote an article about eliminating form spam without captchas by using css to hide a text input box for bots to fill in. By giving the input box a legit sounding name like “email” the bots fall for the trap and the php handler discards their form entry results.

The only problem was that I still got blank entries every now and again from people using their back button, or search engine spiders. You could also trick the validation script by surfing with java turned off . And while I still dont know exactly which one of the above was the cause I have an ultimate solution.

The equal to and not equal to feature in PHP.

Instead of:

if ($test == "") {
mail($mailto, $mailsubj, $mailbody, $mailhead);
}

We use:

if ($test == "" && $email != "") {
mail($mailto, $mailsubj, $mailbody, $mailhead);
}

This little change not only checks to see that there is nothing in the hidden field but also checks to see that there IS something in the email field. As the email is required this is nothing new, but will dump all the blank entries I’ve been getting.

FYI:
&& = = and
!= = not equal to

Cross Brower Css Footer -tested and true

Category : Slick Code, Technology

For one of my soon to be released projects I was asked to create a footer background image that was stuck to the bottom of the website or broswer window. Finding a cross browser css footer was a pain, and inplementing it took some trial and error with the numbers but it worked!

Thanks going to:
http://ryanfait.com/sticky-footer/
For his great tutorial on the subject, and his solution.

A more graphical tutorial can be found here: http://fortysevenmedia.com/blog/archives/making_your_footer_stay_put_with_css/

Form spam: BE GONE!

Category : Coding and Database, Slick Code, Technology

I started getting emails last month from the forms on one of my client’s websites. The spam came as a long string of links in the comments section of one of the forms. The idea for this type of spam is, I think, to boost search engine ranking by increasing the clicked rate to your site. It is easy enough to detect and delete but still, its quite a pain to delete 10-12 emails a day. Not to mention there is a more malicious form of form spamming that I was lucky enough not to have been attacked by where the spammer inputs php code into the form fields which tricks your mail server into sending bogus messages from your return address. This has had the effect of some sites being blacklisted from search engines for spamming, but I hear that google and others are going to be lenient on this in response to the rise in form spam in the recent months.

So there was the worst case scenario and to avoid it all together we needed to add some sort of form validation. Client side java script could be used, but if the spammer simply turned off java script, we’d me back to a naked form, so although useful to make sure humans are using real email addresses (with the @ symbol) it would be useless to stop a bot.

The next step would be to use a captcha, but I hate these things and good OCR software can read them better then people with poor eye sight so this isn’t the best answer either. New captchas are evolving into fill in the blanks, picture description, and general questions (“whats the letter after b?”). Machines will not understand the question and thereby cannot guess the answer.

But still, this is slightly intrusive because it requires the user to think. Sometimes that’s enough to put people off. I wanted a solution that eliminated bot generated spam without encumbering the real users at all.

My solution was code the PHP mailto into an if statement that checked the value in a hidden field. If anything had been entered into this field then we can deduce that it was not filled out by a human (who would never see this field) so the request fails the php if statement and the mail command is never fired.

However, the PHP code will still look like the page email was sent. This is important as it lets the spammer think everything has worked. After putting this into play spam on our forms has effectively ended. I say effectively because I read somewhere that some people actually sit an copy and paste this sort of junk into forms by hand. What a waste. No one reads it anyway.

I just wanted a solution that freed up my client without affecting his customers.

The HTML/CSS looks like this:
<input style=”display:none” type=”text” id=”email” name=”email”>

PHP:
$test = $_POST["email"];

if ($test == “”) {
mail($mailto, $mailsubj, $mailbody, $mailhead);
}

Currently I’m working on a great book by: Steve Krug called Don’t Make Me Think.

 Update: August 1st, 2008:
To eliminate the “random blanks” I got from users pressing the back button and non javascript browsers I modified the above code to include a few more conditions. Read the next article on using the IF equal to AND not equal to function in php to find out more.