<?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>eli geske</title>
	<atom:link href="http://eligeske.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://eligeske.com</link>
	<description>Good information for the geeky kind.</description>
	<lastBuildDate>Tue, 15 May 2012 00:20:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Dynamically Delete an Object&#8217;s Property in PHP</title>
		<link>http://eligeske.com/php/dynamically-delete-an-objects-property-in-php/</link>
		<comments>http://eligeske.com/php/dynamically-delete-an-objects-property-in-php/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 21:17:19 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[delete property]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=799</guid>
		<description><![CDATA[Here is how to access an Object Property with a string so you don't run into this: "Fatal error: Cannot use object of type ... as array".  This example shows how to delete a property via a string. ]]></description>
			<content:encoded><![CDATA[<p>You can delete an object&#8217;s property using unset.</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$object</span><span class="sy0">-&gt;</span><span class="me1">property_name</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>But if you want to access it using a string you need to be a little more creative.  Why? Because if you enter this:</p>
<p><span style="color: #ff0000;"><strong>WRONG WAY:</strong></span></p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$object</span><span class="br0">&#91;</span><span class="st0">&quot;property_name&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>You will end up with: <strong>&#8220;Fatal error: Cannot use object of type &#8230; as array&#8221;</strong></p>
<p><span style="color: #339966;"><strong>CORRECT WAY:</strong></span></p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$object</span><span class="sy0">-&gt;</span><span class="br0">&#123;</span><span class="st0">&quot;property_name&quot;</span><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p><span style="text-decoration: underline;">And that&#8217;s how you make an ice cream sunday&#8230;. Wait&#8230;.. wrong post&#8230;.</span></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/dynamically-delete-an-objects-property-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>STOP SPAM in your wordpress comments&#8230;. FREEEEEEE!  (a little advanced so hold on tight)</title>
		<link>http://eligeske.com/wordpress/stop-spam-in-your-wordpress-comments-freeeeeee-a-little-advanced-so-hold-tight/</link>
		<comments>http://eligeske.com/wordpress/stop-spam-in-your-wordpress-comments-freeeeeee-a-little-advanced-so-hold-tight/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 14:57:11 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[stop spam]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=759</guid>
		<description><![CDATA[This edits the core code of WordPress, but it works to eliminate WordPress Spam Comments.  Use at your own risk.................. or don't use it and keep getting spammed.]]></description>
			<content:encoded><![CDATA[<p>Before you can stop those pesky wordpress spammers you need to understand how they work.</p>
<p>AND THE WORD ISSSSSSSSSS &#8220;BOT!&#8221;</p>
<p>There are several different ways to prevent them from getting their nasty data into your database. One of those ways is editing your .htaccess file. This works, kind of. But you could also be stopping bots that are good.  Also, I know since I have written bots before that you can spoof a real browser.  So what good does that do.</p>
<p>The method I am about to show you stops 100% of all bots spam comments, but it takes editing the core code. So everytime you update your WordPress, guess what.  You have to do these steps again. But hey, it&#8217;s free dammit.  And I would rather do it once every update than having to manage some tool that makes me sift through all the spammed comments to filter them.  This method doesn&#8217;t even let them in the door.</p>
<p>Back to how BOTS work, a real basic explanation.</p>
<ol>
<li>They search the web for WordPress Websites and find http://yourwebsite.com/wp-comments-post.php.</li>
<li>It creates the message it wants to send, creating the POST values for the Name, Email, Comment, URL.</li>
<li>Bam send!</li>
</ol>
<p>Can anyone see the pattern? Exactly, every WordPress install always looks for Name, Email, Comment, URL.  These names can help certain things, but there are other descriptor like ALT that can be used.   (Hey WordPress, how about you randomize those field names with one of those cool functions you guys like making? Or do they have stock in Akismet?)</p>
<p>Anyways&#8230;&#8230;. What if every WordPress site looked for different Names for their post values?  Well then the BOTs would have to get smarter. It&#8217;s not that way, so we are good in using this method without the worries of them having to get too smart.</p>
<p>For this to work, you need to have a basic understanding of PHP and how form Posts work.   So here is a quick over view on how HTML sends values to PHP to save:</p>
<p><a href="#codeStart_2">SKIP HTML/POST Overview, go straight to editing example.</a></p>
<p>HTML: (html form with an input and submit button)<br />
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/form.html"><span class="kw2">form</span></a> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">&quot;post&quot;</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">&quot;myformmethod.php&quot;</span>&gt;</span>
	<span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;elis_email&quot;</span> <span class="sy0">/</span>&gt;</span>
	<span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;send&quot;</span> <span class="sy0">/</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/form.html"><span class="kw2">form</span></a>&gt;</span></pre></div></div></p>
<p>So you have a form that is going to send elis_email to the server to save.</p>
<p>PHP: (Catches the form you just sent and it&#8217;s values)<br />
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="co1">// get eli's email</span>
<span class="re0">$elis_email</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;elis_email&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// save it somewhere with a made up function</span>
saveIt<span class="br0">&#40;</span><span class="re0">$elis_email</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</span></pre></div></div></p>
<p>Ok, as you can see the $_POST value we grab is the same as the NAME in the form input. You with me so far?  We then assign it to a variable called $elis_name and send it into a function to save. (This is just a made up function for explanation purposes only)</p>
<p>Now that you see how this works.  If someone wanted to go through all of Eli&#8217;s websites and send a SPAM message, all it would have to know is that in &lt;input type=&#8221;text&#8221; name=&#8221;elis_email&#8221; /&gt;  I use the name=&#8221;elis_email&#8221; on all my forms. (Which I don&#8217;t). Which is pretty much what the spammers are doing for wordpress sites. They know what all the form field names are and can just shotgun blast out messages at the PHP of wordpress, and guess what. They are successful, unless you have code that goes and checks the IP for black listing, bla bla bla.  Why let them in and then give them a pat down for their credentials when you can just stop them before they even make it to the front door.</p>
<p>Ok here is a simple example on how the same code above works with a total random form field name.</p>
<p>HTML:<br />
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/form.html"><span class="kw2">form</span></a> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">&quot;post&quot;</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">&quot;myformmethod.php&quot;</span>&gt;</span>
	<span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;A_randomBlaFaskjdL&quot;</span> <span class="sy0">/</span>&gt;</span>
	<span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;send&quot;</span> <span class="sy0">/</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/form.html"><span class="kw2">form</span></a>&gt;</span></pre></div></div></p>
<p>As you can see the random mess above.  Who the heck is going to guess that?</p>
<p>PHP:<br />
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="kw2">&lt;?php</span>
<span class="co1">// get eli's email</span>
<span class="kw2">var</span> elis_email <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;A_randomBlaFaskjdL&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// save it somewhere with a made up function</span>
saveIt<span class="br0">&#40;</span>elis_email<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy1">?&gt;</span></pre></div></div></p>
<p>Both codesets have the exact same results to the server. No difference, except for johnny spammer totally missed because he sent the value set as elis_email.  HA!  Missed us!</p>
<p><strong id="codeStart_2">HERE IS THE STOP SPAM CORE EDIT IN WORDPRESS:</strong></p>
<p>Just like the big bold letters above say, you will be editing the core wordpress files and perhaps your theme.</p>
<p>Here is what you will need to do:</p>
<ol>
<li>You need to check your theme comments.php to see if they are creating a custom comment form or they are using the built in WordPress comment form.</li>
<li>Edit either your theme form field names or the wordpress default ones.</li>
<li>Edit the POST catch in wordpress core code to accept your new names that you created.</li>
<li>Done.</li>
</ol>
<p>FIRST AND FOREMOST! BACKUP YOUR ENTIRE FILE STRUCTURE!</p>
<p><span style="text-decoration: underline;"><strong>STEP ONE &amp; TWO: (Locate the file that creates the html values and edit them)</strong></span></p>
<p>Go to your theme folder and locate the comments.php file.</p>
<p>EXAMPLE A: If your theme has a custom comment template you should change it to look similar to this:</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="re0">$fields</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span>
<span class="st_h">'author'</span> <span class="sy0">=&gt;</span> <span class="st_h">'&lt;input  name=&quot;Axcvxsaf&quot; class=&quot;text inp&quot; type=&quot;text&quot; value=&quot;'</span> <span class="sy0">..........</span>
<span class="st_h">'email'</span> <span class="sy0">=&gt;</span> <span class="st_h">'&lt;input  name=&quot;vxceDf&quot; class=&quot;text inp&quot; ......................
'</span>url<span class="st_h">' =&gt; '</span><span class="sy0">&lt;</span>input  name<span class="sy0">=</span><span class="st0">&quot;lxjkhss&quot;</span> <span class="kw2">class</span><span class="sy0">=</span><span class="st0">&quot;text inp&quot;</span> type<span class="sy0">=</span><span class="st0">&quot;text&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;' . .....................
);
&nbsp;
comment_form( array('fields' =&gt; <span class="es4">$fields</span> ,'comment_field' =&gt; '&lt;textarea name=&quot;</span>Dxjkhss<span class="st0">&quot;..</span></pre></div></div>
<p>EXAMPLE B: If your theme uses the WordPress built-in comments it will look more like this, and you will not edit it here, you need to go to the core code:</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;">comment_form<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>If your&#8217;s looks like example A, then change all the name attributes in your fields to some random stuff, different for each field and save them to a text pad or something. Make sure you note which random string equals what. You don&#8217;t want your Email going into the Comment field and your Comment field going into the URL. Well maybe you&#8217;re some weird entity and do, but I prefer mine not too.</p>
<p>If you have example B, you are going to have to find the core code for that.  (<strong>Please note: I recommend creating a custom Comment Field template in your theme. It will help out in the future, believe me</strong>).</p>
<p>Example B: Find /wp-includes/comment-template.php, open it up and do a search for &#8220;function comment_form(&#8220;.  This should take you straight to where you need to be.  In my wordpress version it is around line 1500.</p>
<p>Here is an image of the code, a little too much for me to paste in.  Open it up in separate window to get a good view of example.</p>
<div id="attachment_760" class="wp-caption alignnone" style="width: 310px"><a href="http://eligeske.com/wp-content/uploads/2012/04/change_wordpress_commentform_names.jpg"><img class="size-medium wp-image-760" title="change_wordpress_commentform_names" src="http://eligeske.com/wp-content/uploads/2012/04/change_wordpress_commentform_names-300x151.jpg" alt="Changing wordpress core comment form names" width="300" height="151" /></a><p class="wp-caption-text">How to change core comment form names</p></div>
<p>&nbsp;</p>
<p><strong>STEP THREE: (Change wordpress&#8217;s PHP file that catches the form post to match your new values)</strong></p>
<p>Hopefully step 1/2 went painlessly for you. If not drop a comment.   Onward! To Step Three!</p>
<p>Find this file: /wp-comments-post.php  (right in the root directory)</p>
<p>This file is a lot smaller than the one that contained comment_form function.  So it shouldn&#8217;t be a problem for you to locate the following lines:</p>
<p><strong>/wp-comments-post.php</strong></p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="re0">$comment_author</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'author'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><a href="http://www.php.net/strip_tags"><span class="kw3">strip_tags</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'author'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_author_email</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'email'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'email'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_author_url</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'url'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'url'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_content</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'comment'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'comment'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span></pre></div></div>
<p>Can anyone guess what we are about to do?  If not, you may want to scroll back to the top and read how the form post works with PHP a couple more times.</p>
<p>For those of you who know, we are about to edit the $_POST[""] values to match the names we created in Step 1/2. Hopefully you wrote them down in respect to where they go.</p>
<p>So here is the edited version:</p>
<p><strong>  /wp-comments-post.php (after edit)</strong></p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://eligeske.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://eligeske.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="co1">//$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;</span>
<span class="co1">//$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null;</span>
<span class="co1">//$comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null;</span>
<span class="co1">//$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;</span>
&nbsp;
<span class="re0">$comment_author</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForAuthor'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><a href="http://www.php.net/strip_tags"><span class="kw3">strip_tags</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForAuthor'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_author_email</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForEmail'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForEmail'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_author_url</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForURL'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForURL'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span>
<span class="re0">$comment_content</span> <span class="sy0">=</span> <span class="br0">&#40;</span> <a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForContent'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'WhatIcreatedForContent'</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="kw4">null</span><span class="sy0">;</span></pre></div></div>
<p>Notice that the values are &#8220;WhatIcreatedForAuthor&#8221; etc etc.  In the Popup image I used &#8220;asd23jfs&#8221; for Author, so if you used that in your code. DON&#8217;T!  If everyone uses what I posted then Bots will start seeing the pattern. The entire idea is everyone uses different names.  Sorry about being so cynical, but&#8230;. come on.    So match up the $_POST["Values"] to the Names you created in your theme form or comment_form function.  I commented out the old code just for reference purposes.  Once you have them edited save your form.</p>
<p>Now I recommend doing a test comment to verify you didn&#8217;t break anything, after all you were editing a core file.  If you broke it, reload your backup and try again. If you get the comment you are good to go and you will notice your spam is eliminated, minus trackbacks.</p>
<p>Finished? Your email server will thank you.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/wordpress/stop-spam-in-your-wordpress-comments-freeeeeee-a-little-advanced-so-hold-tight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

