<?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>Design Gala &#187; PHP</title>
	<atom:link href="http://designgala.com/topics/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://designgala.com</link>
	<description>Web Usability, Web Technology, User Experience</description>
	<lastBuildDate>Wed, 02 May 2012 03:55:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to Add Text in an Image</title>
		<link>http://designgala.com/how-to-add-text-in-an-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-add-text-in-an-image</link>
		<comments>http://designgala.com/how-to-add-text-in-an-image/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 20:21:05 +0000</pubDate>
		<dc:creator>Design Gala</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Adding Text to Image]]></category>
		<category><![CDATA[PHP Image]]></category>

		<guid isPermaLink="false">http://www.designgala.com/?p=6</guid>
		<description><![CDATA[Want to add text in images using PHP? This small script demonstrate how to add a custom text to an image loaded onto your page. ]]></description>
			<content:encoded><![CDATA[<p><!--adsense#for_article_1--><span class="firstletter"><span>T</span></span>his small script describes how to add a custom text to an image loaded onto your page. One of my client wanted to add a copyright notice in her images related to her site. So, I came up with this small PHP script for her.</p>
<h3><strong>Adding Text to an Image</strong></h3>
<p>Using the PHP GD function called <a href="http://www.php.net/manual/en/function.imagecreatefromjpeg.php" title="imagecreatefromjpeg">imagecreatefromjpeg</a>, <a href="http://www.php.net/manual/en/function.imagecreatefromgif.php" title="imagecreatefromgif">imagecreatefromgif</a> and <a href="http://www.php.net/manual/en/function.imagecreatefrompng.php" title="imagecreatefrompng">imagecreatefrompng</a>. We can add a custom text to an already existing image file.<br />
So you have imagecreatefromjpeg for jpeg file, imagecreatefrompng for png file and so on.</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;copyright: some text&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$font</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagefontwidth</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagefontheight</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre>
</div>
</div>
<p>This will setup the structure of the data being sent to the image file as well as what location to place the text at. In this case we want to place it on the bottom right of the page.</p>
<p>Now, we use imagecreatefrompng to create image from a file, set the text color, get the images dimensions, and figure on where to place the text.
</pre>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/path/to/yourimagefile&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesx</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$backgroundColor</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//white background</span>
<span style="color: #000088;">$textColor</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">//black text</span>
<span style="color: #990000;">imagestring</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$textColor</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Finally we produce the new image that will display custom text in an image.</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #990000;">imagepng</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</div>
</div>
<h3><strong>Here is the complete code:</strong></h3>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your text&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// try changing this as well</span>
<span style="color: #000088;">$font</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagefontwidth</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagefontheight</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/path/to/yourimagefile&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesx</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$backgroundColor</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$textColor</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagestring</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$textColor</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">imagepng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$im</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</div>
</div>
<p>You may like to <a href="http://www.access-himalaya.com/picture-gallery.php?holiday_code=ACT" title="Demo">view demo</a>.
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><!-- Do not remove --></p>
]]></content:encoded>
			<wfw:commentRss>http://designgala.com/how-to-add-text-in-an-image/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How to Get IP Address of Visitor</title>
		<link>http://designgala.com/how-to-get-ip-address-of-visitor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-get-ip-address-of-visitor</link>
		<comments>http://designgala.com/how-to-get-ip-address-of-visitor/#comments</comments>
		<pubDate>Tue, 15 May 2007 20:09:03 +0000</pubDate>
		<dc:creator>Design Gala</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[remote IP]]></category>
		<category><![CDATA[vistor tracking]]></category>

		<guid isPermaLink="false">http://www.designgala.com/?p=3</guid>
		<description><![CDATA[This is a simple PHP tutorials and script for getting remote visitors with their IP Address. With this tracking your visitor is very easy and simple with PHP. PHP has a set of...]]></description>
			<content:encoded><![CDATA[<p><span class="firstletter"><span>T</span></span>his is a simple <abbr title="PHP Hypertext Processor">PHP</abbr> tutorials and script for getting remote visitors with their IP Address. With this tracking your visitor is very easy and simple with <abbr title="PHP Hypertext Processor">PHP</abbr>. <abbr title="PHP Hypertext Processor">PHP</abbr> has a set of global variables. Among them, we use $_SERVER variable to get an IP address of a remote computer. REMOTE_ADDR is the constant that is used to get the IP Address of a remote computer.</p>
<p>Note that this script may not return IP Address if the client/user firewall is on or when client is using some proxy software.</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
 <span style="color: #000088;">$ipaddress</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Your IP ADDRESS: &quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$ipaddress</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</td>
</tr>
</table>
</div>
<p>Another way of retrieving IP Address is using function getenv().</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
 <span style="color: #000088;">$userip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$proxy</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">gethostbyaddr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</td>
</tr>
</table>
</div>
<p><!--adsense#longbottom--></p>
<h3>OUTPUT</h3>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;">Server IP ADDRESS<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">/</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span>
User IP ADDRESS<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">/</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span>
User HOST ADDRESS<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span><span style="color: #b1b100;">echo</span> <span style="color: #339933;">@</span><span style="color: #990000;">gethostbyaddr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">/</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#93;</span></pre>
</div>
</div>
<blockquote><p>$userip is the IP address of the user thats been passed on by the server. $proxy is the IP address of the server itself and $host is the host address of the user. If your PHP version is less than 4.3 then use $HTTP_SERVER_VARS in place of $_SERVER</p></blockquote>
<p>Download : <a href="http://www.designgala.com/wp-content/uploads/2008/03/how-to-get-ip-address-of-visitorphp.txt" title="PHP Script Get IP Address of Visitor">PHP Script Get IP Address of Visitor</a>
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><!-- Do not remove --></p>
]]></content:encoded>
			<wfw:commentRss>http://designgala.com/how-to-get-ip-address-of-visitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email HTML page contents using PHP</title>
		<link>http://designgala.com/email-html-page-contents-using-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=email-html-page-contents-using-php</link>
		<comments>http://designgala.com/email-html-page-contents-using-php/#comments</comments>
		<pubDate>Wed, 17 May 2006 14:50:44 +0000</pubDate>
		<dc:creator>Design Gala</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[html email]]></category>

		<guid isPermaLink="false">http://www.designgala.com/email-html-page-contents-using-php/</guid>
		<description><![CDATA[Earlier post explained on {{post id="how-to-send-e-mail-using-php" text="how to send a plain email using PHP"}}. This time, we are discussing about sending page contents to email. This technique is based on output buffering. Basically, it would first create read a html file and store in buffer using ob_start(). Next step is to include desire HTML page using include function and then store the contents of that HTML page using ob_get_contents(). Finally use mail() function to send email.]]></description>
			<content:encoded><![CDATA[<p>Earlier post explained on <a href="http://www.designgala.com/how-to-send-e-mail-using-php/">how to send a plain email using PHP</a>. This time, we are discussing about sending page contents to email. This technique is based on output buffering. Basically, it would first create read a html file and store in buffer using <em>ob_start()</em>. Next step is to include desire HTML page using include function and then store the contents of that HTML page using <em>ob_get_contents()</em>. Finally use <em>mail()</em> function to send email.</p>
<blockquote><p>While output buffering is turned on no output is sent from then script. The output is stored in an internal buffer.</p></blockquote>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;samplepage.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'MIME-Version: 1.0'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Content-type: text/html; charset=iso-8859-1'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'From: '</span><span style="color: #339933;">.</span>SENDER_NAME<span style="color: #339933;">.</span><span style="color: #0000ff;">' &amp;lt;'</span><span style="color: #339933;">.</span>SENDER_EMAIL<span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;gt; '</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$to_email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'email@example.net'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Your Desired Email Subject'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to_email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$buffer</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<h3>Download Sample</h3>
<ol>
<li><a title="Demonstration of Email HTML" href="http://www.designgala.com/wp-content/uploads/2008/03/send_html_page_email.rar">Download (rar file)</a></li>
<li><a title="Demonstration of Email HTML" href="http://www.designgala.com/wp-content/uploads/2008/03/send_html_page_email.zip">Download (zip file)</a></li>
</ol>
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><!-- Do not remove --></p>
]]></content:encoded>
			<wfw:commentRss>http://designgala.com/email-html-page-contents-using-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Secure Login in PHP</title>
		<link>http://designgala.com/creating-secure-login-in-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-secure-login-in-php</link>
		<comments>http://designgala.com/creating-secure-login-in-php/#comments</comments>
		<pubDate>Sat, 15 Apr 2006 21:57:24 +0000</pubDate>
		<dc:creator>Design Gala</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[login in PHP]]></category>
		<category><![CDATA[login script]]></category>

		<guid isPermaLink="false">http://www.designgala.com/?p=14</guid>
		<description><![CDATA[This articles demonstrate and explains how to create a secure PHP login script that will allow safe authentication. Here, cookies are not used because of preventive measure against cross-side scripting. The back-end used is MySQL. So, you should have knowledge of MySQL and database as well.]]></description>
			<content:encoded><![CDATA[<p><span class="firstletter"><span>T</span></span>his articles demonstrate and explains how to create a secure PHP login script that will allow safe authentication. Here, cookies are not used because of preventive measure against cross-side scripting. The back-end used is MySQL. So, you should have knowledge of MySQL and database as well.</p>
<h3><strong>Database Schema</strong></h3>
<p>For example lets make a table called login for this tutorial purpose only. For commercial purpose, please do add relevant attributes in the table. Use SQL below to create a table of login.</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
</pre>
</td>
<td class="code">
<pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> login <span style="color: #FF00FF;">&#40;</span>
user_name <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">20</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #008000;">''</span><span style="color: #000033;">,</span>
user_pass <span style="color: #000099;">char</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">32</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">binary</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #008000;">''</span><span style="color: #000033;">,</span>
<span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span>username<span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre>
</td>
</tr>
</table>
</div>
<h3>Creating a HTML Form</h3>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
</pre>
</td>
<td class="code">
<pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login.php&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user_name&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user_pass&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Login&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre>
</td>
</tr>
</table>
</div>
<h3><strong>Handling Form</strong></h3>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$user_name</span> <span style="color: #339933;">=</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$user_pass</span> <span style="color: #339933;">=</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;user_pass&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT user_name,user_pass FROM login
           WHERE user_name=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$user_name</span><span style="color: #000099; font-weight: bold;">\&quot;</span>
            AND    user_pass=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$user_pass</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000088;">$rs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>               <span style="color: #666666; font-style: italic;">//execute the query</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rs</span><span style="color: #009900;">&#41;</span>	<span style="color: #339933;">==</span>	<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
 	<span style="color: #666666; font-style: italic;">// username and passwords exists in database</span>
       <span style="color: #666666; font-style: italic;">//other codes</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
 	<span style="color: #666666; font-style: italic;">//invalid username of password</span>
 	<span style="color: #666666; font-style: italic;">//redirect to login page</span>
&nbsp;
 	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: login.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p>Above is fairly a simple login page. We can add many other functionalities.
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><!-- Do not remove --></p>
]]></content:encoded>
			<wfw:commentRss>http://designgala.com/creating-secure-login-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Send E-Mail using PHP</title>
		<link>http://designgala.com/how-to-send-e-mail-using-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-send-e-mail-using-php</link>
		<comments>http://designgala.com/how-to-send-e-mail-using-php/#comments</comments>
		<pubDate>Mon, 13 Feb 2006 20:17:11 +0000</pubDate>
		<dc:creator>Design Gala</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[contact form]]></category>
		<category><![CDATA[PHP mail]]></category>

		<guid isPermaLink="false">http://www.designgala.com/?p=5</guid>
		<description><![CDATA[This article explains about sending a simple plain mail using PHP mail function.
]]></description>
			<content:encoded><![CDATA[<p><span class="firstletter"><span>T</span></span>his article explains about sending a simple mail using PHP mail function.</p>
<h3><strong>Creating a Email Form using HTML</strong></h3>
<div class="wp_syntax">
<div class="code">
<pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>
Sender Email: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sender_email&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
Receipent Email: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;receipent_email&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
Mail Subject: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email_subject&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;18&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
Email Message: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #000066;">rows</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #000066;">cols</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;6&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send Email&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre>
</div>
</div>
<h3><strong>PHP Code For Handling Action and Send Email</strong></h3>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$sender_email</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;sender_email&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$receipent_email</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;receipent_email&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$email_subject</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;email_subject&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;message&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$receipent_email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email_subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;From: <span style="color: #006699; font-weight: bold;">$sender_email</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Mail has been send successfully.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;There was a problem in sending email.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>This is just a method of how to send a simple email using PHP. In above script there is no way of proper error checking and other advance email functionalities like sending of HTML email, custom headers.
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><!-- Do not remove --></p>
]]></content:encoded>
			<wfw:commentRss>http://designgala.com/how-to-send-e-mail-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

