<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Hayden Kibble</title>
	<atom:link href="http://www.haydenkibble.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.haydenkibble.com</link>
	<description>PHP-SEO-IM-DESIGN</description>
	<lastBuildDate>Fri, 07 May 2010 19:10:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Basic SQL Injection Tutorial</title>
		<link>http://www.haydenkibble.com/2010/05/basic-sql-injection-tutorial/</link>
		<comments>http://www.haydenkibble.com/2010/05/basic-sql-injection-tutorial/#comments</comments>
		<pubDate>Fri, 07 May 2010 18:54:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP/MySQL/AJAX]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=57</guid>
		<description><![CDATA[In my time I&#8217;ve seen a few pieces of insecure code. Considering what clients can pay for a bespoke eCommerce or CMS solution, you&#8217;d expect at least a basic level of security. Unfortunately there&#8217;s one oversight that crops up time and again. The SQL Injection vulnerability. Despite being a huge threat to your security, SQL [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/sql-injection-150x150.jpg" alt="sql-injection" title="sql-injection" width="150" height="150" class="alignright size-thumbnail wp-image-63" />In my time I&#8217;ve seen a few pieces of insecure code. Considering what clients can pay for a bespoke eCommerce or CMS solution, you&#8217;d expect at least a basic level of security. Unfortunately there&#8217;s one oversight that crops up time and again. The SQL Injection vulnerability. Despite being a huge threat to your security, SQL injection holes are simple to prevent.</p>
<p>Trusting <em>anything</em> the client sends is a bad idea. ALWAYS assume the worst and sanitise GET or POST variables before using in an SQL call. Below is an example of some code that you may use when a user logs in:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id FROM users WHERE username='<span style="color: #006699; font-weight: bold;">$username</span>' AND password='<span style="color: #006699; font-weight: bold;">$password</span>' &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">...</span></pre></td></tr></table></div>

<p>The code above compares the username and password (submitted from a standard HTML form) to the database. If both match, then the script would go on to log the user in. The actual SQL call made to the database may look something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> id <span style="color: #993333; font-weight: bold;">FROM</span> users <span style="color: #993333; font-weight: bold;">WHERE</span> username<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'johnsmith'</span> <span style="color: #993333; font-weight: bold;">AND</span> password<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'mypass'</span></pre></td></tr></table></div>

<p>Now, rather than &#8216;johnsmith&#8217;, should the username contain the following&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;">johnsmith<span style="color: #ff0000;">'#</span></pre></td></tr></table></div>

<p>The entire SQL call made to the database would look like so&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> id <span style="color: #993333; font-weight: bold;">FROM</span> users <span style="color: #993333; font-weight: bold;">WHERE</span> username<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'johnsmith'</span><span style="color: #808080; font-style: italic;">#' AND password='mypass'</span></pre></td></tr></table></div>

<p>Since MySQL treats everything after the hash (#) symbol as a comment, it&#8217;s actually only checking the username and not the password. The hacker can now log in as John without knowing the password! Even worse, the hacker need only guess the username of the administrator to log in as him too!</p>
<p>This is SQL injection in it&#8217;s most basic form. It can easily be worked on to spit out sensitive data to the screen, insert new rows (user accounts), delete data, edit data and more.</p>
<p>A simple solution to this problem would simply be to use PHP&#8217;s addslashes() function like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id FROM users WHERE username='&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">addslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' AND password='&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">addslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' &quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=57" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2010/05/basic-sql-injection-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online MD5 Hasher/Cracker</title>
		<link>http://www.haydenkibble.com/2009/07/online-md5-hashercracker/</link>
		<comments>http://www.haydenkibble.com/2009/07/online-md5-hashercracker/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:36:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP/MySQL/AJAX]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=53</guid>
		<description><![CDATA[If you&#8217;ve ever worked with a PHP/MySQL application which handles user logins, then you will have worked with MD5 Hashes. An MD5 is a one-way encryption algorithm commonly used by web applications to store passwords.
When a new user creates an account, their password is &#8216;hashed&#8217; using MD5 and the hash is stored along with their [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/cracker-150x150.jpg" alt="Cloud Cracker" title="Cloud Cracker" width="150" height="150" class="alignright size-thumbnail wp-image-55" />If you&#8217;ve ever worked with a PHP/MySQL application which handles user logins, then you will have worked with MD5 Hashes. An MD5 is a one-way encryption algorithm commonly used by web applications to store passwords.<br />
When a new user creates an account, their password is &#8216;hashed&#8217; using MD5 and the hash is stored along with their username in the database. When they attempt to login in the future, their entered password is hashed and compared to the hash in the database. If they match, they are authenticated. This is great as the password does not have to be visible in the database.</p>
<p>If you forget your admin password when developing an app and haven&#8217;t coded a &#8216;reset your password&#8217; part yet (I always code these boring bits last!) you have 2 choices. You can create a new MD5 hash and replace the one in the database, or you can &#8216;crack&#8217; the hash to find out your password. But how?</p>
<p>Enter Cloud Cracker, the <a href="http://www.cloudcracker.net">free online MD5 hasher/cracker</a>. This nifty little tool will take any password and give you it&#8217;s MD5 hash. It will also attempt to &#8216;crack&#8217; an entered hash and show you the plaintext password.</p>
<p><a href="http://www.CloudCracker.net">Click Here to check out Cloud Cracker now.</a> and feel free to hit the &#8216;Digg&#8217; button if you like it.</p>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=53" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/07/online-md5-hashercracker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What is AJAX?</title>
		<link>http://www.haydenkibble.com/2009/07/what-is-ajax/</link>
		<comments>http://www.haydenkibble.com/2009/07/what-is-ajax/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 13:13:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP/MySQL/AJAX]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=46</guid>
		<description><![CDATA[What is AJAX?
If you find yourself asking this question then you&#8217;re either new to PHP/Javascript or you have been hiding under a rock for the past three years.
Since around 2006, the term/buzzword &#8216;AJAX&#8217; has been thrown around like a frisbee in a playground. So what exactly is AJAX?
If you&#8217;ve had an auto-suggest bubble pop up [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/ajax_small-150x150.jpg" alt="Ajax" title="Ajax" width="150" height="150" class="alignright size-thumbnail wp-image-48" />What is AJAX?<br />
If you find yourself asking this question then you&#8217;re either new to PHP/Javascript or you have been hiding under a rock for the past three years.<br />
Since around 2006, the term/buzzword &#8216;AJAX&#8217; has been thrown around like a frisbee in a playground. So what exactly <em>is</em> AJAX?</p>
<p>If you&#8217;ve had an auto-suggest bubble pop up as you&#8217;re searching, or if you&#8217;ve seen form sub-sections magically appear as you choose options, then you have already used AJAX. Slow, static web pages have given way to speedy, animated interfaces with more nifty features.</p>
<p>Some examples of what you can achieve with AJAX include:</p>
<ul>
<li>Auto-suggest popups</li>
<li>Form elements appearing/hiding as you complete the form</li>
<li>Slider controls</li>
<li>Draggable/droppable content</li>
</ul>
<p>The term AJAX stands for &#8216;Asynchronous Javascript And XML&#8217;. Technically, AJAX is when javascript sends requests back to the server, receives a response in XML and acts upon it. These days though, AJAX is used more of a blanket term of for anything interactive which uses javascript.</p>
<p>If you have been developing PHP and looking to take your applications to the next level of interactivity, then check out some of the nifty AJAX Javascript frameworks out there that do all the hard work for you:</p>
<ul>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://mootools.net/">Mootools</a></li>
<li><a href="http://www.prototypejs.org/">Prototype</a></li>
</ul>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=46" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/07/what-is-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google likes standards compliance</title>
		<link>http://www.haydenkibble.com/2009/07/google-likes-standards-compliance/</link>
		<comments>http://www.haydenkibble.com/2009/07/google-likes-standards-compliance/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 18:25:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[compliance]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=30</guid>
		<description><![CDATA[One thing I love about the SEO world is that it&#8217;s not an exact science. Just about every man and his dog have their own idea about what Google likes and hates.
I think we&#8217;re all agreed on the fact that relevant, contextual links from related so-called &#8216;authority&#8217; sites are good stuff. Generous use of your [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/standards-compliance-150x150.jpg" alt="standards compliance" title="standards compliance" width="150" height="150" class="alignright size-thumbnail wp-image-36" />One thing I love about the SEO world is that it&#8217;s not an exact science. Just about every man and his dog have their own idea about what Google likes and hates.</p>
<p>I think we&#8217;re all agreed on the fact that relevant, contextual links from related so-called &#8216;authority&#8217; sites are good stuff. Generous use of your keywords through your title tag, header tags and page content are also top of the list in our SEO agendas.</p>
<p>Well, what then? What else can we do to be Google&#8217;s best friend? Some recent theories have been thrown about such as:</p>
<ul>
<li>Get contact us, terms and about us pages</li>
<li>Add a quick blog to your site and other &#8216;bulking&#8217; things</li>
<li>Put your keywords into image ALT tags</li>
</ul>
<p>But I&#8217;ve never heard anyone state the importance of making your sites (X)HTML compliant. I am confident that the big &#8216;G&#8217; sees this as a big deal, but Nobody seems to have noticed. Just look how clear Google makes this point in their <a href="http://google.com/support/webmasters/bin/answer.py?answer=35769">webmaster guidelines</a>:</p>
<blockquote><p>Check for broken links and correct HTML</p></blockquote>
<p>Easy to overlook, but even easier to adhere to. Simply let the W3C&#8217;s <a href="http://validator.w3.org/">free online validator</a> take a look at your page and tell you how to fix it. Job done!</p>
<p>And in case you&#8217;re wondering, <a href="http://validator.w3.org/check/referer">of course I have</a> <img src='http://www.haydenkibble.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=30" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/07/google-likes-standards-compliance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make Your Phone &#8216;Kerching&#8217; When You Make A Sale</title>
		<link>http://www.haydenkibble.com/2009/07/make-your-phone-kerching-when-you-make-a-sale/</link>
		<comments>http://www.haydenkibble.com/2009/07/make-your-phone-kerching-when-you-make-a-sale/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 19:23:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Internet Marketing]]></category>
		<category><![CDATA[PHP/MySQL/AJAX]]></category>
		<category><![CDATA[affiliate]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[kerching]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sale]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=15</guid>
		<description><![CDATA[Being the egotistical git I am, I wanted my phone to make a &#8216;kerching&#8217; sound each time I made an affiliate sale. Nothing beats dozing off on a lazy Sunday evening and hearing your cash register ring out. Here&#8217;s how I made it happen&#8230;
First, you need to receive an email each time you make a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/cash-register-150x150.jpg" alt="cash-register" title="cash-register" width="150" height="150" class="alignright size-thumbnail wp-image-33" />Being the egotistical git I am, I wanted my phone to make a &#8216;kerching&#8217; sound each time I made an affiliate sale. Nothing beats dozing off on a lazy Sunday evening and hearing your cash register ring out. Here&#8217;s how I made it happen&#8230;</p>
<p>First, you need to receive an email each time you make a sale. If your affiliate network will do this, then the first bit is already done. If not, copy the script below into a php file called something like  &#8216;xml-to-email.php&#8217; and upload it to your web server. Full instructions are in comments at the top of the file. You will most likely have to change the regex variable to work with your affiliate network&#8217;s own feed format.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* #########################################################
&nbsp;
Email When You Make a Sale
Developed by Hayden Kibble July 2009
Hayden@HaydenKibble.com
www.HaydenKibble.com
&nbsp;
Install instructions:
1. Put your affiliate network login and your email details into the variables below
2. You will probably have to edit '$regex_saletime' to match the sale time/date for your paticular aff networks xml feed
2. Upload this file to your web server.
3. Create a file called 'sales.txt' in the same directory as this script and make sure it has read/write permissions
4. Visit the page and it should show a blank page. An email will probably be sent as it picks up all your recent sales
5. Set a cron job up on your web server to run this script every 10 mins or so
6. If you have problems with any of the above, Google is your friend!
&nbsp;
######################################################### */</span>
&nbsp;
<span style="color: #000088;">$base_url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;https://www.affilliate-network.com/myfeed.xml&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed_user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;USERNAME-HERE&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed_pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PASSWORD-HERE&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$regex_saletime</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/&lt;date&gt;(.*)&lt;\/date&gt;/U&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$email_from</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;from@address.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$email_to</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;to@address.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$email_subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;You Made a Sale!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ##### Do Not Edit Below This Line! #####</span>
&nbsp;
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$base_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set your login and password for authentication</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERPWD<span style="color: #339933;">,</span> <span style="color: #000088;">$feed_user</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">':'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$feed_pass</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HTTPAUTH<span style="color: #339933;">,</span> CURLAUTH_ANY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// get the data and close the session</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error Getting Feed.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$dates</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$regex_saletime</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span><span style="color: #000088;">$dates</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Read previous sales times from database</span>
<span style="color: #000088;">$fileData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myFile</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;sales.txt&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fh</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myFile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fileData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Split the file into lines</span>
<span style="color: #000088;">$fileLines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$fileData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$newsale</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$fh</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myFile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;can't open file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// See if this sale has already been logged. If not, log it and set 'new sale' variable</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dates</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span><span style="color: #339933;">,</span><span style="color: #000088;">$fileLines</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$newsale</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sale_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$date</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$newsale</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email_to</span><span style="color: #339933;">,</span><span style="color: #000088;">$email_subject</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;You have made a sale.<span style="color: #000099; font-weight: bold;">\n</span>Sale Time: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sale_time</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;From: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$email_from</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>To test, empty the  sales.txt file you created and run (access) the script. It will see your recent sales have not been logged and fire off the email. Make sure the email does not go to your junk folder.</p>
<p>If you want your computer to play a &#8216;kerching&#8217; upon making a sale, you can simply set up a rule in Microsoft Outlook to play the sound upon receiving an email with &#8216;Payment Received&#8217; in the subject. You get the idea.</p>
<p>For those of you who want the full-on portable cash register, continue on to create a gmail account with a difficult to guess name <em>just for these emails</em>. If you share this address <em>anywhere</em> it will get spammed. We do not want this as you will start hearing an awful lot of incorrect kerching&#8217;s!</p>
<p>You now need to set your phone up to use your gmail account. Make it check for new emails every 10 mins or so (depending on how often you set your cron job to run the script) and set <a href="http://www.haydenkibble.com/downloads/kerching.wav">this kerching wav</a> as your notification sound.</p>
<p>You are now set! When the php script runs intermittently on the cron job, it parses the feed for new sales. When it finds a new sale it sends an email to your phone, which plays a &#8216;kerching&#8217; sound on receipt!</p>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=15" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/07/make-your-phone-kerching-when-you-make-a-sale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.haydenkibble.com/downloads/kerching.wav" length="12384" type="audio/x-wav" />
<enclosure url="http://www.haydenkibble.com/downloads/kerching.wav" length="12384" type="audio/x-wav" />
		</item>
		<item>
		<title>Never Trust Adwords Conversion Tracking</title>
		<link>http://www.haydenkibble.com/2009/07/never-trust-adwords-conversion-tracking/</link>
		<comments>http://www.haydenkibble.com/2009/07/never-trust-adwords-conversion-tracking/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 14:08:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Internet Marketing]]></category>
		<category><![CDATA[adwords]]></category>
		<category><![CDATA[affiliate marketing]]></category>
		<category><![CDATA[tracking]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=7</guid>
		<description><![CDATA[As any affiliate marketer knows, it&#8217;s a numbers game. You need to track, tweak and split-test your way to success.
99% of affiliate marketers don&#8217;t track which of their adwords ads are profitable and which are losing them money. That&#8217;s why 99% of affiliate marketers fail.
In theory, Adwords conversion tracking is the perfect solution. It allows [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/conversion-tracking-150x150.jpg" alt="conversion-tracking" title="conversion-tracking" width="150" height="150" class="alignright size-thumbnail wp-image-35" />As any affiliate marketer knows, it&#8217;s a numbers game. You need to track, tweak and split-test your way to success.</p>
<p>99% of affiliate marketers don&#8217;t track which of their adwords ads are profitable and which are losing them money. That&#8217;s why 99% of affiliate marketers fail.</p>
<p>In theory, Adwords conversion tracking is the perfect solution. It allows you to track not just what adgroups or ads are converting, but even the keywords leading to sales. I fell in love with Adwords conversion tracking as I knew it would lead to my success. The reality, however, is that it does not manage to register every conversion every time. In fact, in my experience, it only manages to register 50%. This is due to a number of reasons, which include:</p>
<ul>
<li>Adwords uses Javascript to track conversions.</li>
<li> Not everyone has javascript enabled or even installed.</li>
<li>Adwords uses a 30 day cookie. If your affiliate network uses a 45 or 60 day cookie, it will not track conversions after the 30 days. Similarly, if your affiliate network uses a short cookie like, Adwords will track extra conversions</li>
<li>The visitor may close the &#8216;purchase complete&#8217; page with the tracking code installed before it has fully loaded. Adwords won&#8217;t catch the sale.</li>
<li>A customer could bookmark the page with the tracking code installed, causing it to be fired when they return</li>
</ul>
<p>Suddenly, it seems that beautiful dream of knowing the exact ROI of each ad group, ad and keyword may be just another busting bubble in the over-hyper affiliate marketing world. Well, I&#8217;m ecstatic to announce that you can still track this stuff. It just takes a little bit more work. And for near-perfect tracking, it is worth every second.</p>
<p>The trick is to append a variable to all of your ad URLs. Then you have your landing page attach the variable to your affiliate link. The affiliate network should then display the variable in your conversion report. After a couple of months or so you can check how much an ad has made you in sales, then subtract the cost of clicks for that ad over the same period. If you&#8217;ve paid a lot more on clicks than that ad made you in sales, bin it. If it cost a little more, drop your CPC and bring it into profitability.</p>
<p>Most affiliate networks have different rules regarding the variables they show on your stats. For instance, some may require that you give your variable a certain name. Look through their help pages for more info on what you should call the variable, or whether they allow you to create different &#8216;hop links&#8217; or aliases for different ads etc.</p>
<p>Let&#8217;s say I want to track which ads for blue widgets are profitable. I could create an ad with the following URL:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.widgets.com/landingpage.php&lt;strong&gt;?ad=myad1</span></pre></td></tr></table></div>

<p>Then in the source code of the landingpage.php file, I would add this at the top:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #000088;">$affurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://widget.myaffnetwork.com/?ad=&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ad'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now the &#8216;ad&#8217; variable would be passed all the way from my advert to my affiliate network. So they would see:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//widget.myaffnetwork.com/?ad=myad1</span></pre></td></tr></table></div>

<p>You&#8217;d now see <em>ad=myad1</em> in your sales report next to any sales when happened as a result of someone clicking on that ad.</p>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=7" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/07/never-trust-adwords-conversion-tracking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dark Dreamweaver Theme</title>
		<link>http://www.haydenkibble.com/2009/06/dark-dreamweaver-theme/</link>
		<comments>http://www.haydenkibble.com/2009/06/dark-dreamweaver-theme/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 18:24:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP/MySQL/AJAX]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[colour scheme]]></category>
		<category><![CDATA[dreamweaver]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.haydenkibble.com/?p=3</guid>
		<description><![CDATA[If, like me, you spend all day staring at a Dreamweaver code screen, you may have given thought to your eyesight and the steps you take to preserve it.
After over 10 years of software development, I have finally taken it upon myself to set my IDE background to black. I have tried this a couple [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.haydenkibble.com/wp-content/uploads/code-colouring-150x150.gif" alt="code-colouring" title="code-colouring" width="150" height="150" class="alignright size-thumbnail wp-image-34" />If, like me, you spend all day staring at a Dreamweaver code screen, you may have given thought to your eyesight and the steps you take to preserve it.</p>
<p>After over 10 years of software development, I have finally taken it upon myself to set my IDE background to black. I have tried this a couple of times over the years, but have immediately changed it back due to it looking &#8216;wierd&#8217;. I had just become too accustomed to the colour coding scheme PHP uses and found it extremely difficult to re-adjust.</p>
<p>After a scour on the internet for some sort of &#8216;theme&#8217;, I came across <a href="http://thatwebguyblog.com/show_article.php?id=2651" target="_blank">this excellent color scheme</a>.</p>
<p>I&#8217;ve now applied this colour scheme to the three PCs I develop on and two weeks down the line I&#8217;m really getting used to it. I think it will take another couple of weeks before the colours become second nature to my brain, but it&#8217;s worth it in the long run.</p>
<p><a href="http://www.haydenkibble.com/?ibsa=share&amp;id=3" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.haydenkibble.com/2009/06/dark-dreamweaver-theme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
