<?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>HxBro's Blog &#187; PHP</title>
	<atom:link href="http://www.hxbro.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hxbro.com</link>
	<description>Random Ramblings</description>
	<lastBuildDate>Mon, 31 Mar 2008 08:59:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>My company website</title>
		<link>http://www.hxbro.com/2007/08/09/my-company-website/</link>
		<comments>http://www.hxbro.com/2007/08/09/my-company-website/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 15:01:14 +0000</pubDate>
		<dc:creator>HxBro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Recommendations]]></category>

		<guid isPermaLink="false">http://www.hxbro.com/2007/08/09/my-company-website/</guid>
		<description><![CDATA[After a long period without a company website, I&#8217;ve now created a new one showing what I offer and a portfolio of both web and digital tv projects I&#8217;ve worked on.
I can provide a wide range of IT services, specialising in Web and Digital TV but also covering PC maintenance and troubleshooting, Broadband setup and [...]]]></description>
			<content:encoded><![CDATA[<p>After a long period without a company website, I&#8217;ve now created a new one showing what I offer and a portfolio of both web and digital tv projects I&#8217;ve worked on.</p>
<p>I can provide a wide range of IT services, specialising in Web and Digital TV but also covering PC maintenance and troubleshooting, Broadband setup and troubleshooting, and Web Hosting services. Feel free to check out the site and also pass on the site if you know anyone who might need my services.</p>
<p><a href="http://www.spodnet.net/" target="_blank">http://www.spodnet.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hxbro.com/2007/08/09/my-company-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Contact Form With Simple Spam Filtering Revisited</title>
		<link>http://www.hxbro.com/2007/03/14/php-contact-form-with-simple-spam-filtering-revisited/</link>
		<comments>http://www.hxbro.com/2007/03/14/php-contact-form-with-simple-spam-filtering-revisited/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 08:26:45 +0000</pubDate>
		<dc:creator>HxBro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.hxbro.com/2007/03/14/php-contact-form-with-simple-spam-filtering-revisited/</guid>
		<description><![CDATA[I&#8217;ll be posting up an updated contact form in the near future with a break down of what each bit is doing, this will help you adapt and change the code to fit your purposes, I&#8217;ll add in a few more bits to help with customising the smtp feature and adding in the akismet spam [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be posting up an updated contact form in the near future with a break down of what each bit is doing, this will help you adapt and change the code to fit your purposes, I&#8217;ll add in a few more bits to help with customising the smtp feature and adding in the akismet spam filtering.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hxbro.com/2007/03/14/php-contact-form-with-simple-spam-filtering-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Contact Form With Simple Spam Filtering</title>
		<link>http://www.hxbro.com/2007/02/25/php-contact-form-with-simple-spam-filtering/</link>
		<comments>http://www.hxbro.com/2007/02/25/php-contact-form-with-simple-spam-filtering/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 17:38:59 +0000</pubDate>
		<dc:creator>HxBro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.hxbro.com/2007/02/25/php-contact-form-with-simple-spam-filtering/</guid>
		<description><![CDATA[Here is some code to handle a simple contact form and email it to someone. This is another piece of code that has grown at of various sources, the is_dodgy function and usage came from a contact form plugin for wordpress which can be downloaded from http://chip.cuccio.us/projects/contact-form-ii/. You'll need to download XPertMailer from http://xpertmailer.sourceforge.net/ and [...]]]></description>
			<content:encoded><![CDATA[<p>Here is some code to handle a simple contact form and email it to someone. This is another piece of code that has grown at of various sources, the is_dodgy function and usage came from a contact form plugin for wordpress which can be downloaded from <a href="http://chip.cuccio.us/projects/contact-form-ii/" target="_blank">http://chip.cuccio.us/projects/contact-form-ii/</a>. You'll need to download XPertMailer from <a href="http://xpertmailer.sourceforge.net/" target="_blank">http://xpertmailer.sourceforge.net/</a> and put the files in the same directory as your contact code. XPertMailer  handles the actual mailing, the php mail() function isn't very good and is open to all sorts of abuse by spammers if the coder has been slack.</p>
<p>You may also want to include my <a href="http://www.hxbro.com/2007/02/25/php-email-address-validation/">email validation code</a> in with this script to check the incoming email address is valid.</p>
<p>I'll be posting up another version of this script with akismet filtering for the spam soon.<span id="more-40"></span></p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">Show Plain Text Version</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">function</span> is_dodgy<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$input</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$is_malicious</span> = <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$bad_inputs</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"&lt;"</span>, <span style="color:#FF0000;">"&gt;"</span>, <span style="color:#FF0000;">"&amp;lt;"</span>, <span style="color:#FF0000;">"&amp;gt"</span>, <span style="color:#FF0000;">"mime-version"</span>, <span style="color:#FF0000;">"content-type"</span>, <span style="color:#FF0000;">"cc:"</span>, <span style="color:#FF0000;">"bcc:"</span>, <span style="color:#FF0000;">"to:"</span>, <span style="color:#FF0000;">"&lt;a href"</span>, <span style="color:#FF0000;">"&lt;/a&gt;"</span>, <span style="color:#FF0000;">"http://"</span>, <span style="color:#FF0000;">"[/URL]"</span>, <span style="color:#FF0000;">"[URL="</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$bad_inputs</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$bad_input</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strpos"><span style="color:#000066;">strpos</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strtolower"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$input</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <a href="http://www.php.net/strtolower"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$bad_input</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> !== <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$is_malicious</span> = <span style="color:#000000; font-weight:bold;">true</span>; <span style="color:#616100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$is_malicious</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'send'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$error_mesage</span> = <span style="color:#FF0000;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$to</span> = <span style="color:#FF0000;">"youremail@address.com"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$from</span> = <span style="color:#FF0000;">""</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$subject</span> = <span style="color:#FF0000;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$message</span> = <span style="color:#FF0000;">""</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'from'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$from</span> = <a href="http://www.php.net/stripslashes"><span style="color:#000066;">stripslashes</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/trim"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'from'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'subject'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$subject</span> = <a href="http://www.php.net/stripslashes"><span style="color:#000066;">stripslashes</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/trim"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'subject'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'message'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$message</span> = <a href="http://www.php.net/stripslashes"><span style="color:#000066;">stripslashes</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/trim"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'message'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$from</span> == <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$error_message</span> .= <span style="color:#FF0000;">"Please enter your e-mail address&lt;br&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$subject</span> == <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$error_message</span> .= <span style="color:#FF0000;">"Please enter a subject&lt;br&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$message</span> == <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$error_message</span> .= <span style="color:#FF0000;">"Please enter a message&lt;br&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$dodgy</span> = <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>is_dodgy<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$from</span><span style="color:#006600; font-weight:bold;">&#41;</span> || is_dodgy<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$subject</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$dodgy</span> = <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/stristr"><span style="color:#000066;">stristr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$from</span>, <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\r</span>"</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <a href="http://www.php.net/stristr"><span style="color:#000066;">stristr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$from</span>, <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\n</span>"</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <a href="http://www.php.net/stristr"><span style="color:#000066;">stristr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$subject</span>, <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\r</span>"</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <a href="http://www.php.net/stristr"><span style="color:#000066;">stristr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$subject</span>, <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\n</span>"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$dodgy</span> = <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dodgy</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$error_message</span> = <span style="color:#FF0000;">"I'm sorry but you've passed illegal content, please try again"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$error_message</span> == <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">require_once</span> <span style="color:#FF0000;">"smtp.php"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// turn off errors</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/error_reporting"><span style="color:#000066;">error_reporting</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 0 -&gt; no time limit</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/set_time_limit"><span style="color:#000066;">set_time_limit</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$mail</span> = <span style="color:#000000; font-weight:bold;">new</span> SMTP;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">From</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$from</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">AddTo</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$to</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">Text</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$message</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sent</span> = <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">Send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$subject</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sent</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Thank you for your message, we will attempt to contact you shortly"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Thank you for your message, however there was an error whilst sending the e-mail. Please try again later"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$error_message</span> .= <span style="color:#FF0000;">"Your email address appears to be invalid&lt;br&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'send'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'send'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <span style="color:#0000FF;">$error_message</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&lt;p&gt;Please contact us using the form below, please <span style="color:#616100;">include</span> contact details so we can contact you back:&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$error_message</span> != <span style="color:#FF0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;p style=<span style="color:#000099; font-weight:bold;">\"</span>color: #ff0000<span style="color:#000099; font-weight:bold;">\"</span>&gt;"</span> . <span style="color:#0000FF;">$error_message</span> . <span style="color:#FF0000;">"&lt;/p&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&lt;form id=<span style="color:#FF0000;">"contact"</span> action=<span style="color:#FF0000;">"&lt;?php echo $_SERVER['PHP_SELF'] ?&gt;"</span> method=<span style="color:#FF0000;">"post"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &lt;input type=<span style="color:#FF0000;">"hidden"</span> name=<span style="color:#FF0000;">"send"</span> value=<span style="color:#FF0000;">"1"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&lt;table border=<span style="color:#FF0000;">"0"</span> cellspacing=<span style="color:#FF0000;">"4"</span> cellpadding=<span style="color:#FF0000;">"0"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;E-<a href="http://www.php.net/mail"><span style="color:#000066;">mail</span></a> :&lt;/td&gt;&lt;td&gt;&lt;input <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"contact_input"</span> type=<span style="color:#FF0000;">"text"</span> name=<span style="color:#FF0000;">"from"</span> size=<span style="color:#FF0000;">"20"</span> maxlength=<span style="color:#FF0000;">"255"</span> value=<span style="color:#FF0000;">"&lt;?php echo htmlspecialchars($from) ?&gt;"</span>&gt;&lt;/td&gt;&lt;/tr&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;Subject :&lt;/td&gt;&lt;td&gt;&lt;input <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"contact_input"</span> type=<span style="color:#FF0000;">"text"</span> name=<span style="color:#FF0000;">"subject"</span> size=<span style="color:#FF0000;">"20"</span> maxlength=<span style="color:#FF0000;">"255"</span> value=<span style="color:#FF0000;">"&lt;?php echo htmlspecialchars($subject) ?&gt;"</span>&gt;&lt;/td&gt;&lt;/tr&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &lt;tr&gt;&lt;td valign=<span style="color:#FF0000;">"top"</span>&gt;Message :&lt;/td&gt;&lt;td&gt;&lt;textarea <span style="color:#000000; font-weight:bold;">class</span>=<span style="color:#FF0000;">"contact_input"</span> rows=<span style="color:#FF0000;">"8"</span> cols=<span style="color:#FF0000;">"50"</span> name=<span style="color:#FF0000;">"message"</span>&gt;&lt;?php <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <a href="http://www.php.net/htmlspecialchars"><span style="color:#000066;">htmlspecialchars</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$message</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?&gt;&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td align=<span style="color:#FF0000;">"left"</span>&gt;&lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"Send Message"</span>&gt; &lt;input type=<span style="color:#FF0000;">"reset"</span> value=<span style="color:#FF0000;">"Reset Form"</span>&gt;&lt;/td&gt;&lt;/tr&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&lt;/table&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&lt;/form&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hxbro.com/2007/02/25/php-contact-form-with-simple-spam-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Email Address Validation</title>
		<link>http://www.hxbro.com/2007/02/25/php-email-address-validation/</link>
		<comments>http://www.hxbro.com/2007/02/25/php-email-address-validation/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 16:48:45 +0000</pubDate>
		<dc:creator>HxBro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.hxbro.com/2007/02/25/php-email-address-validation/</guid>
		<description><![CDATA[I've built up various libraries of code over the years, always improving and changing. This bit of code should attempt to validate an email address, it first checks the format of it is correct then does an mx check on the domain name, I built the function based on various bits and bobs from around [...]]]></description>
			<content:encoded><![CDATA[<p>I've built up various libraries of code over the years, always improving and changing. This bit of code should attempt to validate an email address, it first checks the format of it is correct then does an mx check on the domain name, I built the function based on various bits and bobs from around the Internet, or from the www.php.net website which has some excellent examples in the documentation. If I don't give credit it's because I can't remember where I got the code from!<br />
<span id="more-30"></span></p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showPlainTxt('php-5'); return false;">Show Plain Text Version</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#000000; font-weight:bold;">function</span> check_email_address<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$email</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// First, we check that there's one @ symbol, and that the lengths are right</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/ereg"><span style="color:#000066;">ereg</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"^[^@]{1,64}@[^@]{1,255}$"</span>, <span style="color:#0000FF;">$email</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Split it into sections to make life easier</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$email_array</span> = <a href="http://www.php.net/explode"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"@"</span>, <span style="color:#0000FF;">$email</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$local_array</span> = <a href="http://www.php.net/explode"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"."</span>, <span style="color:#0000FF;">$email_array</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span> = <span style="color:#CC66CC;color:#800000;">0</span>; <span style="color:#0000FF;">$i</span> &lt;sizeof<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$local_array</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#0000FF;">$i</span>++<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/ereg"><span style="color:#000066;">ereg</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"^(([A-Za-z0-9!#$%&amp;'*+/=?^_`{|}~-][A-Za-z0-9!#$%&amp;'*+/=?^_`{|}~<span style="color:#000099; font-weight:bold;">\.</span>-]{0,63})|(<span style="color:#000099; font-weight:bold;">\"</span>[^(<span style="color:#000099; font-weight:bold;">\\</span>|<span style="color:#000099; font-weight:bold;">\"</span>)]{0,62}<span style="color:#000099; font-weight:bold;">\"</span>))$"</span>, <span style="color:#0000FF;">$local_array</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/ereg"><span style="color:#000066;">ereg</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"^<span style="color:#000099; font-weight:bold;">\[</span>?[0-9<span style="color:#000099; font-weight:bold;">\.</span>]+<span style="color:#000099; font-weight:bold;">\]</span>?$"</span>, <span style="color:#0000FF;">$email_array</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Check if domain is IP. If not, it should be valid domain name</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$domain_array</span> = <a href="http://www.php.net/explode"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"."</span>, <span style="color:#0000FF;">$email_array</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/sizeof"><span style="color:#000066;">sizeof</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$domain_array</span><span style="color:#006600; font-weight:bold;">&#41;</span> &lt;<span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>; <span style="color:#FF9933; font-style:italic;">// Not enough parts to domain</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span> = <span style="color:#CC66CC;color:#800000;">0</span>; <span style="color:#0000FF;">$i</span> &lt;sizeof<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$domain_array</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#0000FF;">$i</span>++<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/ereg"><span style="color:#000066;">ereg</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$"</span>, <span style="color:#0000FF;">$domain_array</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// mx check</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$strDot</span>&nbsp; &nbsp; &nbsp; = <span style="color:#FF0000;">'.'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$strAfterAt</span>&nbsp; = <a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strstr"><span style="color:#000066;">strstr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$email</span>, <span style="color:#FF0000;">'@'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$chunks</span>&nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/explode"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strDot</span>, <span style="color:#0000FF;">$strAfterAt</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$cntChunks</span>&nbsp; = <a href="http://www.php.net/count"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$chunks</span><span style="color:#006600; font-weight:bold;">&#41;</span> - <span style="color:#CC66CC;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#0000FF;">$strDomain</span> = <span style="color:#0000FF;">$chunks</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cntChunks</span>-<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span> . <span style="color:#0000FF;">$strDot</span> . <span style="color:#0000FF;">$chunks</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$cntChunks</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/getmxrr"><span style="color:#000066;">getmxrr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$strDomain</span>, <span style="color:#0000FF;">$mxhosts</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp;&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>to call just use:</p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">Show Plain Text Version</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#0000FF;">$email</span> = <span style="color:#FF0000;">"email@domain.com"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>check_email_address<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$email</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// email looks valid</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#616100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// email not valid</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal; font-size: 8ptcolor:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 8pt"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hxbro.com/2007/02/25/php-email-address-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
