My Twitter

Innovation of the week #1

February 16th, 2009

Innovation of the week is were I share some of the really innovative designs, coding or ideas which are new to the web.

Bore Me Lunchtime Shuffle – View

untitled-3

Between 12pm and 2.30pm Bore Me plays 5 videos back to back, so you can sit back and eat your lunch while having a giggle. However, it only works around lunchtime (unless you change your computers clock). If they added a “It’s not lunch, but show anyway” button it would be a lot better.

Innovation Rating: 3/5
A great idea, design and execution lets it down.

Securing Links

February 14th, 2009

Have you ever wanted to secure links on your website (for example hide the real source of a file)? Here is a quick and easy way to do this.

<?php # File created on 11th February 2009 by Mike Rogers (http://www.fullondesign.co.uk/). 

## Start defining constants ## 

define(RUN_ERRORS, TRUE); // Do you want the script to display errors? TRUE = yes you do.

define(redirect_or_echo, 'redirect'); // Do you want to redirect the user to another website, or just echo the other other webpages' content. 'rediect' will redirect, 'echo' will return the web pages constents. I recommend redirect.

## End defining constants ##

/* Start the link codes. The code is the ?code=123 part of the URL. The array should be fotmatted like:

$link['code'] = 'http://URL';

You may find it easier to do this with MySQL or including this as a seperate file. Too many links could lower performance, but for a small website just trying to cloak a few links this is good :) 

*/

$link['1'] = 'http://www.site.com/';

// Start the system.

function external_url($url){

    if($return = @file_get_contents($url)){

        return $return;

    }elseif(function_exists("curl_init")){

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_HEADER, 0);

        curl_setopt($ch, CURLOPT_TIMEOUT, 10);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

        $return = curl_exec($ch);

        curl_close($ch);

        return $return;

    }elseif($return = @implode("", @file($url))){

        return $return;

    } else {

        return NULL;

    }

}

// Checks if the code is a number

if(is_numeric($_GET['code']) && is_array($link)){

    if(isset($link[$_GET['code']])){

        if(redirect_or_echo === 'redirect'){

            header('location: '.$link[$_GET['code']]);

        } elseif(redirect_or_echo === 'echo'){

            echo external_url($link[$_GET['code']]);

        }else{

            if(RUN_ERRORS === TRUE){

                echo 'Sorry, an internal error has occoured.';    

            }

        }

    } else {

        if(RUN_ERRORS === TRUE){

            echo 'Sorry, the code you have provided is incorrect.';    

        }

    }

}else{

    if(RUN_ERRORS === TRUE){

        echo 'Sorry, the code you have provided is incorrect.';    

    }

}

/*

You are free to share, modify and use this code for commercial uses. Please give a link back (to http://www.fullondesign.co.uk/ ) if you can, but you don't have you.

You use this at your own risk.

*/

?>

Download the Code

Useful Links

PHP’s Offical Website – It has a fantastic documentation section. Well worth a look.
PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide – The book I learnt PHP from, it’s really good for beginners and reference guide.

Simple PHP Page View Counter

February 11th, 2009

This is a really quick & easy piece of PHP code to count the page views. It’s not fantastic (It lacks any real tracking abilities), but for some things it does the trick.

The Theory

Every time someone views a page, PHP will increase a number stored in a file by 1. If we want to see how many people have view that page, we just check the file.

The Code

<?php # File created on 11th February 2009 by Mike Rogers (http://www.fullondesign.co.uk/). 

## Start defining constants ## 

define(RUN_ERRORS, TRUE); // Do you want the script to display errors? TRUE = yes you do.

define(LOG_URL, '/home/user/logs/'); // Put the location of where you want to put the logs. Make sure this is absolute

$filename = rawurlencode(base64_encode($_SERVER['PHP_SELF'])); // Takes the filename then makes it network safe.

## End defining constants ##

## Parse filename ##

$filename = LOG_URL.$filename.'.log.txt';

##

// Check that the file exists, encase of the logs being removed or being invalid.

if(is_writable($filename) && is_readable($filename)){

        // We should be able to read and write it

        $file_contents = file_get_contents($filename);

        // Check its a number, the logs could have been hacked at some point.

        if(is_numeric($file_contents)){

            $file_contents = $file_contents + 1; // Adds 1 to the current number in the log. $file_contents++; would also work.

            file_put_contents($filename, $file_contents);

        }else{

            if(RUN_ERRORS === TRUE){

                echo 'File ('.$filename.') contents is not numeric';

            }

        }

} else {

    // We should create the file if we can.

    if(is_dir(LOG_URL) && is_writable(LOG_URL) && !file_exists($filename)){ // Checks that the LOG_URL is a wriable directory, and the file does not already exist.

        // lets create the file.

        file_put_contents($filename, '1');

    }else{

        if(RUN_ERRORS === TRUE){

            echo 'Cannot/write find directory/file ('.$filename.')';

        }

    }

}

/* Here is how to show how many people have view the file */

echo ('This file has been view by '.file_get_contents($filename).'  people');

/*

You are free to share, modify and use this code for commerical uses. Please give a link back (to http://www.fullondesign.co.uk/ ) if you can, but you don't have you.

I claim no liability for this code, you use it at your own risk.

*/

?>

Download the Code

Useful Links

PHP’s Offical Website – It has a fantastic documentation section. Well worth a look.
PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide – The book I learnt PHP from, it’s really good for beginners and reference guide.

Internet Statistics – January 2009

February 9th, 2009

Browser Statistics

jan-09-browser-stats

FF (33.27%) and IE7 (36.51%) are almost equal in market share.

Biggest Rise: Safari (1.46%)
Biggest Fall: FF (-1.81%), but closely followed by IE6 (-1.18%).

OS Statistics

jan-09-os-statsWinXP is still a very dominant OS even though it had a -1.53% fall.

Biggest Rise: Vista (1.13%)
Biggest Fall: WinXP (-1.53%)

Internet Penetration

jan-09-internet-penetration

North America currently has the largest penetration percentage (73.6%)

Internet Usage

jan-09-internet-usage2Asia currently has the highest internet usage.

7 Essential WordPress Plugins

February 8th, 2009

WordPress is fantastic, one of its main strengths is it’s expandability. WordPress has thousands of plugins, however most of these plugins are a big waste of disc space. Here are some actually useful plugins for wordpress.

WP Super Cache
One of the most essentially plugins you will ever need on wordpress, this plugin decreases load per page (by caching the content) which improves your websites performance and can lower server costs. This plugin is especially nessessary if your blog is running on a low quality server or you receive high volumes of traffic.

TinyMCE Advanced
TinyMCE is the editor used in wordpress, however in wordpress it has been set up lacking quite a few features. This plugin lets you add more features to the editior.

untitled-8

Akismet
Spam comments are a real pain in wordpress, however this plugin sifts through your comments looking for spam. This can keep your blog on tip-top condition which should improve your rankings.

Google XML Sitemaps
XML sitemaps are very important when it comes to SEO, however creating them and keeping them up-to-date is a hassle. This plugin keeps your sitemap up-to-date.

Sociable
Everyone like sharing (especially when it generates you more traffic), this plugin adds links to digg, delicious and other social sharing websites at the bottom of your posts (see below).

StatPress
Any good webmaster will tell you that ‘Knowing your visitors is useful’, this plugin analyses where your clients comes from and also generates pretty graphs.

untitled-4

WordPress Automatic Upgrade
This is one of these plugins which is more of a time saver, then a essential. But if your anything like me (too lazy to spend 2 minutes updating some files) this plugin will be a life saver.