<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Webvamp</title>
	
	<link>http://www.webvamp.co.uk</link>
	<description>Revamping the web through design</description>
	<lastBuildDate>Wed, 10 Jun 2009 11:40:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Webvamp" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Quick Code: Get the domain name in JS</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/1XzikXd4-Rc/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/quick-code-get-the-domain-name-in-js/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 11:40:26 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[get domain]]></category>
		<category><![CDATA[get domain in js]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[xhr]]></category>
		<category><![CDATA[xhr code]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=352</guid>
		<description><![CDATA[When your developing a site or online application that uses a lot of XML HTTP Requests (XHR) it's generally a good idea to use a full URL when creating a request. If you then try to re-use your code across multiple sites and domains, you will find you get errors due to posting to a different domain than the current site.]]></description>
			<content:encoded><![CDATA[<h2>When your developing a site or online application that uses a lot of XML HTTP Requests (XHR) it&#8217;s generally a good idea to use a full URL when creating a request. If you then try to re-use your code across multiple sites and domains, you will find you get errors due to posting to a different domain than the current site.</h2>
<p>Solving this problem is easy and will make your Javascript (JS) code more re-usable and easier to manage. All you need to do is create a global variable at the start of your JS file to automagically get the sites domain so you can append it to all your XHR calls.</p>
<pre><code class="javascript">
var DOMAIN = 'http://'+document.domain+'/';
</code></pre>
<p>Then just use this variable with all your XHR calls.</p>
<p>Easy!</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/1XzikXd4-Rc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/quick-code-get-the-domain-name-in-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/quick-code-get-the-domain-name-in-js/</feedburner:origLink></item>
		<item>
		<title>Things to think about when designing a logo</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/BN3tSkzsDNk/</link>
		<comments>http://www.webvamp.co.uk/blog/design/things-to-think-about-when-designing-a-logo/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 08:09:27 +0000</pubDate>
		<dc:creator>graham</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Webvamp]]></category>
		<category><![CDATA[CMYK colour palette]]></category>
		<category><![CDATA[favicon]]></category>
		<category><![CDATA[Illustrator]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[logo design]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[resolution]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=254</guid>
		<description><![CDATA[Here is a quick post which takes a look at some of the things I take into consideration when designing a logo, I&#8217;d say also looks at some of the considerations for print as well, plus it also contains what i think makes a good logo.

How will the logo be used? I feel this is [...]]]></description>
			<content:encoded><![CDATA[<h2>Here is a quick post which takes a look at some of the things I take into consideration when designing a logo, I&#8217;d say also looks at some of the considerations for print as well, plus it also contains what i think makes a good logo.</h2>
<ol>
<li><strong>How will the logo be used? </strong>I feel this is important as it probably encompasses alot of other considerations yet basically it is understanding what that end product is. I always like to take into account when designing a logo that its not just some letterhead, website, or extension to corporate stationary, yet could potentially end up on a mug, a t-shirt or an advertising board.</li>
<li><strong>Size matters?</strong> It certainly does as potentially the detail that you can get within a favicon (16px x 16px) which admittedly is an extreme example yet is different to what you get within an A1 advertising board (6733px x 10571px). I would always try to ascertain as to whether the logo has the same impact at different sizes ie is the text still legible when downsized, do you get the same detail?</li>
<li><strong>Resolution?</strong> Regardless of whether the logo is just to be used only on screen I would always advise producing the logo to print quality and that it is drawn using a vector package such as Illustrator. Usually I would try and produce work to at least 300dpi, if not 600dpi as it all depends on what various print companies require.</li>
<li><strong>Colour?</strong> I personally like to start designing a logo in just simple black and white to start with. The advantages of that is you&#8217;re producing a printable version without colour and also I think it helps to visualise the logo in a more raw state to see if the concept works. One thing I think that emphasises this point is if you study top brands ie McDonalds, Nike, Coca Cola, etc there logo can be seen with differences to colour or just general style yet is always the same design and that is what people recognise.</li>
<li><strong>How Many Colours? </strong>For any print work you should always design artwork with a CMYK colour palette and I would say this is the case when designing for a logo. Although more of a consideration for print it is important to understand how many colours are being used. I would say this from 2 perspectives as I think its important not to go too happy with colour ie such diversity and at the same time you have to understand the CMYK values and how many colours the artwork uses as well as this has cost implications.</li>
</ol>
<p>These are just some points I&#8217;ve thought of yet I&#8217;m sure that probably I&#8217;ll think of more things at a later stage and follow up this post.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/BN3tSkzsDNk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/design/things-to-think-about-when-designing-a-logo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/design/things-to-think-about-when-designing-a-logo/</feedburner:origLink></item>
		<item>
		<title>Javascript Array Functions</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/UA8Di5toJY0/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/javascript-array-functions/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 12:33:33 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript functions]]></category>
		<category><![CDATA[javascript in array]]></category>
		<category><![CDATA[javascript remove from array]]></category>
		<category><![CDATA[js array functions]]></category>
		<category><![CDATA[js functions]]></category>
		<category><![CDATA[js in array]]></category>
		<category><![CDATA[js inarray]]></category>
		<category><![CDATA[js remove from array]]></category>
		<category><![CDATA[remove from array function]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=331</guid>
		<description><![CDATA[Without using a Javascript library such as JQuery, there are very few functions built into Javascript to deal with arrays. Here are a few of my own that often come in handy when working on projects.]]></description>
			<content:encoded><![CDATA[<h2>Without using a Javascript library such as JQuery, there are very few functions built into Javascript to deal with arrays. Here are a few of my own that often come in handy when working on projects.</h2>
<h3>In Array</h3>
<p>This function checks to see if a value is in an array. JQuery has a built in function of the same name that does the same thing.</p>
<pre><code class="javascript">function inArray(value, array){
	for(var x=0;x&lt;array.length;x++){
		if(array[x]==value){
			return 1;
		}
	}

	return 0;
}
</code></pre>
<h3>Remove From Array</h3>
<p>This function removes a value from an array.</p>
<pre><code class="javascript">function removeFromArray(value, array){
	for(var x=0;x&lt;array.length;x++){
		if(array[x]==value){
			array.splice(x, 1);
		}
	}

	return array;
}
</code></pre>
<p>Simple bits of code, but of a lot of use when creating dynamic client side interfaces with Javascript. Let me know in the comments if you have any other little functions that you often use.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/UA8Di5toJY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/javascript-array-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/javascript-array-functions/</feedburner:origLink></item>
		<item>
		<title>Integrating FCKEditor to save current content with AJAX using PHP</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/VkSqbO9REPM/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/integrating-fckeditor-to-save-current-content-with-ajax-using-php/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 10:27:00 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Webvamp]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[content management system]]></category>
		<category><![CDATA[FCKeditor]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=260</guid>
		<description><![CDATA[This is a short post which basically looks at an issue I had whilst developing my own content management system in PHP. The system uses FCKEditor as a basis in which for users to edit content with. The problem stemmed from me wanting an auto save feature that saved what was currently within the FCKEditor [...]]]></description>
			<content:encoded><![CDATA[<h2>This is a short post which basically looks at an issue I had whilst developing my own content management system in PHP. The system uses <a href="http://www.fckeditor.net/" target="_blank">FCKEditor</a> as a basis in which for users to edit content with. The problem stemmed from me wanting an auto save feature that saved what was currently within the FCKEditor window. As I wanted the auto save to work on a timed basis as well it working without reloading the page i used AJAX ito help with this. The key line for getting the current content from the FCKEditor into a variable that could then be stored within a database was:-</h2>
<pre><code class="html">var VariableName = escape(FCKeditorAPI.GetInstance('FCKEditorFieldName').GetXHTML());</code></pre>
<p>Basically you just need to change the &#8216;FCKEditorFieldName&#8217; to what you have FCKEditor already set to yet this then pulled the data so that i execute it later within the AJAX script.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/VkSqbO9REPM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/integrating-fckeditor-to-save-current-content-with-ajax-using-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/integrating-fckeditor-to-save-current-content-with-ajax-using-php/</feedburner:origLink></item>
		<item>
		<title>Pad A Javascript Number</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/YbWIuw1SWgc/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/pad-a-javascript-number/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 12:33:11 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[javascript number pad]]></category>
		<category><![CDATA[js number pad]]></category>
		<category><![CDATA[js pad number]]></category>
		<category><![CDATA[js padding]]></category>
		<category><![CDATA[number pad]]></category>
		<category><![CDATA[pad number]]></category>
		<category><![CDATA[str_pad js]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=327</guid>
		<description><![CDATA[To keep design and content consistent I often pad numbers with zeros to ensure they are all the same width. There is no built in function to do this, so I wrote my own.]]></description>
			<content:encoded><![CDATA[<h2>When doing a lot of front end scripting with Javascript you often find a lot of useful functions missing and so you create your own.</h2>
<p>To keep design and content consistent I often pad numbers with zeros to ensure they are all the same width. There is no built in function to do this, so I wrote my own:</p>
<pre><code class="javascript">function pad(numNumber, numLength){
	var strString = '' + numNumber;
	while(strString.length&lt;numLength){
		strString = '0' + strString;
	}
	return strString;
}
</code></pre>
<p>Enjoy!</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/YbWIuw1SWgc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/pad-a-javascript-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/pad-a-javascript-number/</feedburner:origLink></item>
		<item>
		<title>Why use heading tags as opposed to font tags for displaying text in HTML?</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/WaIy_RpzT3c/</link>
		<comments>http://www.webvamp.co.uk/blog/design/why-use-heading-tags-as-opposed-to-font-tags-for-displaying-text-in-html/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 13:34:17 +0000</pubDate>
		<dc:creator>graham</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[document weight]]></category>
		<category><![CDATA[font tags]]></category>
		<category><![CDATA[heading tags]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[search engine optimisation]]></category>
		<category><![CDATA[web best practice]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=262</guid>
		<description><![CDATA[I pose this question as it is something that i often get asked by clients about and felt it was worthwhile talking about. Although related to clients, I think its something that people who code HTML should also give consideration. The scenario I usually find myself in is that a client wants to understand why [...]]]></description>
			<content:encoded><![CDATA[<h2>I pose this question as it is something that i often get asked by clients about and felt it was worthwhile talking about. Although related to clients, I think its something that people who code HTML should also give consideration. The scenario I usually find myself in is that a client wants to understand why the content management system I have produced just uses H1, H2, H3, etc all the way to P to style text as oppose to give a whole array of different font options that can be available.</h2>
<p>My answer to that scenario is based on a number of factors which i believe need to be thought about when using heading tags compared to font tags which are:- consistency of design, structure, accessibility, seo and document weight.</p>
<p>I would say that structure and consistency of design is the most important one as this is the factor that is visually more noticeable than any of the others to a user. Admittedly it would be fine to say that you can potentially create exactly the same styles whether you use font or heading tags, which to me is true. The difference I see with regards to the 2 ways of doing it is that the heading tags are more designed to get you to think about the content and to structure it appropriately. My trouble with font tags is that basically you can set a value for size, colour and family (ie the font name). For me in my mind this encourages you to stray away from the existing design, as potentially you can add new fonts, new colours and introduce lots of different sizing of text without really thinking too much about it. This is where heading tags have the edge as far as im concerned as there is only seven possible options so not as much leeway to go totally mad. Plus what I think helps is that fact that they are named Heading 1 ,2 ,3 ,4 5, 6 and P which gives this idea of hierarchy which is how I believe you should look at adding content within a document. This gets you to think for example I will use H1 for all titles throughout the site therefore you&#8217;re thinking about the document structure and as the H1 tag is styled within a css style sheet you also maintain a consistency throughout so a user understands that the size, colour, weight means its a title. I should make clear that yes you can go wrong with the use of headings ie if not set up correctly or used in a manner like a hierarchy yet in my opinion its more focussed on that method than font tags.</p>
<p>I expect at this stage some people will say that surely you can create font tags with classes defined within a stylesheet or set with values to behave in the same way as heading tags yet have much more of them yet still produce a document in a structured way. This is true and I wouldn&#8217;t argue with that theory at all, yet invariably I find that this isnt the case.</p>
<p>This then brings me to the next factor accessibility and how the 2 differ from each other. In this scenario accessibility is  about being able to create a readable page regardless of what technology is being used to view it. This does encompass the above points already mentionned yet what I specifically want to address is here is when a web page is viewed differently from what is the norm. The example screenshot below shows the difference between font tags defined by a stylesheet and heading tags if the css has been switched off.</p>
<div id="attachment_321" class="wp-caption alignnone" style="width: 410px"><img class="size-full wp-image-321" title="heading" src="/uploads//2009/03/heading.jpg" alt="displaying the difference between heading tags and font tags" width="400" height="380" /><p class="wp-caption-text">Displaying the difference between Heading tags and Font tags</p></div>
<p>As you can see within the picture the font tags displayed on right show the text exactly the same style, so barring for the indicators I have added you would just see one long same unformatted document. In contrast when using the heading tags this uses size to display them differently so therefore you still get a structure and makes the page more easy to read.</p>
<p>My next point is if used properly then you can get round the use of using  font tags, although I would still say that heading tags are more effective. Where the heading tag is certainly better is document weight whereby if you imagine a HTML document that contains many lines of code containing <em>&lt;font size=&#8221;2&#8243; family=&#8221;verdana, arial&#8221; color=&#8221;#000&#8243;&gt;</em> compared to <em>&lt;h1&gt;</em>, although it may not make too much difference for users with there broadband connection there certainly is a vast difference between the two methods and page loading speed should surely be a consideration.</p>
<p>It can also be said the heading tags are better for seo work as I believe that search engines use the &lt;h1&gt; and &lt;h2&gt; tags when deciding on how to index pages when crawled by search engine robots. This does potentially give it an advantage over font tags if search engine places are derived from how the document is coded.</p>
<p>These are my reasons as to why i would use heading tags and why I advise clients in the above scenario to use them.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/WaIy_RpzT3c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/design/why-use-heading-tags-as-opposed-to-font-tags-for-displaying-text-in-html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/design/why-use-heading-tags-as-opposed-to-font-tags-for-displaying-text-in-html/</feedburner:origLink></item>
		<item>
		<title>Creating One Time Download Links</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/NIzRQR3rWBY/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/creating-one-time-download-links/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 22:36:56 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[download link]]></category>
		<category><![CDATA[one time download]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[php download]]></category>
		<category><![CDATA[protect download link]]></category>
		<category><![CDATA[protected downloads]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=306</guid>
		<description><![CDATA[Creating single use or timed download links can allow websites to offer downloadable content that expires after a single download or after a set period of time. Many e-commerce sites are using these techniques to sell documents and files online.]]></description>
			<content:encoded><![CDATA[<p><strong>Creating single use or timed download links can allow websites to offer downloadable content that expires after a single download or after a set period of time. Many e-commerce sites are using these techniques to sell documents and files online.</strong></p>
<p>Graham, your other author here at Webvamp, has recently been working on a project where the client wanted to offer downloadable content to users that they could track and control access to. Due to the linking nature of the web this can be a difficult task if you just directly link to the file.</p>
<p>The user clicks on a link and views/downloads the file depending on if it can be displayed in the browser or not. Since the user is given direct access to the file, nothing is stopping them from sharing the link with other people and passing your content around to others. This is OK for free stuff, but not so great for content you are trying to sell. Directly linking to the file also makes it harder to keep statistics about how many times the file has been downloaded without crawling through your server logs.</p>
<p>In order to control access and gather information on the downloads he asked me how best to create a solution.</p>
<h3>One Time Download Links</h3>
<p>The solution is simple: <strong>offer unique download links.</strong></p>
<p>Instead of directly linking to the file you want to download, you link to a download script that controls and manages the download process. You then have full control over any downloads you offer, allowing you to:</p>
<ul>
<li>Limit the number of times a file can be downloaded.</li>
<li>Control when and for how long a download is available.</li>
<li>Gather statistics on the number of downloads.</li>
</ul>
<p>OK enough background, let&#8217;s see how to do it.</p>
<h3>Show me the code!</h3>
<p>The following code uses PHP and MySQL to offer a one time download link that lasts for 7 days. You can easily tweak it to meet your own needs and specifications.</p>
<h4>SQL</h4>
<pre><code class="sql">CREATE TABLE downloads (
	downloadkey varchar(32) NOT NULL unique,
	file varchar(255) NOT NULL default '',
	downloads int UNSIGNED NOT NULL default '0',
	expires int UNSIGNED NOT NULL default '0'
);
</code></pre>
<h4>PHP Code</h4>
<pre><code class="php">//The directory where the download files are kept - keep outside of the web document root
$strDownloadFolder = "/downloads/";

//If you can download a file more than once
$boolAllowMultipleDownload = 0;

//connect to the DB
$resDB = mysql_connect("localhost", "username", "thisismypassword");
mysql_select_db("database", $resDB);

if(!empty($_GET['key'])){
	//check the DB for the key
	$resCheck = mysql_query("SELECT * FROM downloads WHERE downloadkey = '".mysql_real_escape_string($_GET['key'])."' LIMIT 1");
	$arrCheck = mysql_fetch_assoc($resCheck);
	if(!empty($arrCheck['file'])){
		//check that the download time hasnt expired
		if($arrCheck['expires']&gt;=time()){
			if(!$arrCheck['downloads'] OR $boolAllowMultipleDownload){
				//everything is hunky dory - check the file exists and then let the user download it
				$strDownload = $strDownloadFolder.$arrCheck['file'];

				if(file_exists($strDownload)){

					//get the file content
					$strFile = file_get_contents($strDownload);

					//set the headers to force a download
					header("Content-type: application/force-download");
					header("Content-Disposition: attachment; filename=\"".str_replace(" ", "_", $arrCheck['file'])."\"");

					//echo the file to the user
					echo $strFile;

					//update the DB to say this file has been downloaded
					mysql_query("UPDATE downloads SET downloads = downloads + 1 WHERE downloadkey = '".mysql_real_escape_string($_GET['key'])."' LIMIT 1");

					exit;

				}else{
					echo "We couldn't find the file to download.";
				}
			}else{
				//this file has already been downloaded and multiple downloads are not allowed
				echo "This file has already been downloaded.";
			}
		}else{
			//this download has passed its expiry date
			echo "This download has expired.";
		}
	}else{
		//the download key given didnt match anything in the DB
		echo "No file was found to download.";
	}
}else{
	//No download key wa provided to this script
	echo "No download key was provided. Please return to the previous page and try again.";
}
</code></pre>
<p>The above code is very simple, consisting of several checks to make sure that the download key provided in the URL is valid and then the download code.</p>
<p>All you then need to do is add entries to the database that link to the downloadable files. You could do this as part of your checkout process if you are selling the downloads, or as part of a registration or form request etc. Below is a basic example.</p>
<pre><code class="php">function createKey(){
	//create a random key
	$strKey = md5(microtime());

	//check to make sure this key isnt already in use
	$resCheck = mysql_query("SELECT count(*) FROM downloads WHERE downloadkey = '{$strKey}' LIMIT 1");
	$arrCheck = mysql_fetch_assoc($resCheck);
	if($arrCheck['count(*)']){
		//key already in use
		return createKey();
	}else{
		//key is OK
		return $strKey;
	}
}

//get a unique download key
$strKey = createKey();

//insert the download record into the database
mysql_query("INSERT INTO downloads (downloadkey, file, expires) VALUES ('{$strKey}', 'onetimedownload.zip', '".(time()+(60*60*24*7))."')");
</code></pre>
<p>All you then need to do is provide a link to the download.</p>
<h3>Seeing it in Action</h3>
<p>You can see a working example of this by <a href="/demo/one_time_download_link/">downloading a zip file of this code</a>.</p>
<p>The above link will take you to another page that will provide you with a unique download link to a bundled copy of the code. This unique download link will allow you to download the content once within the next 7 days.</p>
<p><a href="/demo/one_time_download_link/">Download the Code</a>.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/NIzRQR3rWBY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/creating-one-time-download-links/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/creating-one-time-download-links/</feedburner:origLink></item>
		<item>
		<title>Why Javascript in Forms is Bad</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/1lbp9U1kp-Q/</link>
		<comments>http://www.webvamp.co.uk/blog/coding/why-javascript-in-forms-is-bad/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 00:16:55 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[bad forms]]></category>
		<category><![CDATA[degradable javascript]]></category>
		<category><![CDATA[form usability]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript forms]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=277</guid>
		<description><![CDATA[A look at how some Javascript in forms is bad and how when it's bad it can destroy customer confidence and lose you valuable sales.]]></description>
			<content:encoded><![CDATA[<h2>Maybe I have just been visiting a lot of poorly developed websites recently, but I&#8217;ve noticed a lot of sites requiring users to have JavaScript enabled to submit their forms. This is bad for many reasons especially when it&#8217;s so easy to fix.</h2>
<p>Javascript (JS) is often used with forms to ensure that required fields are filled in before letting the user submit. This can be helpful to people with slower connection speeds as it ensures they don&#8217;t have to submit a form and wait for another page to load, only to be told that a field has not been completed.</p>
<p>In many cases a JS function will be attached to the submit method of a form and then a series of checks is performed on the data before allowing the form to be submitted. Sometimes JS is used to disable a forms submit button until certain checkboxes or fields are completed, other times JS will remove the action of the form (making the form un-sendable) until data is validated and the form is submitted by a JS action.</p>
<p>In all of these cases you usually end up with a form that is un-usuable by anybody without JS and it complicates things for normal users. Remember making things accessible for disabled users, also usually benefits normal users too! </p>
<h3>Bad use of Javascript</h3>
<p>I recently stumbled upon a Jewellery e-commerce site where the search field was controlled by JS.</p>
<p><img src="/uploads/2009/03/keyword-search.gif" alt="Keyword Site Search With Error" title="Keyword Site Search With Error" width="342" height="171" /></p>
<p>With JS enabled when you hit return or clicked the search button it would check to make sure you entered a search term, but without JS you would hit search and nothing would happen. At which point you think you haven&#8217;t pressed the button and so franticly start clicking on it to try and make it work (why do people think clicking an elevator button multiple times will make it come faster?).</p>
<p>Being an e-commerce site, this immediately made me lose trust for the site and made me think about going elsewhere. This one thing may not put off all your potential customers, but four or five small things like this soon add up to make customers lose faith in the site.</p>
<p>By using Javascript on this search form, it:</p>
<ul>
<li>Didn&#8217;t allow me to complete my search&#8230;at all.</li>
<li>Left me confused for a moment as I didn&#8217;t know it wasn&#8217;t working.</li>
<li>Frustrated me.</li>
<li>Made me lose confidence in the site.</li>
</ul>
<p>All this from trying to prevent me from submitting an empty search string. The benefits certainly do not out way the negatives.</p>
<h3>So when should I use Javascript</h3>
<p>The question should not so much be &#8220;when&#8221; but &#8220;how&#8221;. Javascript should always be considered as an &#8220;Add-on&#8221;, an added feature that when available makes your site more usable and helps the user out.</p>
<p>By using degradable Javascript techniques you can safely add scripts to your webpage and still allow it to fully function for those users without.</p>
<p>A now slightly outdated Task List application called <a href="http://www.tweeto.com">Tweeto</a> that <a href="http://www.frozensheep.com">frozensheep</a> (Note: this is my company) developed does just that. It builds upon a basic working version by adding JS to make certain things faster and easier, but gracefully degrades when you have JS disabled.</p>
<p>Creating JS that gracefully degrades is very easy and just takes a little bit of forward planning and we will look at the various methods you should use in another post.</p>
<p>So for now just remember to make sure that if your site uses Javascript&#8230;that it also works without, otherwise you&#8217;re gonna piss people off.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/1lbp9U1kp-Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/coding/why-javascript-in-forms-is-bad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/coding/why-javascript-in-forms-is-bad/</feedburner:origLink></item>
		<item>
		<title>Five Things To Remember When Designing Accessible Web Pages</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/xCuyrXqhhPc/</link>
		<comments>http://www.webvamp.co.uk/blog/design/5-things-to-remember-when-designing-accessible-web-pages/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 16:08:59 +0000</pubDate>
		<dc:creator>graham</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[accessible design]]></category>
		<category><![CDATA[DDA act]]></category>
		<category><![CDATA[disability discriminations act]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=258</guid>
		<description><![CDATA[Since accessibility is a prevalent topic in web design (certainly within the UK due to the DDA act) I thought I would provide some pointers to other designers on things to consider when creating designs for accessible web pages.I&#8217;m sure some designers would argue that this is the role of the person coding the HTML [...]]]></description>
			<content:encoded><![CDATA[<h2>Since accessibility is a prevalent topic in web design (certainly within the UK due to the DDA act) I thought I would provide some pointers to other designers on things to consider when creating designs for accessible web pages.I&#8217;m sure some designers would argue that this is the role of the person coding the HTML to make the design created to work, yet from my experience I would say that the designer has just as much responsibility if not more as usually the ones who first begin production on a job and therefore decisions made at this stage will undoubtedly affect the outcome of a project.</h2>
<p>Here are just a few examples of what i look out for when designing:-</p>
<ul>
<li><strong>Understand that dynamic text (ie text not produced as a graphic) within a web page will increase and decrease</strong> and therefore try to imagine the impact that will have on other elements within a design.</li>
<li><strong>Try viewing a design without colour</strong> to see whether or not the page has an adequate contrast on elements and is still readable whilst this also gives an appreciation to the design for people who interpret colour differently or not at all. A classic example of this would be using colour as a way of identifying which section of the site you are in, could a user still understand where they are within the site if the colour wasn&#8217;t represented.</li>
<li><strong>Imagine your page without any images at all</strong> and see what you&#8217;re left with. Although physically you have no control on how text will be layed out within a browser it is important to understand whether the page has enough text and whether its structured well enough to be read, whether there are still indicators such as breadcrumbs that let you know where you are in the site and whether or not the user still has the ability to navigate around the site.</li>
<li><strong>Be aware of functionality and what it involves</strong>. For me this is probably one of the main mistakes that are made at a design stage when producing accessible pages, as usually a designer is more concerned with the aesthetics as well as providing something which looks creative. The best way to tackle this area is speak to someone who knows, yet things to specifically look out for would be does it work if:- Flash or Javascript isn&#8217;t installed? If the user doesn&#8217;t have a mouse? If the user has no sound or no embedded media player.</li>
<li><strong>Avoid causing the screen to flicker too much</strong>. This probably applies more to flash based work or animation yet mainly it&#8217;s concern is with regards to people with epilepsy and to avoid anything which could trigger a seizure.</li>
</ul>
<p>These are just a few examples that I have covered with regards to area&#8217;s that designers should give consideration. For more of an overview with regards to other guidelines I would recommend going to the W3C website and specifically the accessibility page at <a title="Link to W3C accessibility checklist" href="http://www.w3.org/TR/WCAG10/checkpoint-list.html">http://www.w3.org/TR/WCAG10/checkpoint-list.html</a>.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/xCuyrXqhhPc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/design/5-things-to-remember-when-designing-accessible-web-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/design/5-things-to-remember-when-designing-accessible-web-pages/</feedburner:origLink></item>
		<item>
		<title>Sizing Images Correctly – Part Two</title>
		<link>http://feedproxy.google.com/~r/Webvamp/~3/rjtpCdIMPRM/</link>
		<comments>http://www.webvamp.co.uk/blog/design/sizing-images-correctly-part-two/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 12:25:27 +0000</pubDate>
		<dc:creator>graham</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[image resizing]]></category>
		<category><![CDATA[photo resize]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[pixels]]></category>
		<category><![CDATA[web best practice]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web images]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.webvamp.co.uk/?p=203</guid>
		<description><![CDATA[This post follows on from what we looked at from Sizing Images Correctly - Part One and looks at another issue as to why correct image sizing is important.]]></description>
			<content:encoded><![CDATA[<h2>This post follows on from what we looked at from <a href="http://www.webvamp.co.uk/blog/design/sizing-images-correctly-part-one/">Sizing Images Correctly &#8211; Part One</a> and looks at another issue as to why correct image sizing is important.</h2>
<h3>Example Perfume Bottle Images</h3>
<p><img title="A bottle of perfume" src="/uploads//2009/03/perfume.gif" border="1" alt="A bottle of perfume" width="150" height="150" /><img title="A bottle of perfume" src="/uploads//2009/03/perfume.gif" border="1" alt="A bottle of perfume distorted by width" width="200" height="150" /><img title="A bottle of perfume" src="/uploads//2009/03/perfume.gif" border="1" alt="A bottle of perfume distorted by height" width="150" height="200" /></p>
<p>As you can see above there are 3 images of a perfume bottle which in fact are exactly the same image. The image on the far left is an original whilst the image in the middle has had the width pixels increased by <em>50px</em> and the final one on the left has been increased by <em>50px</em> in height.</p>
<p>The reason for showing these examples is to show what a difference in terms of perception it makes when images have been resized using HTML in order to fit the current system and layout. If this was potentially a product on an ecommerce site I would automatically as a user be expecting if I purchased the product a fatter or a much taller bottle from viewing the last 2 images.</p>
<p>This may seem a really obvious point to make yet I&#8217;ve seen many sites and not just ecommerce ones which contain stretched images just so that it fits nicely within the template and the design. This kind of issue can be avoided by simple spending time cropping each image or adjusting the canvas size which admittedly is a brain numbing as well as time consuming process. Admittedly for sites which contain a large number of product images there are batch image resizing programs available to download. As a worst case scenario if each image needed to be manually resized this is surely worth the effort in order to provide images with the correct perspective.</p>
<img src="http://feeds.feedburner.com/~r/Webvamp/~4/rjtpCdIMPRM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webvamp.co.uk/blog/design/sizing-images-correctly-part-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.webvamp.co.uk/blog/design/sizing-images-correctly-part-two/</feedburner:origLink></item>
	</channel>
</rss>
