Comus Productions BBD Ninjutsu Video

Date: 30th October 2008 at 11:23 pm | Filed under: video | Author: Sam Burdge

I recently edited this cool ninjutsu video for BBD Ninjutsu / Comus Productions. And yes those are real weapons!!


Leave a Comment

Automatic Email Address Protection PHP / JavaScript

Date: 27th October 2008 at 7:44 pm | Filed under: development, scripts | Author: Sam Burdge

It is important to protect email addresses on websites from being harvested by spambots.

"Email spambots collect e-mail addresses from the Internet in order to build mailing lists for sending unsolicited e-mail, also known as spam. Such spambots are web crawlers that can gather e-mail addresses from Web sites, newsgroups, special-interest group (SIG) postings, and chat-room conversations. Because e-mail addresses have a distinctive format, spambots are easy to write. A number of legislators in the U.S. are reported to be devising laws that would outlaw the spambot." – Wikipedia

This is my method for automatically detecting email addresses and replacing them with a javascript that will disguise them from spambots. The script works in two stages one in javascript and the other in php.

First the javascript function that outputs the mailto link:

function sb_email(user,site){
document.write('<a href=\"mailto:' + user + '@' + site + '\">');
document.write(user + '@' + site + '<\/a>');
}

The function has 2 parameters "user" and "site", which are the two parts of the email address either side of the "@". This function can be called like so:

sb_email('joe','bloggs.com');

The second part is the php functions that recognise email addresses and replace them with the javascript function to disguise them:

//function to output the js
function create_js ($matches){
$parts = explode ('@', substr ($matches[0], 1));
if(substr($parts[1],-1)=='.'){$parts[1]=substr($parts[1],0,-1); $parts[2]='.';}
$str = $matches[1].'<script language="JavaScript" type="text/javascript">';
$str .= 'sb_email("'.$parts[0].'", "'.$parts[1].'");';
$str .= '</script>'.$parts[2];
return $str;
}
$js_callback = "create_js ";
 
//function to recognise emails
function email_protect($text){
global $js_callback;
$replace = '/([> ])[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}/i';
$output = preg_replace_callback($replace, $js_callback, $text);
return $output;
}

The email_protect php function can be called on any text string like so:

echo email_protect($text);

It will automatically replace any email addresses in the text with the javascript, therefore hiding them from spambots.

Leave a Comment

Montague Wood Floors Website

Date: 27th October 2008 at 6:54 pm | Filed under: portfolio | Author: Sam Burdge

This flash website built for Montague Wood Floors features a sliding "floorboard" style image gallery with numbered navigation. The image galleries can be filtered by job. Site design by Becky Sinden.

Check it out: www.montaguewoodfloors.com

Leave a Comment

Style highlighted / selected text - CSS Tutorial

Date: 26th October 2008 at 12:56 pm | Filed under: scripts | Author: Sam Burdge

Ever wondered how to change the default style of highlighted or selected text in your html page? I have found that this is possible using CSS3, although IE has no support for this so it doesn't work at all in IE.

In this example the background is set to green and the text set to white. Drag over this text to highlight it.

Here's the CSS:

/* Safari */
::selection {
background: #000000;
color: #ffffff;
}
/* Firefox */
::-moz-selection {
background: #000000;
color: #ffffff;
}

::selection is supported by the latest versions of Opera and Firefox 2 and upwards. ::-moz-selection is supported by the latest versions of Safari.

Leave a Comment

Control Arms Flash Viral Game

Date: 22nd October 2008 at 8:09 pm | Filed under: flash, portfolio | Author: Sam Burdge

This viral game built for controlarms.org is my most recent Flash project. The game has been translated into 4 other languages – French, Spanish, Potugese and Arabic. The object of the game is to catch as many bombs in the dustbin as you can before 5 drop. Once completed you can follow the "Take Action" link to lobby your MP in the form of an email.

Check it out: www.controlarms.org/en/games/catch-bombs

Leave a Comment