<?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>Make Money Blogging Tips For Free &#187; PHP</title>
	<atom:link href="http://webmasterweblog.com/category/programming/php/feed" rel="self" type="application/rss+xml" />
	<link>http://webmasterweblog.com</link>
	<description>Experiences of a Webmaster</description>
	<lastBuildDate>Mon, 01 Mar 2010 13:16:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Premature end of script headers in index.php + 500 Error</title>
		<link>http://webmasterweblog.com/premature-end-of-script-headers-in-index-php-500-error.html</link>
		<comments>http://webmasterweblog.com/premature-end-of-script-headers-in-index-php-500-error.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 13:16:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://webmasterweblog.com/?p=264</guid>
		<description><![CDATA[If you find this in your apache error.log: Premature end of script headers in index.php and get a 500 error on your wordpress blog, then you should check your suexec log. When it reaches 2GB you will receive a 500 error and the message: Premature end of script headers
You can find the log here: /var/log/apache/suexec.log or simply enter locate suexec.log
Also check your /var/log/suphp.log &#8230; if it is over 2GB large you will receive the 500 error!
]]></description>
			<content:encoded><![CDATA[<p>If you find this in your apache error.log: <span>Premature end of script headers in index.php and get a 500 error on your wordpress blog, then you should check your suexec log. When it reaches 2GB you will receive a 500 error and the message: </span>Premature end of script headers</p>
<p>You can find the log here: /var/log/apache/suexec.log or simply enter locate suexec.log</p>
<p>Also check your /var/log/suphp.log &#8230; if it is over 2GB large you will receive the 500 error!</p>
]]></content:encoded>
			<wfw:commentRss>http://webmasterweblog.com/premature-end-of-script-headers-in-index-php-500-error.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find occurences of multiple needles in haystack</title>
		<link>http://webmasterweblog.com/multiple-needles-in-haystack.html</link>
		<comments>http://webmasterweblog.com/multiple-needles-in-haystack.html#comments</comments>
		<pubDate>Fri, 17 Oct 2008 23:53:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://webmasterweblog.com/?p=111</guid>
		<description><![CDATA[Let&#8217;s say you got a form and you don&#8217;t want to allow that people submit certain words. How would you do that? Right you will have to use the PHP function strpos. Unfortunately you can&#8217;t feed strpos with arrays (a list of needles)!
Here is a very simple solution that you can use to to check multiple needles and their occurence in a specific string.

&#160;
$haystack = $myhaystack;
$needle = array&#40;'badword','badword','badword','badword'&#41;;
&#160;
foreach&#40;$needle as $value&#41;&#123;
$pos = strpos&#40;$haystack, $value&#41;;
if &#40;$pos !== false&#41;&#123; /* If we find one of those bad words do the following */
&#160;
	header&#40;&#34;Location: http://mysite.com?error=badcontent&#34;&#41;;
	exit;
&#160;
	&#125;
&#125;

I ...]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you got a form and you don&#8217;t want to allow that people submit certain words. How would you do that? Right you will have to use the PHP function strpos. Unfortunately you can&#8217;t feed strpos with arrays (a list of needles)!</p>
<p>Here is a very simple solution that you can use to to check multiple needles and their occurence in a specific string.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">&nbsp;
<span style="color: #000088;">$haystack</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$myhaystack</span>;
<span style="color: #000088;">$needle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="">'badword'</span><span style="color: #339933;">,</span><span style="">'badword'</span><span style="color: #339933;">,</span><span style="">'badword'</span><span style="color: #339933;">,</span><span style="">'badword'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$needle</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$pos</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pos</span> <span style="color: #339933;">!==</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">/* If we find one of those bad words do the following */</span>
&nbsp;
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://mysite.com?error=badcontent&quot;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #990000;">exit</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I used the &#8220;header&#8221; command to redirect people to a specific site if they enter those bad words. You can output a customized error message by adding a variable at the end of the URL e.g. the variable &#8220;error&#8221;. Simply retrieve the variable via GET and then echo an appropriate message. </p>
<p>If you have any question feel free to ask!</p>
<p>Enjoy <img src='http://webmasterweblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://webmasterweblog.com/multiple-needles-in-haystack.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
