<?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>Interactive Llama :: Interactive media tutorials and tips &#187; PHP</title>
	<atom:link href="http://www.interactivellama.com/blog/archives/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.interactivellama.com/blog</link>
	<description>Interactive media tutorials and tips</description>
	<lastBuildDate>Wed, 23 Nov 2011 15:25:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Hiding an email address from spambots and spiders</title>
		<link>http://www.interactivellama.com/blog/archives/hiding-an-email-address-from-spambots-and-web-spiders-less-spam/</link>
		<comments>http://www.interactivellama.com/blog/archives/hiding-an-email-address-from-spambots-and-web-spiders-less-spam/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 14:24:22 +0000</pubDate>
		<dc:creator>Stephen James</dc:creator>
				<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[crawlers]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spam-bots]]></category>

		<guid isPermaLink="false">/blog/?p=204</guid>
		<description><![CDATA[There is an army of spiders out there.  Some, like GoogleBot, you want scanning your site to be listed in their search engine. Many however have a devious purpose&#8211;to collect email addresses to add to spam email lists. If your email address is already out there, then there is no pulling it back in. The [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-266" title="spider-webs" src="http://www.interactivellama.com/blog/wp-content/uploads/2009/06/spider-webs.jpg" alt="spider-webs" width="510" height="283" /></p>
<p>There is an army of spiders out there.  Some, like GoogleBot, you want scanning your site to be listed in their search engine. Many however have a devious purpose&#8211;to collect email addresses to add to spam email lists. If your email address is already out there, then there is no pulling it back in. The only way to eliminate spam is to create a different address and inform all your contacts that you have changed email addresses.</p>
<p>Ways to combat email spam:</p>
<ul>
<li>A non-linked image</li>
<li>HTML entity encoding</li>
<li>Client-side obfuscation/abstraction (via JavaScript)</li>
<li>Server-side redirect</li>
<li>Contact form (no email address listed)</li>
</ul>
<p>If your email address, is spelled out with any client viewable code, it is possible to obtain. Now that search engines can read PDF documents, including your email within a PDF as text may be suspect. I have not gone into great depth on any of them below but have provided a short description of each method with advantages and disadvantages listed.<span id="more-204"></span></p>
<p><strong>A non-linked image</strong></p>
<ul>
<li><em>Anyone viewing images can see your address, but has to visually remember and re-type this address</em></li>
<li><em>Low chance of your email address being grabbed by a spam robot</em></li>
</ul>
<p>This is how Facebook displays email addresses in one’s profile. It is inconvenient to the user, since he or she cannot click the email address in order to send an email. The spider may grab one’s email address if a spam robot uses image reading (Optical Character Recognition) though this is unlikely at this time.</p>
<p><strong>HTML entity encoding</strong></p>
<ul>
<li><em>Anyone with a typical browser will be able to contact you</em></li>
<li><em>Medium to high chance of your email address being grabbed by a spam robot</em></li>
</ul>
<p>This method encodes certain characters of the email address into Unicode.  For instance, “Bob” in Unicode is “&amp;#66;&amp;#111;&amp;#98;” Since computers create Unicode, it does not seem like a hard task to decode from Unicode. I do not recommend this solution.</p>
<p><strong>Client-side obfuscation/abstraction (via JavaScript)<br />
</strong></p>
<ul>
<li><em>Anyone with a typical browser will be able to contact you</em></li>
<li><em>Low chance of your email address being grabbed by a spam robot</em></li>
</ul>
<p>This anti-spam solution is not a cure all&#8211;but it is my favorite right now. Some spider bots do run JavaScript. The majority of the spider robots do not however. The method described here not only prevents your email address from being obvious simple text, but it also performs levels of obfuscation and abstraction that makes it useable for actual browsers to read and gracefully degrade for those without JavaScript running.</p>
<p>In a related form, if you create your JavaScript function or call of the function on the server-side (ASP, PHP, etc) then you can <a href="http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=755">slightly change the function over a period of time</a>.  The user will never notice, since the output being given is exactly the same. It is only the input (the simple text) into the JavaScript function that is being changed.</p>
<p><strong>Server-side redirect</strong></p>
<ul>
<li><em>Anyone with a typical browser will be able to contact you</em></li>
<li><em>Medium to high chance of your email address being grabbed by a spam robot</em></li>
</ul>
<p>There are several ways to do this. Most redirect to a script that provides the email address. The problem with this solution is that spam robots will follow the link and eventually grab the URL although the email address is not in plain text. It is being given out. This is an <a href="http://jamesthornton.com/software/redirect-mailto.html">example of the server-side redirect method</a>. A similar solution is <a href="http://mailhide.recaptcha.net/">MailHide</a> from Captcha. I don’t recommend any use of Captcha except as a last resort, since I don’t enjoy using captchas myself.</p>
<p><strong>Contact form (no email address listed)</strong></p>
<ul>
<li><em>Anyone with a typical browser will be able to contact you, but will not know your email address<br />
</em></li>
<li><em>Next to no chance of your email address being grabbed by a spam robot</em></li>
</ul>
<p>This is guaranteed to save your email address from spam lists, since your email address is never used within your page. This solution could be annoying, since a potential vendor will have to use the contact form to hear more about your product. I’ve always thought this was impersonal. Although less of an issue for personal sites, a user often does not feel he or she is contacting the site owner.</p>
<p><strong>In conclusion</strong></p>
<p>The contact form is the only full-proof way, but right now, I prefer JavaScript obscuration. If my email address is captured, Gmail does a very good job (if sometimes, too aggressive) of ferreting out the email spam. If you&#8217;d like to have a small sense of justice, you can link your website to a <a href="http://towerofbabel.com/antispam/">multitude of email addresses</a> that are all fake.</p>
<p>Photo: Lake Tawakoni State Park, Texas, August 15, 2007 (Donna Garde)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivellama.com/blog/archives/hiding-an-email-address-from-spambots-and-web-spiders-less-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Features and characteristics of a great 404 error page</title>
		<link>http://www.interactivellama.com/blog/archives/features-and-characteristics-of-a-great-404-error-page/</link>
		<comments>http://www.interactivellama.com/blog/archives/features-and-characteristics-of-a-great-404-error-page/#comments</comments>
		<pubDate>Fri, 23 May 2008 14:02:23 +0000</pubDate>
		<dc:creator>Stephen James</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Productivity & Workflow]]></category>
		<category><![CDATA[404 error]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[site features]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">/blog/?p=125</guid>
		<description><![CDATA[No matter how carefully you design your site, visitors will always request a page that is missing, moved, or non-existent (especially if you experiment with your site structure frequently). This past week, I&#8217;ve been obsessed with HTTP 404 errors and working on creating a better 404 Not Found page. The default 404 page for WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>No matter how carefully you design your site, visitors will always request a page that is missing, moved, or non-existent (especially if you experiment with your site structure frequently). This past week, I&#8217;ve been obsessed with <a href="http://en.wikipedia.org/wiki/404_error">HTTP 404 errors</a> and working on creating a better 404 Not Found page. The default 404 page for WordPress offers the opportunity to search the blog, but you should go another step. Usability is one of (if not the) key trait of a great website. If thought has gone into <em>even</em> your 404 error page, then I&#8217;d guess that much thought has been put into your entire site.<span id="more-125"></span></p>
<p>Features and characteristics of a great 404 page:</p>
<ul>
<li> A link to the site map that lists all articles and the home page</li>
<li> A search box</li>
<li> A distinctly minimalist look</li>
<li>Remove the jargon (i.e.- what&#8217;s a 404?)</li>
<li>State the reasons someone would reach a 404 page (A mis-typed URL, a out-of-date search engine referral, a broken (in-site) link) and then do something about it</li>
<li> Notify with either a user input form or automatically with server side scripting the site owner so that the problem can be fixed (In WordPress, you can <a href="http://herselfswebtools.com/2007/11/email-yourself-when-someone-gets-a-404-error-on-your-site.html">email yourself</a> using the code at the end of this article)</li>
<li>Contact information for the site owner (after all, it&#8217;s your site that is broken)</li>
</ul>
<p>Most of this list is taken from A List Apart, <a href="http://www.alistapart.com/articles/perfect404/">The Perfect 404</a>. They use JavaScript to create many of the features above. Address the mis-typed URL by suggesting the visitor review the sitemap. You could tell them to look for some of the words in the URL. For the out-of-date search engine referral, you could grab the query string for popular search engines and add search results to the bottom of your error page.</p>
<p>As to a pleasing visual design (not to mention humorous content) of a 404 page be sure to look at <a href="http://www.smashingmagazine.com/2007/07/25/wanted-your-404-error-pages/">Smashing&#8217;s Magazine&#8217;s collection of 404 pages</a> and a <a href="http://www.smashingmagazine.com/2007/08/17/404-error-pages-reloaded/">second collection</a> for inspiration.</p>
<p><strong>What to do now</strong></p>
<p>If the fault is truly yours and the invalid URL was not created by a crawler bot grabbing email addresses or trying SQL insertions, then you should open up your <a href="http://www.javascriptkit.com/howto/htaccess.shtml">.htaccess file</a> and <a href="http://www.javascriptkit.com/howto/htaccess7.shtml">redirect them</a>. You shouldn&#8217;t have to use <a href="http://www.sitepoint.com/article/guide-url-rewriting">mod_write</a> and <a href="http://www.regular-expressions.info/">regular expressions</a> if you are soley creating a list of 1 to 1 relationship URLs. If you create websites for a living, I HIGHLY recommend familiarizing yourself with both powerful tools.</p>
<p><strong>Email the site owner the invalid URL in WordPress</strong></p>
<p>I recommend not sending this to your main email, but one of your secondary email addresses or filtering it to a folder (with the subject &#8220;[404 Error]&#8220;). I receive more than 10 notices a day from my sites. By placing the URL in the subject line, Gmail will group/thread message about same URL.</p>
<pre><code class="js">&lt;?php
$url = $_SERVER[ 'REQUEST_URI' ];
$message = "URL Requested: ".$url_requested;
wp_mail("youremail@gmail.com", "[404 Error] ".$url_requested, $message);
?&gt;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivellama.com/blog/archives/features-and-characteristics-of-a-great-404-error-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change media and images to full size in WordPress media gallery</title>
		<link>http://www.interactivellama.com/blog/archives/change-media-and-images-to-full-size-in-wordpress-media-gallery/</link>
		<comments>http://www.interactivellama.com/blog/archives/change-media-and-images-to-full-size-in-wordpress-media-gallery/#comments</comments>
		<pubDate>Thu, 22 May 2008 00:15:09 +0000</pubDate>
		<dc:creator>Stephen James</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Productivity & Workflow]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image width]]></category>
		<category><![CDATA[maximum image size]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plug_in]]></category>
		<category><![CDATA[Rachel Steely]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">/blog/?p=122</guid>
		<description><![CDATA[I&#8217;ve been familiarizing myself with WordPress 2.5&#8242;s new media gallery. If you&#8217;ve visited my blog before, you know I don&#8217;t upload many images, but I&#8217;m hoping to upload many images to my wife, Rachel Steely&#8217;s website. I was annoyed to find out that the default image posting size is medium (which is about 300px). On [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been familiarizing myself with WordPress 2.5&#8242;s new media gallery. If you&#8217;ve visited my blog before, you know I don&#8217;t upload many images, but I&#8217;m hoping to upload many images to my wife, <a href="http://www.rachelsteely.com">Rachel Steely&#8217;s website</a>. I was annoyed to find out that the default image posting size is medium (which is about 300px). On top of that, if you select full size, it doesn&#8217;t mean full size. It means your WordPress theme&#8217;s column width. So unless you are using Kubrick your media size will not be your column width.<span id="more-122"></span></p>
<p><strong>Change Full Size image width to match theme</strong></p>
<p>The column width in WordPress&#8217;s default theme Kubrick is 500px. Therefore, the default (maximum) image size is 500px. The column width of the blog I am posting to is 614px. You can set a global variable to change this setting. Create if not already existing functions.php in your theme directory. Define your maximum media width (that is &#8220;Full Size&#8221; in the Gallery interface):<br />
<code><br />
&lt;?php<br />
$content_width = 614;<br />
?&gt;</code></p>
<p>I&#8217;ve set mine to 614 pixels since that is the width of my div with the class  &#8220;.entry&#8221; minus padding. If this does not work, some have solved this problem with $GLOBALS['content_width'] = 614; also. You can view this setting at a post at <a href="http://www.rachelsteely.com/blog/photos-from-wheeler-spring-open-house/">RachelSteely.com</a>.</p>
<p><strong>Default media to Full Size</strong></p>
<p>I prefer to justify my media (align left and right) to the column width. To do this, set default selected size to &#8220;Full Size&#8221; by changing the code in /wp-admin/includes/media.php. Move the &#8216;checked&#8217; radio attribute from Medium to Full Size.</p>
<p>Line 458:<br />
<code><br />
" : '' ) . "&lt;input type='radio' name='attachments[$post-&gt;ID][image-size]' id='image-size-medium-$post-&gt;ID' value='medium' checked='checked' /&gt;<br />
&lt;label for='image-size-medium-$post-&gt;ID'&gt;" . __('Medium') . "&lt;/label&gt;<br />
&lt;input type='radio' name='attachments[$post-&gt;ID][image-size]' id='image-size-full-$post-&gt;ID' value='full' /&gt;<br />
</code></p>
<p>change to<br />
<code><br />
" : '' ) . "&lt;input type='radio' name='attachments[$post-&gt;ID][image-size]' id='image-size-medium-$post-&gt;ID' value='medium' /&gt;<br />
&lt;label for='image-size-medium-$post-&gt;ID'&gt;" . __('Medium') . "&lt;/label&gt;<br />
&lt;input type='radio' name='attachments[$post-&gt;ID][image-size]' id='image-size-full-$post-&gt;ID' value='full' checked='checked' /&gt;</code></p>
<p>And that&#8217;s it! Happy uploading with the new and improved (and customized) WordPress media gallery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivellama.com/blog/archives/change-media-and-images-to-full-size-in-wordpress-media-gallery/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Plain text link to HTML with a PHP function and regular expressions</title>
		<link>http://www.interactivellama.com/blog/archives/plain-text-link-to-html-with-a-php-function-and-regular-expressions/</link>
		<comments>http://www.interactivellama.com/blog/archives/plain-text-link-to-html-with-a-php-function-and-regular-expressions/#comments</comments>
		<pubDate>Wed, 07 May 2008 20:21:21 +0000</pubDate>
		<dc:creator>Stephen James</dc:creator>
				<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">/blog/archives/plain-text-link-to-html-with-a-php-function-and-regular-expressions/</guid>
		<description><![CDATA[If you have ever wanted to turn a plain text link, http://www.smjdesign.com, into a "linked" HTML version, http://www.smjdesign.com, you can now. Pass the following function your entire text field and it will find all your links and return tagged HTML. function replace_plain_text_link($plain_text) { $url_html = preg_replace( '/(?&#60;!S)((http(s?):\/\/)&#124;(www.))+([\w.1-9\&#38;=#?\-~%;\/]+)/', '&#60;a href="http$3://$4$5"&#62;http$3://$4$5&#60;/a&#62;', $plain_text); return ($url_html); } echo replace_plain_text_link("hi [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever wanted to turn a plain text link, http://www.smjdesign.com, into a "linked" HTML version, <a href="http://www.smjdesign.com">http://www.smjdesign.com</a>, you can now. Pass the following function your entire text field and it will find all your links and return tagged HTML.</p>
<pre><code>function replace_plain_text_link($plain_text) {
$url_html = preg_replace(
'/(?&lt;!S)((http(s?):\/\/)|(www.))+([\w.1-9\&amp;=#?\-~%;\/]+)/',
'&lt;a href="http$3://$4$5"&gt;http$3://$4$5&lt;/a&gt;', $plain_text);
return ($url_html);
}
echo replace_plain_text_link("hi this is dummy text before
http://www.smjdesign.com hi this is dummy text after")
</code></pre>
<p><span id="more-121"></span></p>
<p>The majority of the above regular expression was not created by me. I however cannot locate the original programmer. It was posted on a message board I visited along with ftp and mailto options. If you can help, please comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivellama.com/blog/archives/plain-text-link-to-html-with-a-php-function-and-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

