<?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>Coding With Cody</title>
	<atom:link href="http://www.codingwithcody.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codingwithcody.com</link>
	<description>write compile run repeat</description>
	<lastBuildDate>Wed, 01 Sep 2010 07:55:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Hidden Images in Email to Confirm Receipt, Part 2.5</title>
		<link>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2-5/</link>
		<comments>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2-5/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 07:44:27 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=90</guid>
		<description><![CDATA[In part 1 of this series, we discussed how to track email views using an image. In part 2, we setup the tables and functions necessary to record the emails. Before we start building the reporting and campaign tracking mechanisms for step 3, we will need to adjust the code so it will be more [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.codingwithcody.com/2010/07/hidden-images-in-email-to-confirm-receipt/">part 1</a> of this series, we discussed how to track email views using an image. In <a href="http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/">part 2</a>, we setup the tables and functions necessary to record the emails. Before we start building the reporting and campaign tracking mechanisms for step 3, we will need to adjust the code so it will be more maintainable in the future. Based on the traffic and emails I&#8217;ve received regarding this script, we are going to develop this into an easy-to-use, quick-to-deploy solution that can adapt to a variety of existing content management systems and web frameworks but still work as a standalone system.</p>
<p>This is simply a cleanup step and the code below is the revised version of the functionality from <a href="http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/">step 2</a>. Please update the constants in the <em>Config</em> class to use this script.</p>
<p>Requests to this new version also have an argument change and the URL should now look like this (where ID is the id for the user that will receive the email):</p>
<p><em>http://YOUR-SITE.com/signup_complete.php?userId=ID</em></p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p90code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p902"><td class="code" id="p90code2"><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;">// SCRIPT CONFIGURATION</span>
<span style="color: #000000; font-weight: bold;">class</span> Config <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">const</span> EMAIL_ADDRESS <span style="color: #339933;">=</span> <span style="color: #0000ff;">'you@site.com'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR EMAIL ADDRESS</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">const</span> SITE_DOMAIN <span style="color: #339933;">=</span> <span style="color: #0000ff;">'site.com'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR DOMAIN</span>
    <span style="color: #000000; font-weight: bold;">const</span> IMG_PATH <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/images/email/'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// PATH TO PNG IMAGE AND TRACK.PHP</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">const</span> DB_HOST <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR DB HOST</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_USERNAME <span style="color: #339933;">=</span> <span style="color: #0000ff;">'username'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR DB USERNAME</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_PASSWORD <span style="color: #339933;">=</span> <span style="color: #0000ff;">'password'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR DB PASSWORD</span>
    <span style="color: #000000; font-weight: bold;">const</span> DB_SCHEMA <span style="color: #339933;">=</span> <span style="color: #0000ff;">'database'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// YOUR DATABASE/SCHEMA NAME</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// PRESISTENT DB CONNECT</span>
<a href="http://www.php.net/mysql_pconnect"><span style="color: #990000;">mysql_pconnect</span></a><span style="color: #009900;">&#40;</span>Config<span style="color: #339933;">::</span><span style="color: #004000;">DB_HOST</span><span style="color: #339933;">,</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">DB_USERNAME</span><span style="color: #339933;">,</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">DB_PASSWORD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/mysql_select_db"><span style="color: #990000;">mysql_select_db</span></a><span style="color: #009900;">&#40;</span>Config<span style="color: #339933;">::</span><span style="color: #004000;">DB_SCHEMA</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// USER MODEL</span>
<span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$emailAddress</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$status</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// WE'LL USE THIS AS AN ACTIVE/CAN-BE-EMAILED FLAG</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// STATIC METHODS</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'INSERT IGNORE INTO `user` SET `email_address` = &quot;'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/mysql_escape_string"><span style="color: #990000;">mysql_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// PUBLIC METHODS</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$userId</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchDetails</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// PRIVATE METHODS</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> fetchDetails<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM `user` WHERE `user_id` = '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">';'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_num_rows"><span style="color: #990000;">mysql_num_rows</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_array"><span style="color: #990000;">mysql_fetch_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">emailAddress</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email_address'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// EMAIL MODEL</span>
<span style="color: #000000; font-weight: bold;">class</span> Email <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> send<span style="color: #009900;">&#40;</span>User <span style="color: #000088;">$user</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: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Test email from '</span> <span style="color: #339933;">.</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">SITE_DOMAIN</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;html&gt;&lt;body&gt;&lt;h1&gt;Test Email&lt;/h1&gt;&lt;img src=&quot;http://'</span> <span style="color: #339933;">.</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">SITE_DOMAIN</span> <span style="color: #339933;">.</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">IMG_PATH</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'image'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'-'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/rand"><span style="color: #990000;">rand</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9999</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.png&quot; /&gt;&lt;/body&gt;&lt;/html&gt;'</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$headers</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;From: &quot;</span> <span style="color: #339933;">.</span> Config<span style="color: #339933;">::</span><span style="color: #004000;">EMAIL_ADDRESS</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-type: text/html<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mail"><span style="color: #990000;">mail</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">emailAddress</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$body</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userId'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Email<span style="color: #339933;">::</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hidden Images in Email to Confirm Receipt, Part 2</title>
		<link>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/</link>
		<comments>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 12:07:12 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=82</guid>
		<description><![CDATA[In a previous post, we discussed how to track the viewing of an email using a 1x1px image, PHP and htaccess. Now we’ll see how to generate the ID that is associated with the email and update a database to record the action. First, we’ll need a table to record the information. The following are [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codingwithcody.com/2010/07/hidden-images-in-email-to-confirm-receipt/">In a previous post</a>, we discussed how to track the viewing of an email using a 1x1px image, PHP and htaccess. Now we’ll see how to generate the ID that is associated with the email and update a database to record the action.</p>
<p>First, we’ll need a table to record the information. The following are two SQL queries to create the tables we need. The first query is for the table we’ll use for the tracking event and the second is a query to create the user table to identify each unique user (if you use some type of user login/account system, feel free to adjust the table parameters to work with that system):</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p82code7'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p827"><td class="code" id="p82code7"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`user`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`user_id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`email_address`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`user_id`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`email`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`email_address`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8</pre></td></tr></table></div>

</blockquote>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p82code8'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p828"><td class="code" id="p82code8"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`email_tracker_event`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`event_id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`user_id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`event_timestamp`</span> datetime <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`event_id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8</pre></td></tr></table></div>

</blockquote>
<p>Next, in the document root folder for your site, add a file named <em>signup_complete.php</em>. This file will be the last step to your user signup form (which goes beyond the scope of this tutorial) and requires only that the user’s email address be passed as the first argument to the <em>addUser()</em> function we’re creating. If you are using a framework, consider adding a static method similar to this to your user model:</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p82code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p829"><td class="code" id="p82code9"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<a href="http://www.php.net/mysql_connect"><span style="color: #990000;">mysql_connect</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR-DB-HOSTNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR-USERNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR-PASSWORD'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/mysql_select_db"><span style="color: #990000;">mysql_select_db</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR-DB'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// PREPARE QUERY</span>
    <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'INSERT IGNORE INTO `user` SET `email_address` = &quot;'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/mysql_escape_string"><span style="color: #990000;">mysql_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// EXECUTE QUERY</span>
    <span style="color: #000088;">$resultResource</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><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: #666666; font-style: italic;">// IF IT EXECUTED</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultResource</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//  AND AFFECTED ONE ROW</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_affected_rows"><span style="color: #990000;">mysql_affected_rows</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	    <span style="color: #666666; font-style: italic;">// RETURN THE ID</span>
	    <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_insert_id"><span style="color: #990000;">mysql_insert_id</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_affected_rows"><span style="color: #990000;">mysql_affected_rows</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	    <span style="color: #666666; font-style: italic;">// OOPS! THIS ADDRESS IS ALREADY IN THE TABLE, RETURN THE ID</span>
	    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT `user_id` AS `id` FROM `user` WHERE `email_address` = &quot;'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/mysql_escape_string"><span style="color: #990000;">mysql_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_array"><span style="color: #990000;">mysql_fetch_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// SOMETHING MUST HAVE GONE WRONG, RETURN FALSE</span>
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> sendEmail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Test email from your site'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;html&gt;&lt;body&gt;&lt;h1&gt;Test Email&lt;/h1&gt;&lt;img src=&quot;http://YOUR-SITE.com/assets/images/email/image'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'-'</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/rand"><span style="color: #990000;">rand</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9999</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.png&quot; /&gt;&lt;/body&gt;&lt;/html&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$from</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR-EMAIL-ADDRESS'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$headers</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;From: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$from</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;Content-type: text/html<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <a href="http://www.php.net/mail"><span style="color: #990000;">mail</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$emailAddress</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$body</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// KILL ANY REQUEST THAT HAS NEWLINE/RETURN IN THE EMAIL ADDRESS, THEY'RE TRYING TO PULL A FAST ONE ON YA</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/eregi"><span style="color: #990000;">eregi</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(<span style="color: #000099; font-weight: bold;">\r</span>|<span style="color: #000099; font-weight: bold;">\n</span>)&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ADD THE USER AND GET THE ID</span>
<span style="color: #000088;">$userId</span> <span style="color: #339933;">=</span> addUser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</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;">$userId</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'USER ID: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$userId</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>sendEmail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$userId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Email sent!'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Email NOT sent!'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Something went wrong, check DB connection.'</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>

</blockquote>
<p>Using the following URL, this script will add a user to the user table we created earlier and return the new user’s ID. This ID is what we will use for the image to track emails from the system that they have viewed.</p>
<blockquote><p>http://YOUR-SITE.com/signup_complete.php?email=name@site.com</p></blockquote>
<p>Last but not least, we’ll need to modify the /images/email/track.php we created in the previous post to record the viewing of the email:</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p82code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p8210"><td class="code" id="p82code10"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<a href="http://www.php.net/mysql_connect"><span style="color: #990000;">mysql_connect</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR-DB-HOSTNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR-USERNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR-PASSWORD'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/mysql_select_db"><span style="color: #990000;">mysql_select_db</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR-DB'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$trackingNumber</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'x'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'INSERT INTO `email_tracker_event` SET `user_id` = '</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/mysql_escape_string"><span style="color: #990000;">mysql_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$trackingNumber</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">', `event_timestamp` = NOW();'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type:image/png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'track.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</blockquote>
<p>In part 3 of this tutorial series, we&#8217;ll look at how to create campaigns and reports.</p>
<p></p>
<h3>UPDATE:</h3>
<p><a href="http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2-5/">Part 2.5</a> has been posted to clean up the code above and prepare it for the next step in creating a more complex email tracking system. Please review this step before proceeding to step 3 (you can still use the code above, but we&#8217;ll be building something much more complex by the end of this series).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hidden Images in Email to Confirm Receipt</title>
		<link>http://www.codingwithcody.com/2010/07/hidden-images-in-email-to-confirm-receipt/</link>
		<comments>http://www.codingwithcody.com/2010/07/hidden-images-in-email-to-confirm-receipt/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 01:56:27 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=71</guid>
		<description><![CDATA[It&#8217;s a little rude to ask someone to confirm they read an email, isn&#8217;t it? Well, there&#8217;s a way to get a confirmation without them knowing it using PHP and htaccess. First, create a directory in your images folder called &#8216;email&#8217; (/images/email/ for this tutorial). Inside that folder, create an .htaccess file. Be sure that [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a little rude to ask someone to confirm they read an email, isn&#8217;t it? Well, there&#8217;s a way to get a confirmation without them knowing it using PHP and htaccess.</p>
<p>First, create a directory in your images folder called &#8216;email&#8217; (/images/email/ for this tutorial). Inside that folder, create an .htaccess file. Be sure that your Apache directive for AllowOverride is set to All.</p>
<p>In this .htaccess file, add the following:</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p71code14'); return false;">View Code</a> HTACCESS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7114"><td class="code" id="p71code14"><pre class="htaccess" style="font-family:monospace;">RewriteEngine On
ReWriteRule ^image(.*?)\-\d{4}\.png$ track.php?x=$1 [L]</pre></td></tr></table></div>

</blockquote>
<p>Next, create a 1x1px PNG image in the same folder and name it track.png. This will be the image loaded in the email.</p>
<p>Finally, in the same folder create a file named track.php and add the following:</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p71code15'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7115"><td class="code" id="p71code15"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$trackingNumber</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'x'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// logic here for updating your database tables</span>
&nbsp;
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type:image/png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'track.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</blockquote>
<p>Inside the email you are sending, include the following line. This will allow the system to track the ID &#8217;1234&#8242; when that image is loaded. Additionally, as we are using htaccess to mask the script being used, the image will appear to be a regular PNG without any extra parameters.</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p71code16'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7116"><td class="code" id="p71code16"><pre class="html" style="font-family:monospace;">&lt;img src=&quot;http://www.yoursite.com/images/email/image1234.png&quot; /&gt;</pre></td></tr></table></div>

</blockquote>
<p><a href="http://www.codingwithcody.com/2010/08/hidden-images-in-email-to-confirm-receipt-part-2/">In part 2 of this tutorial</a>, we&#8217;ll discuss where the ID is generated and how it is used.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/07/hidden-images-in-email-to-confirm-receipt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Stopping Non-Essential Services on CentOS</title>
		<link>http://www.codingwithcody.com/2010/07/stopping-non-essential-services-on-centos/</link>
		<comments>http://www.codingwithcody.com/2010/07/stopping-non-essential-services-on-centos/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 04:55:23 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=68</guid>
		<description><![CDATA[Under an out-of-the-box installation of CentOS, many services are running that are non-essential for a LAMP stack to run effectively. Running the following (either individually or as a script) will remove these services from the boot. Original post from VPS.net View Code BASH#Shut down non essential services: &#160; # 1. sendmail # Purpose: sending mail, [...]]]></description>
			<content:encoded><![CDATA[<p>Under an out-of-the-box installation of CentOS, many services are running that are non-essential for a LAMP stack to run effectively. Running the following (either individually or as a script) will remove these services from the boot.</p>
<p><a href="http://www.vps.net/forum/public-forums/general-discussion/850-removing-unnecessary-servies-on-centos-lamp-config" target="_blank">Original post from VPS.net</a></p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p68code18'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6818"><td class="code" id="p68code18"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#Shut down non essential services:</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># 1. sendmail</span>
<span style="color: #666666; font-style: italic;"># Purpose: sending mail, most use another</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sendmail</span> stop
chkconfig <span style="color: #c20cb9; font-weight: bold;">sendmail</span> off
&nbsp;
<span style="color: #666666; font-style: italic;"># 2. nfs</span>
<span style="color: #666666; font-style: italic;"># Purpose: mount a disk from another machine</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>portmap stop
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nfs stop
chkconfig portmap off
chkconfig nfs off
&nbsp;
<span style="color: #666666; font-style: italic;"># 3. chargen</span>
<span style="color: #666666; font-style: italic;"># Purpose: testing char generation</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>chargen stop
chkconfig chargen off
&nbsp;
<span style="color: #666666; font-style: italic;"># 4. ypbind</span>
<span style="color: #666666; font-style: italic;"># Purpose: stores info on NIS domains</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>ypbind stop
chkconfig ypbind off
&nbsp;
<span style="color: #666666; font-style: italic;"># 5. anacron</span>
<span style="color: #666666; font-style: italic;"># Purpose: cron for systems that shut down a lot</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>anacron stop
chkconfig anacron off
&nbsp;
<span style="color: #666666; font-style: italic;"># 6. atd</span>
<span style="color: #666666; font-style: italic;"># Purpose: at cmd daemon</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>atd stop
chkconfig atd off
&nbsp;
<span style="color: #666666; font-style: italic;"># 7. routed</span>
<span style="color: #666666; font-style: italic;"># Purpose: Route packets, log tables</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>routed stop
chkconfig routed off
&nbsp;
<span style="color: #666666; font-style: italic;"># 8. snmpd</span>
<span style="color: #666666; font-style: italic;"># Purpose: network monitoring</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>snmpd stop
chkconfig snmpd off
&nbsp;
<span style="color: #666666; font-style: italic;"># 9. gpm</span>
<span style="color: #666666; font-style: italic;"># Purpose: mouse</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gpm stop
chkconfig gpm off
&nbsp;
<span style="color: #666666; font-style: italic;"># 10. smartd</span>
<span style="color: #666666; font-style: italic;"># Purpose: disk health monitor</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>smartd stop
chkconfig smartd stop
&nbsp;
<span style="color: #666666; font-style: italic;"># 11. hidd</span>
<span style="color: #666666; font-style: italic;"># Purpose: bluetooth</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>hidd stop
chkconfig hidd off
&nbsp;
<span style="color: #666666; font-style: italic;"># 12. pcscf</span>
<span style="color: #666666; font-style: italic;"># Purpose: smart card reader</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>pcscd stop
chkconfig pcscf off
&nbsp;
<span style="color: #666666; font-style: italic;"># 13. isdn</span>
<span style="color: #666666; font-style: italic;"># Purpose: digital network</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>isdn stop
chkconfig isdn off
&nbsp;
<span style="color: #666666; font-style: italic;"># 14. kudzu</span>
<span style="color: #666666; font-style: italic;"># Purpose: watches for new hardware</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>kudzu stop
chkconfig kudzu off
&nbsp;
<span style="color: #666666; font-style: italic;"># 15. cups</span>
<span style="color: #666666; font-style: italic;"># Purpose: printing</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>cups stop
chkconfig cups off
&nbsp;
<span style="color: #666666; font-style: italic;"># 16. xfs</span>
<span style="color: #666666; font-style: italic;"># Purpose: serves x# 1# 1 fonts</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>xfs stop
chkconfig xfs off
&nbsp;
<span style="color: #666666; font-style: italic;"># 17. nfslock</span>
<span style="color: #666666; font-style: italic;"># Purpose: file sys lock</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nfslock stop
chkconfig nfslock off
&nbsp;
<span style="color: #666666; font-style: italic;"># 18. canna</span>
<span style="color: #666666; font-style: italic;"># Purpose: Chinese chars</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>canna stop
chkconfig canna off
&nbsp;
<span style="color: #666666; font-style: italic;"># 19. freeWnn</span>
<span style="color: #666666; font-style: italic;"># Purpose: Japanese chars</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>FreeWnn stop
chkconfig FreeWnn off
&nbsp;
<span style="color: #666666; font-style: italic;"># 20. cups-config-daemon</span>
<span style="color: #666666; font-style: italic;"># Purpose: print config</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>cups-config-daemon stop
chkconfig cups-config-daemon off
&nbsp;
<span style="color: #666666; font-style: italic;"># 21. iiim</span>
<span style="color: #666666; font-style: italic;"># Purpose: internet language input</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>iiim stop
chkconfig iiim off
&nbsp;
<span style="color: #666666; font-style: italic;"># 22. mDNSResponder</span>
<span style="color: #666666; font-style: italic;"># Purpose: dns service discovery</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mDNSResponder stop
chkconfig mDNSResponder off
&nbsp;
<span style="color: #666666; font-style: italic;"># 23. nifd</span>
<span style="color: #666666; font-style: italic;"># Purpose: monitors net interfaces</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nifd stop
chkconfig nifd off
&nbsp;
<span style="color: #666666; font-style: italic;"># 24. rpcimpad</span>
<span style="color: #666666; font-style: italic;"># Purpose: used for nfs server</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>rpcimpad stop
chkconfig rpcimpad off
&nbsp;
<span style="color: #666666; font-style: italic;"># 25. bluetooth</span>
<span style="color: #666666; font-style: italic;"># Purpose: bluetooth devices</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>bluetooth stop
chkconfig bluetooth off
&nbsp;
<span style="color: #666666; font-style: italic;"># 26. saslauthd</span>
<span style="color: #666666; font-style: italic;"># Purpose: handles plaintext authentication requests</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>saslauthd stop
chkconfig saslauthd off
Notes: some systems use this <span style="color: #000000; font-weight: bold;">for</span> email auth<span style="color: #000000; font-weight: bold;">!</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># 27. avahi-daemon</span>
<span style="color: #666666; font-style: italic;"># Purpose: instant network recognition</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>avahi-daemon stop
chkconfig avahi-daemon off
&nbsp;
<span style="color: #666666; font-style: italic;"># 28. avahi-dnsconfd</span>
<span style="color: #666666; font-style: italic;"># Purpose: instant network recognition</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>avahi-dnsconfd stop
chkconfig avahi-dnsconfd off
&nbsp;
<span style="color: #666666; font-style: italic;"># 29. sbadm</span>
<span style="color: #666666; font-style: italic;"># Purpose: rapid reboot</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sbadm stop
chkconfig sbadm off
&nbsp;
<span style="color: #666666; font-style: italic;"># 30. haldaemon</span>
<span style="color: #666666; font-style: italic;"># Purpose: monitors for hardware changes</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>haldaemon stop
chkconfig haldaemon off
&nbsp;
<span style="color: #666666; font-style: italic;"># 31. acpi</span>
<span style="color: #666666; font-style: italic;"># Purpose: sleep/hibernate control</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>acpi stop
chkconfig acpi off
&nbsp;
<span style="color: #666666; font-style: italic;"># 99. gamin</span>
<span style="color: #666666; font-style: italic;"># Purpose: monitors file/dir changes</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>gamin stop
yum <span style="color: #660033;">-y</span> remove gamin</pre></td></tr></table></div>

</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/07/stopping-non-essential-services-on-centos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Symbolic Links</title>
		<link>http://www.codingwithcody.com/2010/07/using-symbolic-links/</link>
		<comments>http://www.codingwithcody.com/2010/07/using-symbolic-links/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 22:41:59 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=60</guid>
		<description><![CDATA[Symbolic links (symlinks) are an extremely useful tool to every system admin and web application developer. They work a lot like a shortcut in Windows. Let&#8217;s say you were working with a web application that used a framework that held all Javascript, CSS and image files in a tucked-away location (for the sake of this [...]]]></description>
			<content:encoded><![CDATA[<p>Symbolic links (symlinks) are an extremely useful tool to every system admin and web application developer. They work a lot like a shortcut in Windows. Let&#8217;s say you were working with a web application that used a framework that held all Javascript, CSS and image files in a tucked-away location (for the sake of this example, that location is /var/www/html/production/clientside/, making /var/www/html/production/clientside/js/ the location of the Javascript files). And you, the developer working on creating these Javascript, CSS and image files, wanted to use /js/somefile.js instead of a longer name like /production/clientside/js/somefile.js in your public-facing code. To do this, use the following commands:</p>
<p><code>ln -s /var/www/html/production/clientside/js/ /var/www/html/js/</code></p>
<p><code>ln -s /var/www/html/production/clientside/css/ /var/www/html/css/</code></p>
<p><code>ln -s /var/www/html/production/clientside/images/ /var/www/html/images/</code></p>
<p>Bear in mind that if you are using a framework that has pretty URL rules in the .htaccess file, you will have to make exclusions (below is the basic /var/www/html/.htaccess in our example framework):</p>
<p><code>RewriteEngine on<br />
RewriteCond $1 !^(index\.php|images|robots\.txt|css|js)<br />
RewriteRule ^(.*)$ /index.php/$1 [L]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/07/using-symbolic-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SERPSight Testers Needed!</title>
		<link>http://www.codingwithcody.com/2010/06/serpsight-testers-needed/</link>
		<comments>http://www.codingwithcody.com/2010/06/serpsight-testers-needed/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 09:42:48 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=58</guid>
		<description><![CDATA[Visit SERPSight.com for the pre-beta tests. Free automated search engine result page tracking credits for the testers (this is open to anyone). Bonus credits for anyone who can find and report an exploit in the system.]]></description>
			<content:encoded><![CDATA[<p>Visit <a href="http://serpsight.com">SERPSight.com</a> for the pre-beta tests. Free <a href="http://serpsight.com">automated search engine result page tracking</a> credits for the testers (this is open to anyone). Bonus credits for anyone who can find and report an exploit in the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/06/serpsight-testers-needed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate Random IP with Python</title>
		<link>http://www.codingwithcody.com/2010/05/generate-random-ip-with-python/</link>
		<comments>http://www.codingwithcody.com/2010/05/generate-random-ip-with-python/#comments</comments>
		<pubDate>Mon, 17 May 2010 18:09:13 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=55</guid>
		<description><![CDATA[In need of an IP address on-the-fly that appears to be valid? Try this: View Code PYTHONfrom random import randrange &#160; def generateIP&#40;&#41;: blockOne = randrange&#40;0, 255, 1&#41; blockTwo = randrange&#40;0, 255, 1&#41; blockThree = randrange&#40;0, 255, 1&#41; blockFour = randrange&#40;0, 255, 1&#41; print 'Random IP: ' + str&#40;blockOne&#41; + '.' + str&#40;blockTwo&#41; + '.' [...]]]></description>
			<content:encoded><![CDATA[<p>In need of an IP address on-the-fly that appears to be valid? Try this:</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p55code21'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5521"><td class="code" id="p55code21"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">random</span> <span style="color: #ff7700;font-weight:bold;">import</span> randrange
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> generateIP<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    blockOne = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    blockTwo = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    blockThree = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    blockFour = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Random IP: '</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockOne<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockTwo<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockThree<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockFour<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> blockOne == <span style="color: #ff4500;">10</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.__generateRandomIP__<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> blockOne == <span style="color: #ff4500;">172</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.__generateRandomIP__<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> blockOne == <span style="color: #ff4500;">192</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.__generateRandomIP__<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockOne<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockTwo<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockThree<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'.'</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>blockFour<span style="color: black;">&#41;</span></pre></td></tr></table></div>

</blockquote>
<p>We&#8217;re skipping 10.x.x.x, 172.x.x.x and 192.x.x.x due to the fact that these are reserved address. <a href="http://www.faqs.org/rfcs/rfc1918.html" rel="nofollow">RFC 1918</a></p>
<p><strong>Version 2:</strong></p>
<p>An elegant solution to serve the purpose of generating a random IP provided by <a href="http://spareclockcycles.org/">Ben</a> (explanation of changes listed in the comments below):</p>
<blockquote>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p55code22'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5522"><td class="code" id="p55code22"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">random</span> <span style="color: #ff7700;font-weight:bold;">import</span> randrange
<span style="color: #ff7700;font-weight:bold;">if</span> __name__==<span style="color: #483d8b;">&quot;__main__&quot;</span>:
    not_valid = <span style="color: black;">&#91;</span><span style="color: #ff4500;">10</span>,<span style="color: #ff4500;">127</span>,<span style="color: #ff4500;">169</span>,<span style="color: #ff4500;">172</span>,<span style="color: #ff4500;">192</span><span style="color: black;">&#93;</span>
&nbsp;
    first = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">256</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">while</span> first <span style="color: #ff7700;font-weight:bold;">in</span> not_valid:
    first = randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">256</span><span style="color: black;">&#41;</span>
&nbsp;
    ip = <span style="color: #483d8b;">&quot;.&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>first<span style="color: black;">&#41;</span>,<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">256</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
    <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">256</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>randrange<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">256</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> ip</pre></td></tr></table></div>

</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/05/generate-random-ip-with-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>KEI and Competition Weight</title>
		<link>http://www.codingwithcody.com/2010/03/kei-and-competition-weight/</link>
		<comments>http://www.codingwithcody.com/2010/03/kei-and-competition-weight/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 06:54:27 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=48</guid>
		<description><![CDATA[Normally, simple KEI is created using the following formula where P is popularity and C is competition: KEI = P2/C This will get you in trouble. Not all competitors are the same and looking at just the number of indexed sites using an allintitle operator does not take this into account. For example, a football [...]]]></description>
			<content:encoded><![CDATA[<p>Normally, simple KEI is created using the following formula where P is popularity and C is competition:</p>
<blockquote><p>KEI = P2/C</p></blockquote>
<p>This will get you in trouble. Not all competitors are the same and looking at just the number of indexed sites using an allintitle operator does not take this into account. For example, a football game against 10 people would seem favorable to a game against 50 people, right? Would you change your mind if you discovered those 50 people were all amputees and the 10 were Olympic athletes?</p>
<p>How can we know the “physical conditioning” of our search competitors without extensive evaluation of each site? I suggest using PR distribution. Take the first 20 results and lookup the PR/MR of each URL (this is easier if you are or know a programmer) and get the average PR/MR value. This should be used in the existing formula in the following fashion where PR is PR/MR:</p>
<blockquote><p>KEI = P2/(C*PR)</p></blockquote>
<p>This may skew things a bit, so feel free to tinker with the weight till it meets your liking as in the following example:</p>
<blockquote><p>KEI = P2/(C(PR*.25))</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/03/kei-and-competition-weight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethical SEO</title>
		<link>http://www.codingwithcody.com/2010/03/ethical-seo/</link>
		<comments>http://www.codingwithcody.com/2010/03/ethical-seo/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:34:31 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=45</guid>
		<description><![CDATA[Google and the other big players in search all hate SEO. This is completely understandable (coming from the Director of Search Engine Optimization at a large web development firm). SEO is riddled with bad advice, grey areas and misinformation to the engines. The problem is not the profession, it’s the approach. Let’s step into the [...]]]></description>
			<content:encoded><![CDATA[<p>Google and the other big players in search all hate SEO. This is completely understandable (coming from the Director of Search Engine Optimization at a large web development firm). SEO is riddled with bad advice, grey areas and misinformation to the engines. The problem is not the profession, it’s the approach.</p>
<p>Let’s step into the shoes of Google. Their mission is to organize the information for the entire globe into a single query line. They want to ensure what you type into that box results in what you want to understand. That’s one hell of a goal and I’d like to see it met with quickness. The problem lies in people trying to find an easy out, be it due to pressure from a marketing team or the lack of traffic they expected off their existing “tactics” or any number of other reasons.</p>
<p>We are not here to fight Google. We are here to help. First off, don’t take on a client that isn’t actually an authority in their market. If they are and should be an authority in the engines, then you have something to work with.</p>
<p>The biggest beef I have right now is social media. I talk to who I talk (or “friend”) to for a reason. I know a lot of you talk to 2k people but only do business with 10 and this is not ethical as an internet marketing practice. Additionally, I believe the goal of Google will shut you down. There is no truth in your methodology. If you believe relevance relies in any way on the number of people you connect with, Google has a big surprise waiting for you,</p>
<p>Bottom line is this: The best of the engines will show relevance and a trend when it actually is a trend. Don’t underhand them or try to make it what it isn’t. Play by the rules. By helping the master (Google) understand our world, we help ourselves.</p>
<p>Or…keep being cheap. You won&#8217;t last (just like the link farmers of &#8217;97, who boasted big stats 13 years ago)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2010/03/ethical-seo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Disable yum-updatesd for better performance</title>
		<link>http://www.codingwithcody.com/2009/08/disable-yum-updatesd-for-better-performance/</link>
		<comments>http://www.codingwithcody.com/2009/08/disable-yum-updatesd-for-better-performance/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 05:54:10 +0000</pubDate>
		<dc:creator>Cody Snider</dc:creator>
				<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://codingwithcody.com/?p=39</guid>
		<description><![CDATA[On a base server install for Centos 5.2, yum-updatesd is included and it seems like a fairly good idea to keep that running (keeps you updated). Not so and it&#8217;s safe to disable this (kill the process and disable it from starting up in the first place. Here&#8217;s the process, I noticed an immediate speed [...]]]></description>
			<content:encoded><![CDATA[<p>On a base server install for Centos 5.2, yum-updatesd is included and it seems like a fairly good idea to keep that running (keeps you updated). Not so and it&#8217;s safe to disable this (kill the process and disable it from starting up in the first place.</p>
<p>Here&#8217;s the process, I noticed an immediate speed increase in my VPS when I disabled it (among a few other thing like avahi):</p>
<blockquote><p>/usr/bin/python -tt /usr/sbin/yum-updatesd</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.codingwithcody.com/2009/08/disable-yum-updatesd-for-better-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
