<?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>Php Development &#187; anti spam</title>
	<atom:link href="http://www.maheshchari.com/tag/anti-spam/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maheshchari.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 17 Jan 2012 02:42:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>email domain really exists</title>
		<link>http://www.maheshchari.com/email-domain-really-exists/</link>
		<comments>http://www.maheshchari.com/email-domain-really-exists/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 07:28:44 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=573</guid>
		<description><![CDATA[How to check users email address domain really exists? We know how spam bothers much on contact pages of web application,even we use captcha ,there will be manually generated spam. And we don&#8217;t know given email address is fake or real. Good thing is that we can check is given email address fake or not [...]]]></description>
			<content:encoded><![CDATA[<h1>How to check users email address domain really exists?</h1>
<p>We know how spam bothers much on contact pages of web application,even we use captcha ,there will be manually generated spam.<br />
And we don&#8217;t know given email address is fake or real. </p>
<p>Good thing is that we  can check is given email address fake or not with php .For this PHP has handy function that checks the email domain for real time exists.</p>
<p>Bad thing is that this function is not bundled until 5.3 on windows server.</p>
<h2>checkdnsrr</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> is_emaildomain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>bool<span style="color: #009900;">&#41;</span><span style="color: #990000;">checkdnsrr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^[^@]++@/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MX'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=573&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/email-domain-really-exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>real ip address</title>
		<link>http://www.maheshchari.com/real-ip-address/</link>
		<comments>http://www.maheshchari.com/real-ip-address/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 13:02:18 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>
		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=226</guid>
		<description><![CDATA[A simple function to find the real IP address of the client with php As the internet growing as long as spamming,hacking,fishing,bots also increasing,there by normal user can easly decepted by with them. in many security application we need to find the real ip address to ban or record the ip related activities.here we use [...]]]></description>
			<content:encoded><![CDATA[<h1>A simple function to find the real IP address of the client with php</h1>
<p>As  the internet growing as long as spamming,hacking,fishing,bots also increasing,there by normal user can easly decepted by with them. in many security application we need to find the real <strong>ip address</strong> to ban or record the ip related activities.here we use small function that returns and modify the PHP global r<strong>emote address </strong>variable.</p>
<p>Usually we&#8217;ll use $_SERVER['REMOTE_ADDR'] to get clients IP address. But this doesn&#8217;t return the real IP address all time. Basically when someone using PROXY that valiable returns proxy IP the client using. So here&#8217;s a function you can use to detect real ip address of client. Here are extra Server variable which might be available to determine the exact IP address of the client’s machine in PHP, they are HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> real_ip<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: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_FORWARDED_FOR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<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: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_FORWARDED_FOR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REAL_IP'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</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: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REAL_IP'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</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: #009900;">&#125;</span></pre></td></tr></table></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=226&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/real-ip-address/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>check ajax request</title>
		<link>http://www.maheshchari.com/check-ajax-request/</link>
		<comments>http://www.maheshchari.com/check-ajax-request/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 22:18:34 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[anti spam]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=224</guid>
		<description><![CDATA[how to find the given request from ajax with php In my recent project ,i have to restrict a page from direct accessing from browser with typing address on browser .this page must only accessible with ajax only.thank god there is a solution to find this with php server global variable that works with php5.then [...]]]></description>
			<content:encoded><![CDATA[<h1>how to find the given request from <strong>ajax </strong>with php</h1>
<p>In my recent project ,i have to restrict a page from direct <strong>accessing </strong>from browser with typing address on browser .this page must only accessible with ajax only.thank god there is a solution to find this with <strong>php server global </strong>variable that works with php5.then i made it a simple following function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> is_Ajax<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'XMLHttpRequest'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=224&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/check-ajax-request/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>captcha php tutorial</title>
		<link>http://www.maheshchari.com/captcha-php-tutorial/</link>
		<comments>http://www.maheshchari.com/captcha-php-tutorial/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 12:10:56 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=148</guid>
		<description><![CDATA[A simple php captcha image tutorial Captcha is a test for user if he is real human or computer. In this example we use PHP GD2 functions to create the image on the fly. To test this functionality we need following files.We already discussed about anti spam web contact form in my provious post.this is [...]]]></description>
			<content:encoded><![CDATA[<h1>A simple php captcha image tutorial </h1>
<p>Captcha is a test for user if he is real human or computer. In this example we use PHP GD2 functions to create the image on the fly. To test this functionality we need following files.We already discussed about <a href="http://www.maheshchari.com/anti-spam-web-form/">anti spam web contact form</a> in my provious post.this is one of methods.<br />
<strong>Php_captcha.php :- </strong>in this file we create the captcha image and store the data in PHP session.<br />
<strong>Captcha_test.phpl :-</strong> in this file we run the user form and validate the user for is he bot or not.<br />
<strong>captcha.JPG :-</strong> this image is used as back ground for generated PHP captcha. This file must have at least read permission on the main server.</p>
<p>You can download the source code here and you can test in your local server. Remember your PHP must have GD extension to run this example. You can read comments on the script for detail explanation.</p>
<h3>Example source Code</h3>
<p><a href='http://www.maheshchari.com/wp-content/uploads/2009/06/php_captcha_example.rar'>php_captcha_example_tutorial_source code</a></p>
<h3>Example source Code</h3>
<p><a href='http://www.maheshchari.com/wp-content/uploads/2009/06/php_captcha_example.rar'>php_captcha_example_tutorial_source code</a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=148&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/captcha-php-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>protecting web contact forms from spam bots</title>
		<link>http://www.maheshchari.com/anti-spam-web-form/</link>
		<comments>http://www.maheshchari.com/anti-spam-web-form/#comments</comments>
		<pubDate>Sat, 16 May 2009 07:06:22 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=58</guid>
		<description><![CDATA[Protecting web forms from spam bots using PHP Spam bot is a program that submits the data to server by guessing form fields with html code. For detailed article please refer my previous post. Here some methods of preventing Spam bots that automatically submits. Using captcha Using random hidden field Using hidden input text box. [...]]]></description>
			<content:encoded><![CDATA[<h1>Protecting web forms  from spam bots using PHP</h1>
<p>Spam bot is a program that submits the data to server by guessing form fields with html code.<br />
For detailed article please refer my <a href="http://www.maheshchari.com/email-obfuscation/">previous post</a>.</p>
<h3>
Here some methods of preventing Spam bots that automatically submits.</h3>
<ul>
<li><a href="http://www.maheshchari.com/captcha-php-tutorial/">Using captcha</a></li>
<li>Using random hidden field</li>
<li>Using hidden input text box.  </li>
<li>Email header injecting.</li>
<li>Checking referrer page</li>
<li>Following basic rules</li>
</ul>
<p>We can prevent the Spam bots with some basic rules<br />
Prevent email harvesting on your web pages, see my previous post <a href="http://www.maheshchari.com/email-obfuscation/">anti email harvesting</a>.<br />
Generally Spam bots looks for form tag and contained input, check box, radio boxes, option element (Hhhh all the form elements), fills their data with their spam data so we can take this as advantage, some spam bots stores this information and sends with proxy without resubmitting the web contact form, so we can prevent this type of technics.<br />
Use deferent form fields than usually, like use ‘ xyz_nm’ instead ‘name’.Change the form field’s name in regular interval, like put ‘zmon_nm’ on ‘Monday’, ‘ztue_nm’ on ‘Tuesday’.<br />
Use random named hidden input field with a default value is empty on every form submission like captcha, if the default value of the hidden field changed other than default, it is sure Spam.<br />
Put one input text box element with random name and hide it with CSS style, since it won’t visible to general user, the default value could not changed, if any changes made to this value of input it is definitely Spam.<br />
Don’t put email address in the form elements, instead put it in sever side variable.<br />
Check for page referrer, however some server’s firewalls don’t allow this information, they strips the data.<br />
Use captcha like methods or services that are available present , but this captcha has some inconvenience to the user.<br />
Disabling or filtering HTML  message in form elements, since maximum spam bots try to fill HTML data.<br />
Make sure to access all the forms for login users and track down their messaging and ban certain user.<br />
<a href="http://www.maheshchari.com/wp-content/uploads/2009/05/protect-web-form-from-spams-maheshcharicom.jpg"><img src="http://www.maheshchari.com/wp-content/uploads/2009/05/protect-web-form-from-spams-maheshcharicom-300x246.jpg" alt="protect-web-form-from-spams-maheshcharicom" title="protect-web-form-from-spams-maheshcharicom" width="300" height="246" class="alignnone size-medium wp-image-66" /></a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</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;">#function that validate the user email
</span><span style="color: #000000; font-weight: bold;">function</span> is_valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$eregpat</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;^[A-z][A-z0-9_-]+([.]([A-z0-9_-])+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eregpat</span><span style="color: #339933;">,</span><span style="color: #000088;">$email</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#function that validate user comments
</span><span style="color: #000000; font-weight: bold;">function</span> is_valid_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">#function that clean the user data againest 
</span><span style="color: #666666; font-style: italic;">#email header injection so we clean it
</span><span style="color: #000000; font-weight: bold;">function</span> safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">#clean non standerd alpha numeric and some special symbels
</span><span style="color: #666666; font-style: italic;">#clean email related headers like header,from,body,'cc','bcc',\r\n etc
</span><span style="color: #000088;">$patterns</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[^a-zA-Z0-9\.-@_]/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'from'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'header'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'body'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CC'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'BCC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$patterns</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</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: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> send_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">#do what ever you want here with user data
</span><span style="color: #666666; font-style: italic;">#like storing into database or sending email to admin
</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#clean all data from user contact form and process this to store in mysql and sending email
</span>
<span style="color: #000000; font-weight: bold;">function</span> process_contactform<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sfsf_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'website'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'kipmp_website'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>safe_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
send_mail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'recaptchalib.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get a key from http://recaptcha.net/api/getkey</span>
<span style="color: #000088;">$publickey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6LdVSQYAAAAAAFwb2919Sf8Uhcq3Z55bQc7d8Bx0&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$privatekey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;6LdVSQYAAAAAAIVT-VaJlea6WuOlLqJtt0UUK6xZ&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># the response from reCAPTCHA
</span><span style="color: #000088;">$resp</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">#error cacher
</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;"># was there a reCAPTCHA response?
</span><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_response_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$resp</span> <span style="color: #339933;">=</span> recaptcha_check_answer <span style="color: #009900;">&#40;</span><span style="color: #000088;">$privatekey</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_challenge_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                                        <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;recaptcha_response_field&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$resp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_valid</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;You got it!&quot;</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: #666666; font-style: italic;"># set the error code so that we can display it
</span>                <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$resp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check the page that submits is belong to our domai or not
</span><span style="color: #666666; font-style: italic;">#remember some servers don't allow this data or don't have information
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</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;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'This page can be prcessed from this domain only.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check email validation
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span>is_valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jflsjls_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Invalid email address.'</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check comment validation 
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span>is_valid_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comments_sfs'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Trying to email header injection.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check user is bot or not
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'owjrj_ran'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'owjrj_ran'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'You are spam bot.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check user is bot or not
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mpmpm_rwrw'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #339933;">!</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mpmpm_rwrw'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'You are spam bot.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#check all errors and process contact form
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> and <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
process_contactform<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#if errors display
</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul class=&quot;errors&quot; &gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$v</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h2>HTML code</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;title&gt;Contact Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;
&lt;script type=&quot;text/javascript&quot;&gt;
&nbsp;
/*
This javascript form validation only for generel users.
the spam bots don't process this type javascript validation so we have to 
validate again on server side.
*/
function validate_form(){
&nbsp;
var errors='';
&nbsp;
var fm=document.contactform;
&nbsp;
if(fm.jflsjls_email.value==''){
errors+='Email required.\n';
}
&nbsp;
if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(fm.jflsjls_email.value))){
errors+='Invalid email address.\n';
}
&nbsp;
if(fm.comments_sfs==''){
errors+='Empty comments.\n';
}
&nbsp;
if(errors!=&quot;&quot;){
alert(errors);
return false;
}
return true;
}
&lt;/script&gt;
&lt;form action=&quot;&quot; method=&quot;post&quot; name=&quot;contactform&quot; id=&quot;contactform&quot; onsubmit=&quot;return validate_form();&quot;&gt;
  &lt;table width=&quot;500&quot; border=&quot;1&quot;&gt;
    &lt;tr&gt;
      &lt;th colspan=&quot;2&quot;&gt;Contact Me
        &lt;script&gt;
		//email obfuscation 
document.write(&quot;m&quot;+&quot;y&quot;+&quot;m&quot;+&quot;a&quot;+&quot;i&quot;+&quot;l&quot;+&quot; &amp;#64;&quot;+&quot;y&quot;+&quot;o&quot;+&quot;u&quot;+&quot;d&quot;+&quot;o&quot;+&quot;m&quot;+&quot;a&quot;+&quot;i&quot;+&quot;n&quot;+&quot; &amp;#46&quot;+&quot;c&quot;+&quot;o&quot;+&quot;m&quot;);
&lt;/script&gt;      &lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width=&quot;295&quot;&gt; Name &lt;/td&gt;
      &lt;td width=&quot;288&quot;&gt;&lt;input name=&quot;sfsf_name&quot; type=&quot;text&quot; id=&quot;sfsf_name&quot; /&gt;      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Email: * &lt;/td&gt;
      &lt;td&gt;&lt;input name=&quot;jflsjls_email&quot; type=&quot;text&quot; id=&quot;jflsjls_email&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; Web Site &lt;/td&gt;
      &lt;td&gt;&lt;input name=&quot;kipmp_website&quot; type=&quot;text&quot; id=&quot;kipmp_website&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot;&gt;
	  &lt;!-- 
	  hidden field that real user can't see ,only spam bots can process
	  in some spam bots this hidden field don't change the value ,
	  they submit as it is
	   --&gt;
	  &lt;input name=&quot;owjrj_ran&quot; type=&quot;hidden&quot; id=&quot;owjrj_ran&quot; /&gt;
	  &lt;!--
	  to overcome we use text field that is hidden from real user.
	  but this field is precessed by spam bots.
	  it is simply .
	   --&gt;
        &lt;input name=&quot;mpmpm_rwrw&quot; type=&quot;text&quot; id=&quot;mpmpm_rwrw&quot; style=&quot;display:none&quot; value=&quot;&quot; /&gt;
        Comments*&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot;&gt;&lt;textarea name=&quot;comments_sfs&quot; cols=&quot;45&quot; rows=&quot;5&quot;&gt;&lt;/textarea&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;
	  &lt;!-- 
	  recaptcha text area field
	  this is another guarented check.
	  but it is not user freindly 
	   --&gt;
	  &lt;?php echo recaptcha_get_html($publickey, $errors);?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;2&quot; align=&quot;center&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot; /&gt;
        &lt;input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;Reset&quot; /&gt; 
        &lt;small&gt;* Required field &lt;/small&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<h3>Download Source Code</h3>
<p><a href='http://www.maheshchari.com/anti-spam-web-form/web-contact-form-with-anti-spam-methods/' rel='attachment wp-att-69'>web-contact-form-with-anti-spam-methods download link here</a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=58&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/anti-spam-web-form/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>email obfuscation</title>
		<link>http://www.maheshchari.com/email-obfuscation/</link>
		<comments>http://www.maheshchari.com/email-obfuscation/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:47:37 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[anti spam]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=55</guid>
		<description><![CDATA[protecting E-mail Address on web pages with php, javascript from E-mail spammers E-mail Spam is flooding the Internet with many copies of the same message, in an attempt to force the message on people who would not otherwise choose to receive it.Most spam is Commercial advertising, often for dubious products, get-rich-quick schemes, or quasi-legal services. [...]]]></description>
			<content:encoded><![CDATA[<h1>protecting E-mail Address on web pages with php, javascript from E-mail spammers</h1>
<p>E-mail Spam is flooding the Internet with many copies of the same message, in an attempt to force the message on people who would not otherwise choose to receive it.Most spam is Commercial advertising, often for dubious products, get-rich-quick schemes, or quasi-legal services. Spam costs the sender very little to send &#8212; most of the costs are paid for by the recipient or the carriers rather than by the sender.</p>
<h3>How do they catch email address of users? Or how do they email harvesting?</h3>
<p>There are many ways to get users email address but here we talk about only two ways.</p>
<h3>From  web pages:</h3>
<p>Spammers have programs which spider through web pages, looking for email addresses, e.g. email addresses contained in mailto: HTML tags [those you can click on and get a mail window opened],a word contains @ symbol ,a word contains mailto:</p>
<h3>From various web contact or enquiry  forms.</h3>
<p>Some sites request various details via forms, e.g. guest books &amp; registrations forms.<br />
Spammers can get email addresses from those either because the form becomes available<br />
on the world wide web, or because the site sells / gives the emails list to others.<br />
some spammers use weak security web forms on certain websites to protect web form from spammers <a href="http://www.maheshchari.com/anti-spam-web-form/">please refer my post</a></p>
<h2>Preventing E-mail harvesting on web pages</h2>
<h3>e-mail Address munging or e-mail Obfuscation</h3>
<p>Address munging is the practice of disguising, or munging, to prevent it being automatically collected by spam bots.<br />
Some examples are</p>
<ul>
<li>no-one at example (dot) com</li>
<li>no-one@elpmaxe.com.invalid</li>
<li>moc.elpmaxe@eno-on</li>
<li>no-one@exampleREMOVEME.com.invalid</li>
<li>remove .invalid</li>
<li>no-one@exampleNOSPAM.com.invalid</li>
<li>n o &#8211; o n e @ e x a m p l e . c o m</li>
<li>no-one<em>@</em>example<em>.</em>com (as HTML)</li>
</ul>
<p>Even though the email harvesting reduced in measurable amount, with this method the main user has to predict the original. Now days some spam bots also overcomes this method.</p>
<h2>Using javascript </h2>
<p>Most of the spam bots don’t execute the javascript and they use regular expression to catch the address.<br />
So we can advance the method of munging with following examples</p>
<h3>For static web pages e-mail Obfuscation </h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'user'</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> at <span style="color: #339933;">=</span> <span style="color: #3366CC;">'@'</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> domain <span style="color: #339933;">=</span> <span style="color: #3366CC;">'example.com'</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span> <span style="color: #339933;">+</span> at <span style="color: #339933;">+</span> domain<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>‘m’<span style="color: #339933;">+</span>’y’<span style="color: #339933;">+</span>’m’<span style="color: #339933;">+</span>’a’<span style="color: #339933;">+</span>’i’<span style="color: #339933;">+</span>’l’<span style="color: #339933;">+</span>’ <span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">64</span><span style="color: #339933;">;</span>’<span style="color: #339933;">+</span>’y’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’u’<span style="color: #339933;">+</span>’d’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’m’<span style="color: #339933;">+</span>’a’<span style="color: #339933;">+</span>’i’<span style="color: #339933;">+</span>’n’<span style="color: #339933;">+</span>’ <span style="color: #339933;">&amp;</span>#<span style="color: #CC0000;">46</span>’<span style="color: #339933;">+</span>’c’<span style="color: #339933;">+</span>’o’<span style="color: #339933;">+</span>’m’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #006600; font-style: italic;">//In the above example we use html equivalent ASCII chars &amp;#64 for  symbol and &amp;#46 for ‘.’ Character.</span></pre></td></tr></table></div>

<h3>
For dynamic web pages with PHP server side language e-mail Obfuscation</h3>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> safe_asciimail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$length</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</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;">$length</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$email_array</span><span style="color: #339933;">=</span><span style="color: #990000;">str_split</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ascii_email_array</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$c</span><span style="color: #339933;">=</span><span style="color: #000088;">$email_array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$ascii_email_array</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&amp;#'</span><span style="color: #339933;">.</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">';'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;script&gt; document.write(&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$ascii_email_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);&lt;/script&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//We can call this method as follow </span>
<span style="color: #666666; font-style: italic;">//safe_asciimail(‘mymail@yourdomain.com’);</span></pre></td></tr></table></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=55&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/email-obfuscation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

