<?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>Steve's Ramblings &#187; Coding</title>
	<atom:link href="http://steve.blogme.us/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://steve.blogme.us</link>
	<description>Just another person with internet access</description>
	<lastBuildDate>Mon, 14 Jun 2010 21:07:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Cisco AnyConnect in Ubuntu &amp; Fedora &#8211; Fixing it the Easy way</title>
		<link>http://steve.blogme.us/2010/06/03/cisco-anyconnect-in-ubuntu-and-possibly-fedora-fixing-it-the-easy-way/</link>
		<comments>http://steve.blogme.us/2010/06/03/cisco-anyconnect-in-ubuntu-and-possibly-fedora-fixing-it-the-easy-way/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 19:03:07 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://steve.blogme.us/?p=697</guid>
		<description><![CDATA[
			
				
			
		
Cisco AnyConnect fails to properly connect under Linux (Ubuntu and Fedora were tested) due to the following reason:
connection attempt has failed due to a server certificate problem
Eventually I found a fix for it, and while it worked it was a slight pain in the ass as it required you to download and extract firefox from ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2010%2F06%2F03%2Fcisco-anyconnect-in-ubuntu-and-possibly-fedora-fixing-it-the-easy-way%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2010%2F06%2F03%2Fcisco-anyconnect-in-ubuntu-and-possibly-fedora-fixing-it-the-easy-way%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Cisco AnyConnect fails to properly connect under Linux (Ubuntu and Fedora were tested) due to the following reason:</p>
<blockquote><p>connection attempt has failed due to a server certificate problem</p></blockquote>
<p>Eventually I found a fix for it, and while it worked it was a slight pain in the ass as it required you to download and extract firefox from Mozilla.com, pull files from the archive, copy them, and create softlinks. I created a simple script (and a folder that contains the needed files) that will resolve this issue in no time flat. Simply:</p>
<ol>
<li>Download the archive</li>
<li>Extract the archive: tar -xvzf cisco_anyconnect_fix.tar.gz</li>
<li>Go into the newly created folder: cd cisco_anyconnect_fix</li>
<li>Execute the script as root: sudo anyconnect_fix.sh</li>
<li>Connect to VPN as normal</li>
</ol>
<p>I hope this works for you, I did test it in Ubuntu 10.04 &#038; Fedora 13 with success. There is a check that will install via yum or aptitude the needed libraries. </p>
<p>Give it a try and let me know if you run into any issues.</p>
<p><strong>Download</strong> (1MB): <a href="http://steve.blogme.us/wp-content/uploads/2010/06/cisco_anyconnect_fix.tar.gz">cisco_anyconnect_fix.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2010/06/03/cisco-anyconnect-in-ubuntu-and-possibly-fedora-fixing-it-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bypass Torrent File Network Filters</title>
		<link>http://steve.blogme.us/2008/03/20/bypass-torrent-file-network-filters/</link>
		<comments>http://steve.blogme.us/2008/03/20/bypass-torrent-file-network-filters/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 18:03:19 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://steve.blogme.us/2008/03/20/bypass-torrent-file-network-filters/</guid>
		<description><![CDATA[
			
				
			
		
Many Universities, workplaces, etc are starting to take action against the use of torrent files. You can always change ports so port blocking is a worthless use of network time. However, places have started to restrict the ability to download files ending in the .torrent extension. This complicates things immensely.
Take for example a situation I ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2008%2F03%2F20%2Fbypass-torrent-file-network-filters%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2008%2F03%2F20%2Fbypass-torrent-file-network-filters%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Many Universities, workplaces, etc are starting to take action against the use of torrent files. You can always change ports so port blocking is a worthless use of network time. However, places have started to restrict the ability to download files ending in the .torrent extension. This complicates things immensely.</p>
<p>Take for example a situation I encountered. On the Ubuntu 7.10 release date it was nearly impossible to find a server to download the ISO from as they were all getting hammered with requests. The solution many servers displayed was &#8216;download via a torrent&#8217;. When I tried that on my university network, I encountered the problem, I couldn&#8217;t download the .torrent file. This was annoying, as the University states that using the network to download and seed legal torrents is allowed. How did I get passed this? Using a simple php script I coded up, that can be found at <strong><a href="http://steve.blogme.us/bypass.php" target="_BLANK">http://steve.blogme.us/bypass.php</a></strong></p>
<p>The script simply takes the URL to the .torrent file, saves it on the local server as a text file, and allows you to then download it, then all you need to do is change the extension to .torrent and load it up in the torrent client. It is that simple, and it works! Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2008/03/20/bypass-torrent-file-network-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Sessions &#8211; Quick and dirty</title>
		<link>http://steve.blogme.us/2007/11/13/php-sessions-quick-and-dirty/</link>
		<comments>http://steve.blogme.us/2007/11/13/php-sessions-quick-and-dirty/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 04:49:51 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.blogme.us/steve/2007/11/13/php-sessions-quick-and-dirty/</guid>
		<description><![CDATA[
			
				
			
		
A session variable is a great way to store information about visitors on your site. For example if a user logs in you could store their username, and the date of login as session variables, then add a file include that checks to make sure the user is logged in before viewing a page.
Below is ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F13%2Fphp-sessions-quick-and-dirty%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F13%2Fphp-sessions-quick-and-dirty%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>A session variable is a great way to store information about visitors on your site. For example if a user logs in you could store their username, and the date of login as session variables, then add a file include that checks to make sure the user is logged in before viewing a page.</p>
<p>Below is example code using session variables:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Creating session variables... &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uname'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Steve&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;MyPassword&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Displaying session data... &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uname'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Destroying session data... &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uname'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Displaying session data again (should be empty)... &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uname'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Done! &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That code, when run will output:<br />
<code><br />
Creating session variables...<br />
Displaying session data...<br />
Steve<br />
MyPassword<br />
Destroying session data...<br />
Displaying session data again (should be empty)... </p>
<p>Done!<br />
</code><br />
The code is very simple to follow, $_SESSION[] variables are created named uname and pass, values are assigned to them and displayed via echo. Then unset() is used to delete the values, thus when echoing the output again the lines are blank. Cake.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2007/11/13/php-sessions-quick-and-dirty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Generated iPhone User Images</title>
		<link>http://steve.blogme.us/2007/11/10/php-generated-iphone-user-images/</link>
		<comments>http://steve.blogme.us/2007/11/10/php-generated-iphone-user-images/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 03:33:17 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.blogme.us/steve/2007/11/10/php-generated-iphone-user-images/</guid>
		<description><![CDATA[
			
				
			
		
I have been screwing around with some PHP using functions like imagecreatefrompng() and ImagePNG() to create a few images that create a &#8216;signature&#8217; image that can be used on websites, etc. 
Image 1:

Useage:

Forums: [img]http://www.rapidhash.com/rapidhash/autosig.php.png[/img]

Image 2:

Useage:

Forums: [img]http://www.rapidhash.com/rapidhash/iphone.php.png[/img]

Image 1 will just display the IP of the user. Image 2 will display the users IP, Browser, and Operating ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F10%2Fphp-generated-iphone-user-images%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F10%2Fphp-generated-iphone-user-images%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I have been screwing around with some PHP using functions like imagecreatefrompng() and ImagePNG() to create a few images that create a &#8216;signature&#8217; image that can be used on websites, etc. </p>
<p><strong>Image 1:<br />
</strong><img src="http://www.rapidhash.com/rapidhash/autosig.php.png" alt="" /></p>
<p><strong>Useage:<br />
</strong><code><br />
Forums: [img]http://www.rapidhash.com/rapidhash/autosig.php.png[/img]<br />
</code></p>
<p><strong>Image 2:<br />
</strong><img src="http://www.rapidhash.com./rapidhash/iphone.php.png" alt="" /></p>
<p><strong>Useage</strong>:<br />
<code><br />
Forums: [img]http://www.rapidhash.com/rapidhash/iphone.php.png[/img]<br />
</code></p>
<p>Image 1 will just display the IP of the user. Image 2 will display the users IP, Browser, and Operating System.</p>
<p>Feel free to use them if you desire where ever you want. Just link to them (do not try to save the image, it will not work if you do).</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2007/11/10/php-generated-iphone-user-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Track your site activity in PHP</title>
		<link>http://steve.blogme.us/2007/11/06/track-your-site-activity-in-php/</link>
		<comments>http://steve.blogme.us/2007/11/06/track-your-site-activity-in-php/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 18:40:03 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.blogme.us/steve/2007/11/06/track-your-site-activity-in-php/</guid>
		<description><![CDATA[
			
				
			
		
Want to know who is visiting your website, when the peak times are, and how people are finding you? It is a lot easier than it sounds. While the code below may be over-simplified, it does get the job done. The code assumes that you have a include in your main source file that opens ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F06%2Ftrack-your-site-activity-in-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F11%2F06%2Ftrack-your-site-activity-in-php%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Want to know who is visiting your website, when the peak times are, and how people are finding you? It is a lot easier than it sounds. While the code below may be over-simplified, it does get the job done. The code assumes that you have a include in your main source file that opens a database connection, and a code at the end of your source file that closes it.</p>
<p>The code will get the referring page, the date and time of access, and the IP of the users and store it in a table called tracker. You can then easily code a interface to view that database information. Later I will post code for an interface to this data.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// very simple PHP function, call when database connection is open using tracker();</span>
<span style="color: #666666; font-style: italic;">// By Steve Morrissey</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> tracker<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$referer</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_REFERER&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;F j, Y, g:i a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	     <span style="color: #000088;">$referer</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Direct hit&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO tracker (id, referer, ip, accessed) VALUES('', '<span style="color: #006699; font-weight: bold;">$referer</span>', '<span style="color: #006699; font-weight: bold;">$ip</span>', '<span style="color: #006699; font-weight: bold;">$time</span>')&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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;">// end tracker</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2007/11/06/track-your-site-activity-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good Method for Unique ID&#8217;s?</title>
		<link>http://steve.blogme.us/2007/10/08/good-method-for-unique-ids/</link>
		<comments>http://steve.blogme.us/2007/10/08/good-method-for-unique-ids/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 16:06:58 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.blogme.us/steve/?p=23</guid>
		<description><![CDATA[
			
				
			
		
Here is a function I am making to handle user registration for a new project. Take a look at the else statement, think it will do the trick? All comment&#8217;s are private to not publicly expose hack-a-able errors. Let me know, thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	function doRegistration&#40;&#41;
	&#123;
		if&#40;$this-&#62;validation-&#62;run&#40;&#41; == FALSE&#41;
		&#123;
			$this-&#62;load-&#62;view&#40;'regform'&#41;;
		&#125;
		else
		&#123;
			if&#40;!$_POST&#41;
			&#123;
				/**
				 * We should never get here, this means that
				 * ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F10%2F08%2Fgood-method-for-unique-ids%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsteve.blogme.us%2F2007%2F10%2F08%2Fgood-method-for-unique-ids%2F&amp;source=uberamd&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Here is a function I am making to handle user registration for a new project. Take a look at the else statement, think it will do the trick? All comment&#8217;s are private to not publicly expose hack-a-able errors. Let me know, thanks.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> doRegistration<span style="color: #009900;">&#40;</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;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'regform'</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;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #009933; font-style: italic;">/**
				 * We should never get here, this means that
				 * someone tried to access the page without
				 * filling out the form, signs of a usual hack
				 * attempt. We should deny access at this point
				 * or perhaps implement a 3 strike ban system
				 * based on IP address
				 */</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'regform'</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;">$email</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</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;">$pass</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$date</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;m.d.y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009933; font-style: italic;">/**
				 *	$id is generated using the following:
				 *	Month Day Hour Minute Second
				 *	IE: If it is June 18th 2008 at 11:53:33 AM the ID is:
				 *	06182008115333 (14 characters). This virtually eliminates
				 *	the chances that two people will have duplicate ID's.
				 *	What are the chances two people will access the site to register at
				 *	the EXACT time down to the milisecond? Not likely.
			     */</span>
				<span style="color: #000088;">$id</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mdyais&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM some_table WHERE email = ?&quot;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$email'</span><span style="color: #009900;">&#41;</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;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// We have a existing entry for that email address, not good.</span>
					<span style="color: #666666; font-style: italic;">// Kick back an error page.</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #b1b100;">else</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'email'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'pass'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$pass</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'date'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert_string</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'accounts'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>	
			<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end if !$_POST</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end doRegistration</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://steve.blogme.us/2007/10/08/good-method-for-unique-ids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
