<?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>phpHelp.co</title>
	<atom:link href="http://phphelp.co/feed/" rel="self" type="application/rss+xml" />
	<link>http://phphelp.co</link>
	<description>One Stop PHP Help</description>
	<lastBuildDate>Mon, 13 May 2013 10:06:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to download a file on server in PHP</title>
		<link>http://phphelp.co/2013/05/13/how-to-download-a-file-on-server-in-php/</link>
		<comments>http://phphelp.co/2013/05/13/how-to-download-a-file-on-server-in-php/#comments</comments>
		<pubDate>Mon, 13 May 2013 10:06:55 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=99</guid>
		<description><![CDATA[&#60;?php $file = &#8216;http://www.url.com/file.zip&#8217;; $newfile = &#8216;newfile.zip&#8217;; if (!copy($file, $newfile)) { echo &#8220;failed to copy $file&#8230;\n&#8221;; } ?&#62;]]></description>
				<content:encoded><![CDATA[<p>&lt;?php<br />
$file = &#8216;http://www.url.com/file.zip&#8217;;<br />
$newfile = &#8216;newfile.zip&#8217;;</p>
<p>if (!copy($file, $newfile)) {<br />
echo &#8220;failed to copy $file&#8230;\n&#8221;;<br />
}<br />
?&gt;</p>
<p><a title="How to download a file on server in PHP" href="http://phphelp.co/wp-content/uploads/2013/05/download-to-server.zip" target="_blank"><img class="alignnone size-full wp-image-59" alt="download" src="http://phphelp.co/wp-content/uploads/2012/06/download.jpg" width="200" height="42" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2013/05/13/how-to-download-a-file-on-server-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are some good WordPress plugins</title>
		<link>http://phphelp.co/2013/03/27/what-are-some-good-wordpress-plugins/</link>
		<comments>http://phphelp.co/2013/03/27/what-are-some-good-wordpress-plugins/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 10:04:27 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=92</guid>
		<description><![CDATA[Business Directory Calendar Contact Form Custom Post Order My Post Order My Page Order Fancy Transition Header Slider Google Analytics Sharethis Simple Pagination Spider FAQs White Label CMS .html on Pages Page Meta Another WordPress Meta Plugin Captcha Mail List By Danilo Andreini &#160;]]></description>
				<content:encoded><![CDATA[<ul>
<li>Business Directory</li>
<li>Calendar</li>
<li>Contact Form</li>
<li>Custom Post Order</li>
<li>My Post Order</li>
<li>My Page Order</li>
<li>Fancy Transition Header Slider</li>
<li>Google Analytics</li>
<li>Sharethis</li>
<li>Simple Pagination</li>
<li>Spider FAQs</li>
<li>White Label CMS</li>
<li>.html on Pages</li>
<li>Page Meta</li>
<li>Another WordPress Meta Plugin</li>
<li>Captcha</li>
<li>Mail List By Danilo Andreini</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2013/03/27/what-are-some-good-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I detect mobile browser in PHP?</title>
		<link>http://phphelp.co/2013/02/08/how-do-i-detect-mobile-browser-in-php/</link>
		<comments>http://phphelp.co/2013/02/08/how-do-i-detect-mobile-browser-in-php/#comments</comments>
		<pubDate>Fri, 08 Feb 2013 11:25:21 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=88</guid>
		<description><![CDATA[// Create the function, so you can use it function isMobile() { return preg_match("/(android&#124;avantgo&#124;blackberry&#124;bolt&#124;boost&#124;cricket&#124;docomo&#124;fone&#124;hiptop&#124;mini&#124;mobi&#124;palm&#124;phone&#124;pie&#124;tablet&#124;up\.browser&#124;up\.link&#124;webos&#124;wos)/i", $_SERVER["HTTP_USER_AGENT"]); } // If the user is on a mobile device, redirect them if(isMobile()) header("Location: http://m.yoursite.com/");]]></description>
				<content:encoded><![CDATA[<pre><code>// Create the function, so you can use it 
function isMobile() { 
 return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); 
} 
// If the user is on a mobile device, redirect them 
if(isMobile()) header("Location: http://m.yoursite.com/");</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2013/02/08/how-do-i-detect-mobile-browser-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can you recommend some post upload checks?</title>
		<link>http://phphelp.co/2012/12/17/can-you-recommend-some-post-upload-checks/</link>
		<comments>http://phphelp.co/2012/12/17/can-you-recommend-some-post-upload-checks/#comments</comments>
		<pubDate>Mon, 17 Dec 2012 09:45:24 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=82</guid>
		<description><![CDATA[Delete unwanted files, like &#8216;test&#8217;, &#8216;copy of&#8217;, etc. Give write permission (777) to the required folders. If .htaccess file has been uploaded, make sure it runs according the the server settings. Sometimes .htaccess files run on local but not on server. Make configuration settings according to server where required, like database connections, file paths, etc. [...]]]></description>
				<content:encoded><![CDATA[<ol>
<li>Delete unwanted files, like &#8216;test&#8217;, &#8216;copy of&#8217;, etc.</li>
<li>Give write permission (777) to the required folders.</li>
<li>If .htaccess file has been uploaded, make sure it runs according the the server settings. Sometimes .htaccess files run on local but not on server.</li>
<li>Make configuration settings according to server where required, like database connections, file paths, etc.</li>
<li>Do not upload folders required for local copy of the web site like &#8216;backup&#8217;,'db&#8217;, etc &#8211; if you maintain them.</li>
<li>In folders where there are no index/default files, place a blank index/default file to avoid directory listing. If this is not done, a site visitor can type in the folder path in browser URL and see all files in that folder which is not a good idea. This can also be done using .htaccess file with the following code. <code>Options -Indexes</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/12/17/can-you-recommend-some-post-upload-checks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to take backup dump of MySQL database with PHP script</title>
		<link>http://phphelp.co/2012/08/15/how-to-take-backup-dump-of-mysql-database-with-php-script/</link>
		<comments>http://phphelp.co/2012/08/15/how-to-take-backup-dump-of-mysql-database-with-php-script/#comments</comments>
		<pubDate>Wed, 15 Aug 2012 11:13:23 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=75</guid>
		<description><![CDATA[Here is a simple script to take backup of MySQL database, using a PHP script. &#60;?php backup_tables(&#8216;localhost&#8217;,'username&#8217;,'password&#8217;,'dbname&#8217;); /* backup the db OR just a table */ function backup_tables($host,$user,$pass,$dbname,$tables = &#8216;*&#8217;) { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the tables if($tables == &#8216;*&#8217;) { $tables = array(); $result = mysql_query(&#8216;SHOW TABLES&#8217;); while($row = mysql_fetch_row($result)) { [...]]]></description>
				<content:encoded><![CDATA[<p>Here is a simple script to take backup of MySQL database, using a PHP script.</p>
<p>&lt;?php<br />
backup_tables(&#8216;localhost&#8217;,'username&#8217;,'password&#8217;,'dbname&#8217;);</p>
<p>/* backup the db OR just a table */<br />
function backup_tables($host,$user,$pass,$dbname,$tables = &#8216;*&#8217;)<br />
{</p>
<p>$link = mysql_connect($host,$user,$pass);<br />
mysql_select_db($name,$link);</p>
<p>//get all of the tables<br />
if($tables == &#8216;*&#8217;)<br />
{<br />
$tables = array();<br />
$result = mysql_query(&#8216;SHOW TABLES&#8217;);<br />
while($row = mysql_fetch_row($result))<br />
{<br />
$tables[] = $row[0];<br />
}<br />
}<br />
else<br />
{<br />
$tables = is_array($tables) ? $tables : explode(&#8216;,&#8217;,$tables);<br />
}</p>
<p>//cycle through<br />
foreach($tables as $table)<br />
{<br />
$result = mysql_query(&#8216;SELECT * FROM &#8216;.$table);<br />
$num_fields = mysql_num_fields($result);</p>
<p>$return.= &#8216;DROP TABLE IF EXISTS &#8216;.$table.&#8217;;';<br />
$row2 = mysql_fetch_row(mysql_query(&#8216;SHOW CREATE TABLE &#8216;.$table));<br />
$return.= &#8220;\n\n&#8221;.$row2[1].&#8221;;\n\n&#8221;;</p>
<p>for ($i = 0; $i &lt; $num_fields; $i++)<br />
{<br />
while($row = mysql_fetch_row($result))<br />
{<br />
$return.= &#8216;INSERT INTO &#8216;.$table.&#8217; VALUES(&#8216;;<br />
for($j=0; $j&lt;$num_fields; $j++)<br />
{<br />
$row[$j] = addslashes($row[$j]);<br />
$row[$j] = ereg_replace(&#8220;\n&#8221;,&#8221;\\n&#8221;,$row[$j]);<br />
if (isset($row[$j])) { $return.= &#8216;&#8221;&#8216;.$row[$j].&#8217;&#8221;&#8216; ; } else { $return.= &#8216;&#8221;"&#8216;; }<br />
if ($j&lt;($num_fields-1)) { $return.= &#8216;,&#8217;; }<br />
}<br />
$return.= &#8220;);\n&#8221;;<br />
}<br />
}<br />
$return.=&#8221;\n\n\n&#8221;;<br />
}</p>
<p>//save file<br />
$handle = fopen(&#8216;./db/db-backup-&#8217;.time().&#8217;-&#8217;.(md5(implode(&#8216;,&#8217;,$tables))).&#8217;.sql&#8217;,'w+&#8217;);<br />
fwrite($handle,$return);<br />
fclose($handle);<br />
}</p>
<p>?&gt;</p>
<p><a title="How to take backup dump of MySQL database with PHP script" href="http://phphelp.co/wp-content/uploads/2012/08/db-dump.zip" target="_blank"><img title="download" src="http://phphelp.co/wp-content/uploads/2012/06/download.jpg" alt="" width="200" height="42" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/08/15/how-to-take-backup-dump-of-mysql-database-with-php-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable/protect right-click in JavaScript</title>
		<link>http://phphelp.co/2012/08/05/how-to-disable-protect-right-click-in-javascript/</link>
		<comments>http://phphelp.co/2012/08/05/how-to-disable-protect-right-click-in-javascript/#comments</comments>
		<pubDate>Sun, 05 Aug 2012 03:25:54 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=71</guid>
		<description><![CDATA[The code below will disable web browser&#8217;s default right-click context menu. &#60;script language=JavaScript&#62; var message=&#8221;Sorry, right click disabled!&#8221;; /////////////////////////////////// function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers&#124;&#124;document.getElementById&#38;&#38;!document.all){ if (e.which==2&#124;&#124;e.which==3){ alert(message); return false; } } } if (document.layers){http://phphelp.co/wp-admin/post-new.php document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; }else if (document.all&#38;&#38;!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function(&#8220;alert(message);return false&#8221;) &#60;/script&#62;]]></description>
				<content:encoded><![CDATA[<p>The code below will disable web browser&#8217;s default right-click context menu.</p>
<p>&lt;script language=JavaScript&gt;</p>
<p>var message=&#8221;Sorry, right click disabled!&#8221;;</p>
<p>///////////////////////////////////<br />
function clickIE4(){<br />
if (event.button==2){<br />
alert(message);<br />
return false;<br />
}<br />
}</p>
<p>function clickNS4(e){<br />
if (document.layers||document.getElementById&amp;&amp;!document.all){<br />
if (e.which==2||e.which==3){<br />
alert(message);<br />
return false;<br />
}<br />
}<br />
}</p>
<p>if (document.layers){http://phphelp.co/wp-admin/post-new.php<br />
document.captureEvents(Event.MOUSEDOWN);<br />
document.onmousedown=clickNS4;<br />
}else if (document.all&amp;&amp;!document.getElementById){<br />
document.onmousedown=clickIE4;<br />
}</p>
<p>document.oncontextmenu=new Function(&#8220;alert(message);return false&#8221;)<br />
&lt;/script&gt;</p>
<p><a title="Download" href="http://phphelp.co/wp-content/uploads/2012/08/no-right-click.zip" target="_blank"><img title="download" src="http://phphelp.co/wp-content/uploads/2012/06/download.jpg" alt="" width="200" height="42" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/08/05/how-to-disable-protect-right-click-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to uploading large(big) files in PHP using .htaccess</title>
		<link>http://phphelp.co/2012/07/30/how-to-uploading-largebig-files-in-php-using-htaccess/</link>
		<comments>http://phphelp.co/2012/07/30/how-to-uploading-largebig-files-in-php-using-htaccess/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 11:23:07 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=67</guid>
		<description><![CDATA[Usually, default upload size from a web browser is 2 MB and if this is required to be changed, you can do it using .htaccess file. Create a .htaccess file in the root folder of web server. Put the following code in side the .htaccess file and save it. If the .htaccess file already exists, [...]]]></description>
				<content:encoded><![CDATA[<p>Usually, default upload size from a web browser is 2 MB and if this is required to be changed, you can do it using .htaccess file.</p>
<ol>
<li>Create a .htaccess file in the root folder of web server.</li>
<li>Put the following code in side the .htaccess file and save it.</li>
<li>If the .htaccess file already exists, add the above code to the already existing file.</li>
<li>Make sure there are no blank spaces at the end of the file.</li>
</ol>
<p>php_value upload_max_filesize 20M<br />
php_value post_max_size 20M<br />
php_value max_execution_time 200<br />
php_value max_input_time 200</p>
<p>Note: Some servers do not allow to change file upload size using .htaccess so Internal Server Error may appear in this case.</p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/07/30/how-to-uploading-largebig-files-in-php-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to stream a file as attachment in PHP</title>
		<link>http://phphelp.co/2012/06/13/how-to-stream-a-file-as-attachment-in-php/</link>
		<comments>http://phphelp.co/2012/06/13/how-to-stream-a-file-as-attachment-in-php/#comments</comments>
		<pubDate>Wed, 13 Jun 2012 17:49:35 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=62</guid>
		<description><![CDATA[Sometimes we need to download files as attachment in PHP. This code can ideally be called on a hyperlink. $filename = &#8220;myImage.jpg&#8221;; if(file_exists($filename)) { header(&#8220;Content-disposition: attachment; filename={$filename}&#8221;); //Tell the filename to the browser header(&#8216;Content-type: application/octet-stream&#8217;); //Stream as a binary file! So it would force browser to download readfile($filename); //Read and stream the file }else{ echo [...]]]></description>
				<content:encoded><![CDATA[<p>Sometimes we need to download files as attachment in PHP. This code can ideally be called on a hyperlink.</p>
<p>$filename = &#8220;myImage.jpg&#8221;;</p>
<p>if(file_exists($filename)) {</p>
<p>header(&#8220;Content-disposition: attachment; filename={$filename}&#8221;);</p>
<p>//Tell the filename to the browser</p>
<p>header(&#8216;Content-type: application/octet-stream&#8217;);</p>
<p>//Stream as a binary file! So it would force browser to download</p>
<p>readfile($filename);</p>
<p>//Read and stream the file</p>
<p>}else{</p>
<p>echo &#8220;Sorry, the file does not exist!&#8221;;</p>
<p>}</p>
<p><a title="Download" href="http://phphelp.co/wp-content/uploads/2012/06/stream.zip" target="_blank"><img title="download" src="http://phphelp.co/wp-content/uploads/2012/06/download.jpg" alt="" width="200" height="42" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/06/13/how-to-stream-a-file-as-attachment-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are some common PHP coding standards</title>
		<link>http://phphelp.co/2012/06/04/what-are-some-common-php-coding-standards/</link>
		<comments>http://phphelp.co/2012/06/04/what-are-some-common-php-coding-standards/#comments</comments>
		<pubDate>Mon, 04 Jun 2012 11:43:30 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=24</guid>
		<description><![CDATA[Set all warnings and errors to ‘on’ in php.ini file. Set register_ globals to ‘off’ in php.ini file. Set magic_quotes_gpc to ‘off’ in php.ini file. Set magic_quotes_runtime to ‘off’ in php.ini file. Test in browser with javascript errors on. Make an include file for all settings and variables. Check data entry with single quotes and [...]]]></description>
				<content:encoded><![CDATA[<ol>
<li>Set all warnings and errors to ‘on’ in php.ini file.</li>
<li>Set register_ globals to ‘off’ in php.ini file.</li>
<li>Set magic_quotes_gpc to ‘off’ in php.ini file.</li>
<li>Set magic_quotes_runtime to ‘off’ in php.ini file.</li>
<li>Test in browser with javascript errors on.</li>
<li>Make an include file for all settings and variables.</li>
<li>Check data entry with single quotes and double quotes.</li>
<li>Use stripslashes() when fetching data.</li>
<li>Use nl2br() when printing data (entered from a textarea) in html pages.</li>
<li>Use encrypted query strings where required.</li>
<li>One user must not be able to see the records of another user by tampering with the query string variables.</li>
<li>Use image resizing wherever required.</li>
<li>Do not resize images that are smaller than the specified size.</li>
<li>When uploading file, display allowable file types and maximum upload size like: JPG, PNG and GIF Only. Max file size 2 MB.</li>
<li>All forms should come filled in, in case of any errors in filling the form, so that user does not have to type all info again.</li>
<li>All deletes must be confirmed before deletion.</li>
<li>Use lipsum for dummy text. Get it from www.lipsum.com.</li>
<li>When a search or view record is not found, please show a message, “No record found.”.</li>
<li>Check for cascade deletions where required or warn for child record entry.</li>
<li>On all submitted forms, especially contact us pages, please check referrer.</li>
<li>Make messages like this:
<ul>
<li>Username is a required field.</li>
<li>Your passwords do not match.</li>
<li>This category cannot be deleted as it is being referred to in a subcategory. Please delete the subcategory first.</li>
</ul>
</li>
<li>Delete corresponding images when deleting records from database.</li>
<li>All forms must be validated.</li>
<li>Use date picker or date combos whenever date is required to be entered.</li>
<li>Paginate when required.</li>
<li>When writing insert and/or update SQL queries, always write field names and then values. Do not insert or update all values.</li>
<li>When writing database queries, always use quotes, even for numeric fields. This is for MySQL database.</li>
<li>Table names and field names should be like this:
<ul>
<li>Table name: databasename_tablename</li>
<li>Field name: tablename_fieldname</li>
</ul>
</li>
<li>Some commonly used field sizes should be as below:
<ul>
<li>username: varachar(20)</li>
<li>password: varchar(20)</li>
<li>firstname: varchar(15)</li>
<li>lastname: varchar(15)</li>
<li>fullname: varchar(30)</li>
<li>phone: varchar(15)</li>
<li>fax: varchar(15)</li>
<li>email: varchar(50)</li>
<li>address: text</li>
<li>city: varchar(20)</li>
<li>state: varchar(20)</li>
<li>zip: varchar(12)</li>
<li>country: int (to come from from country’s table).</li>
<li>url: varchar(255)</li>
<li>amount/price: double</li>
<li>date: date</li>
<li>timestamp: bigint</li>
</ul>
</li>
<li>Please set textbox’s max attribute to what it is in the database.</li>
<li>Add server timeout when required.</li>
<li>Test all your applications on multiple browsers.</li>
<li>Give alt tag to all images</li>
<li>Give title tags to images and hyperlinks.</li>
<li>There is always space after a comma, a colon, a semi-colon and a full stop and not before them.</li>
<li>Place an index page (with page title and text as “Access Denied” in all folders without index page to stop directory browsing. Or stop directory browsing using htaccess file.</li>
<li>Show dates in full date format (January 10, 2012)</li>
<li>Make admin login window database driven.</li>
<li>All forms submitted, leading to select statements most have GET method.</li>
<li>All views must be ordered by their respective fields.</li>
<li>In user manager, the application must not be able to delete self and must not be able to delete the admin level user.</li>
<li>Password protect admin folder with database driven module. Do not depend on password protecting admin folder.</li>
<li>Use meta tag to redirect to log out page for auto log out when required.</li>
<li>Always use die() with queries.</li>
<li>Set auto complete off for login forms.</li>
<li>Stripslashes() in email messages.</li>
<li>Use substr where required to show long messages like “Lorem ipsum dorit&#8230;”.</li>
<li>Format numbers as 24.00 where required.</li>
<li>Spell check</li>
<li>Write recommended size for pictures</li>
<li>Contact and similar pages should go to thank you page.</li>
<li>Required field must be marked with *.</li>
<li>Use inner joins where required.</li>
<li>Use enum data type where required.</li>
<li>Close connections at page end or before redirection.</li>
<li>Clean up test files before uploading.</li>
<li>Use frame busters where required.</li>
<li>Centre pop up windows.</li>
<li>Delete images before updating them. Either check if exists before deleting or use @unlink.</li>
<li>Mark all required fields with * in all forms.</li>
<li>To get file path, use the following as it works on Apache and IIS.</li>
<ul>
<li>$url_to=&#8221;http://&#8221;.$ HTTP_HOST.$SCRIPT_NAME;</li>
</ul>
<li>Set different session names for admin and public users.</li>
<li>Remove all test email addresses that send forms to you.</li>
<li>Some sample messages at below.</li>
</ol>
<p><strong>Signup:</strong> Thank you very much for registering. Your account is now active and ready to use.</p>
<p><strong>Contact Us:</strong> Thank you for contacting us. Your message has been sent to the concerned department and you will be contacted back shortly.</p>
<p><strong> </strong></p>
<p><strong>Profile Update:</strong> Your profile has been updated successfully.</p>
<p><strong> </strong></p>
<p><strong>Bug report submission message:</strong> Thank you very much for your time. Your reported bug/error has been routed to the concerned department for further action.</p>
<p><strong> </strong></p>
<p><strong>Lost Password: </strong>Your login information has been mailed to your <a href="mailto:email@domain.com">email@domain.com</a>.</p>
<p><strong> </strong></p>
<p><strong>Wrong Login info for Lost Password:</strong> Invalid login information; please provide the email address you used when you registered with us.</p>
<p><strong> </strong></p>
<p><strong>Lost Password Email:</strong></p>
<p><strong> </strong></p>
<p><strong>Subject: </strong>Your SITE_NAME Login Information</p>
<p><strong> </strong></p>
<p>Dear Member Name,</p>
<p><strong> </strong></p>
<p>Your SITE_NAME login information is as below.</p>
<p>User Name: username</p>
<p>Password: password</p>
<p>The SITE_NAME Team</p>
<p><strong>Registration Email to the member:</strong></p>
<p>Subject: Welcome to SITE_NAME</p>
<p>Dear Member Name,</p>
<p>We welcome you to SITE_NAME. Your login information is as below and you can change your password anytime after logging in to the web site.</p>
<p>User Name: username</p>
<p>Password: password</p>
<p>The SITE_NAME Team</p>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/06/04/what-are-some-common-php-coding-standards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to watermark an image in PHP</title>
		<link>http://phphelp.co/2012/06/01/how-to-watermark-an-image-in-php/</link>
		<comments>http://phphelp.co/2012/06/01/how-to-watermark-an-image-in-php/#comments</comments>
		<pubDate>Fri, 01 Jun 2012 05:55:05 +0000</pubDate>
		<dc:creator>tabarry</dc:creator>
				<category><![CDATA[gdlib]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[How to watermark an image in PHP]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://phphelp.co/?p=55</guid>
		<description><![CDATA[Watermarking an image in PHP is very easy. If you follow the code below, you can do it in 2 minutes. &#60;?php function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) { //$SourceFile is source of the image file to be watermarked //$WaterMarkText is the text of the watermark //$DestinationFile is the destination location where the watermarked images will [...]]]></description>
				<content:encoded><![CDATA[<p>Watermarking an image in PHP is very easy. If you follow the code below, you can do it in 2 minutes.</p>
<p>&lt;?php</p>
<p>function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) {<br />
//$SourceFile is source of the image file to be watermarked<br />
//$WaterMarkText is the text of the watermark<br />
//$DestinationFile is the destination location where the watermarked images will be placed</p>
<p>//Delete if destinaton file already exists<br />
@unlink($DestinationFile);</p>
<p>//This is the vertical center of the image<br />
$top = getimagesize($SourceFile);<br />
$top = $top[1]/2;<br />
list($width, $height) = getimagesize($SourceFile);</p>
<p>$image_p = imagecreatetruecolor($width, $height);</p>
<p>$image = imagecreatefromjpeg($SourceFile);</p>
<p>imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);</p>
<p>//Path to the font file on the server. Do not miss to upload the font file<br />
$font = &#8216;arial.ttf&#8217;;</p>
<p>//Font sie<br />
$font_size = 16;</p>
<p>//Give a white shadow<br />
$white = imagecolorallocate($image_p, 255, 255, 255);<br />
imagettftext($image_p, $font_size, 0, 10, $top, $white, $font, $WaterMarkText);</p>
<p>//Print in black color<br />
$black = imagecolorallocate($image_p, 0, 0, 0);<br />
imagettftext($image_p, $font_size, 0, 8, $top-1, $black, $font, $WaterMarkText);</p>
<p>if ($DestinationFile&lt;&gt;&#8221;) {</p>
<p>imagejpeg ($image_p, $DestinationFile, 100);</p>
<p>} else {</p>
<p>header(&#8216;Content-Type: image/jpeg&#8217;);</p>
<p>imagejpeg($image_p, null, 100);</p>
<p>};</p>
<p>imagedestroy($image);</p>
<p>imagedestroy($image_p);</p>
<p>};</p>
<p>?&gt;</p>
<p>&lt;?php</p>
<p>$SourceFile = &#8216;image.jpg&#8217;;//Source image<br />
$DestinationFile = &#8216;watermarked/image.jpg&#8217;;//Destination path<br />
$WaterMarkText = &#8216;www.phpHelp.co&#8217;;//Watermark text</p>
<p>//Call the function to watermark the image<br />
watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile);</p>
<p>//Display watermarked image if desired<br />
if(file_exists($DestinationFile)){<br />
echo &#8220;&lt;img src=\&#8221;watermarked/image.jpg\&#8221;&gt;&#8221;;<br />
echo &#8220;&lt;p&gt;The image has been watermarked at &#8216;&#8221;.$DestinationFile.&#8221;&#8216;&lt;/p&gt;&#8221;;<br />
}<br />
?&gt;</p>
<p><a title="Download" href="http://phphelp.co/wp-content/uploads/2012/06/watermark.zip" target="_blank"><img class="alignnone size-full wp-image-59" title="download" src="http://phphelp.co/wp-content/uploads/2012/06/download.jpg" alt="" width="200" height="42" /></a></p>
<p>Note:</p>
<ul>
<li>This code is being provided to you as a help by http://www.phpHelp.co without any warranty and liability</li>
<li>Place all the files in a folder on web server.</li>
<li><strong>Do not forget to upload the font file &#8211; arial.ttf.</strong></li>
<li>Once the image is watermarked, it will be placed in the folder named &#8216;watermarked&#8217;.</li>
<li>You might need to give &#8216;write permission&#8217; or &#8217;777 permission&#8217; to the folder named &#8216;watermarked&#8217; as the new watermarked image will be written in this folder.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://phphelp.co/2012/06/01/how-to-watermark-an-image-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
