<?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"
	>

<channel>
	<title>Dream House</title>
	<atom:link href="http://sajjadhossain.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajjadhossain.com</link>
	<description>Courage to do something...</description>
	<pubDate>Sat, 01 Nov 2008 07:47:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<item>
		<title>Great Saying by Bonnie Blair</title>
		<link>http://sajjadhossain.com/2008/11/01/great-saying-by-bonnie-blair/</link>
		<comments>http://sajjadhossain.com/2008/11/01/great-saying-by-bonnie-blair/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 07:47:51 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[Great Sayings]]></category>

		<category><![CDATA[bonnie blair]]></category>

		<category><![CDATA[winning]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=105</guid>
		<description><![CDATA[




    

	]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://sajjadhossain.com/wp-content/uploads/2008/11/what_is_winning.jpg"><img class="size-full wp-image-106" title="what_is_winning" src="http://sajjadhossain.com/wp-content/uploads/2008/11/what_is_winning.jpg" alt="What is winning?" width="500" height="352" /></a></p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=Great%20Saying%20by%20Bonnie%20Blair&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F11%2F01%2Fgreat-saying-by-bonnie-blair%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/11/01/great-saying-by-bonnie-blair/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript: String trimming and padding</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/</link>
		<comments>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 10:59:21 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[pad]]></category>

		<category><![CDATA[padding]]></category>

		<category><![CDATA[trim]]></category>

		<category><![CDATA[trimming]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=74</guid>
		<description><![CDATA[


When working with JavaScript in one of my projects I needed to trim strings and pad them. I googled for a solution and many sources I have got the following codes and sharing with you.
Trimming:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//trimming space from both side of the string
String.prototype.trim = function&#40;&#41; &#123;
	return this.replace&#40;/^\s+&#124;\s+$/g,&#34;&#34;&#41;;
&#125;
&#160;
//trimming space from left side of the string
String.prototype.ltrim = function&#40;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>When working with JavaScript in one of my projects I needed to trim strings and pad them. I googled for a solution and many sources I have got the following codes and sharing with you.</p>
<p><strong>Trimming:</strong></p>

<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
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//trimming space from both side of the string</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">trim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s+|\s+$/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//trimming space from left side of the string</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">ltrim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s+/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//trimming space from right side of the string</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">rtrim</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+$/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Using Trim Functions:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//write the code given above</span>
<span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;  black  &quot;</span>;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span> <span style="color: #339933;">+</span> str.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span>;   <span style="color: #006600; font-style: italic;">//result &quot;ablackb&quot;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span> <span style="color: #339933;">+</span> str.<span style="color: #660066;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span>;  <span style="color: #006600; font-style: italic;">//result &quot;ablack b&quot;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span> <span style="color: #339933;">+</span> str.<span style="color: #660066;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span>;  <span style="color: #006600; font-style: italic;">//result &quot;a blackb&quot;</span></pre></td></tr></table></div>

<p><strong>Padding:</strong></p>

<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
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//pads left</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">lpad</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>padString<span style="color: #339933;">,</span> length<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>;
    <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>str.<span style="color: #660066;">length</span> <span style="color: #339933;">&lt;</span> length<span style="color: #009900;">&#41;</span>
        str <span style="color: #339933;">=</span> padString <span style="color: #339933;">+</span> str;
    <span style="color: #000066; font-weight: bold;">return</span> str;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//pads right</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">rpad</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>padString<span style="color: #339933;">,</span> length<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>;
    <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>str.<span style="color: #660066;">length</span> <span style="color: #339933;">&lt;</span> length<span style="color: #009900;">&#41;</span>
        str <span style="color: #339933;">=</span> str <span style="color: #339933;">+</span> padString;
    <span style="color: #000066; font-weight: bold;">return</span> str;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Using Padding Functions:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;5&quot;</span>;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>str.<span style="color: #660066;">lpad</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">//result &quot;00005&quot;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>str.<span style="color: #660066;">rpad</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">//result &quot;50000&quot;</span></pre></td></tr></table></div>

<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=JavaScript%3A%20String%20trimming%20and%20padding&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F10%2F31%2Fjavascript-string-trimming-and-padding%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SSL (HTTPS) URLs and CodeIgniter</title>
		<link>http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/</link>
		<comments>http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 10:40:23 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[My Works]]></category>

		<category><![CDATA[code igniter]]></category>

		<category><![CDATA[https]]></category>

		<category><![CDATA[secured url]]></category>

		<category><![CDATA[ssl]]></category>

		<category><![CDATA[ssl redirection]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=55</guid>
		<description><![CDATA[


I am a fan of CodeIgniter for its ease of use. I have developed several ecommerce projects using this &#8220;beautiful&#8221; framework. While working on my first ecommerce project with CodeIgniter, I faced a problem with URLs. The site was suppose to use both &#8220;http&#8221; and &#8220;https&#8221;. But with CodeIgnitor we can define one base URL, [...]]]></description>
			<content:encoded><![CDATA[<p>I am a fan of CodeIgniter for its ease of use. I have developed several ecommerce projects using this &#8220;beautiful&#8221; framework. While working on my first ecommerce project with CodeIgniter, I faced a problem with URLs. The site was suppose to use both &#8220;http&#8221; and &#8220;https&#8221;. But with CodeIgnitor we can define one base URL, which can be either &#8220;http&#8221; or &#8220;https&#8221;. Then I came up with an idea and now I am going to share that idea with you. </p>
<p><strong>What I am going to do&#8230;</strong></p>
<p>We will create secure version of some functions. For this we will make changes in CodeIgnitor&#8217;s URL helper(url_helper.php), Config library (Config.php) and Config (config.php)  files. We will be creating secure version of following functions:</p>
<ul>
<li>site_url()</li>
<li>base_url()</li>
<li>anchor()</li>
<li>redirect()</li>
</ul>
<p><strong>Lets&#8217; start&#8230;</strong></p>
<p>First we will add the following config element in the config file:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="">'secure_base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="">'https://examples.com'</span>;</pre></div></div>

<p>Then, open the url_helper.php file (system/helpers/url_helper.php) and add the following codes:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="">'secure_site_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">secure_site_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
 
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="">'secure_base_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="">'secure_base_url'</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="">'secure_anchor'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_anchor<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$title</span>;
 
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$secure_site_url</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="">'!^\w+://! i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$uri</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$secure_site_url</span> <span style="color: #339933;">=</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
 
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$secure_site_url</span>;
        <span style="color: #009900;">&#125;</span>
 
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span> <span style="color: #339933;">!=</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> _parse_attributes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
 
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;'.$secure_site_url.'&quot;</span><span style="">'.$attributes.'</span><span style="color: #339933;">&gt;</span><span style="">'.$title.&lt;/a&gt;'</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
 
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="">'secure_redirect'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> <span style="">'location'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$http_response_code</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">302</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="">'refresh'</span>    <span style="color: #339933;">:</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Refresh:0;url=&quot;</span><span style="color: #339933;">.</span>secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #b1b100;">break</span>;
            <span style="color: #000000; font-weight: bold;">default</span>            <span style="color: #339933;">:</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: &quot;</span><span style="color: #339933;">.</span>secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span> <span style="color: #000088;">$http_response_code</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #b1b100;">break</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #990000;">exit</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> </pre></div></div>

<p>Now, add the following code in Config.php file (system/libraries/Config.php):</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">==</span> <span style="">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="">'index_page'</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$suffix</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="">'url_suffix'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> ? <span style="">''</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="">'url_suffix'</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="">'index_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;|^/*(.+?)/*$|&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$suffix</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Now what we have&#8230;</strong></p>
<p>Now what we have? We have secured versions of those function. You may now use them as their insecured version. Enjoy coding ;).</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=SSL%20%28HTTPS%29%20URLs%20and%20CodeIgniter&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F10%2F27%2Fssl-https-urls-and-codeigniter%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Security in PHP</title>
		<link>http://sajjadhossain.com/2008/08/26/security-in-php/</link>
		<comments>http://sajjadhossain.com/2008/08/26/security-in-php/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 05:53:47 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=48</guid>
		<description><![CDATA[PHP is a very flexible language. But sometimes this flexibility creates security flaws because of improper use of it. I had just read an article &#8220;Top 7 PHP Security Blunders&#8221; by Pax Dickinson. It shows top 7 mistakes or flaws that may break site security.
&#8220;Security is a process, not a product, and adopting a sound [...]]]></description>
			<content:encoded><![CDATA[<p>PHP is a very flexible language. But sometimes this flexibility creates security flaws because of improper use of it. I had just read an article &#8220;<a href="http://www.sitepoint.com/article/php-security-blunders" target="_blank">Top 7 PHP Security Blunders</a>&#8221; by Pax Dickinson. It shows top 7 mistakes or flaws that may break site security.</p>
<blockquote><p>&#8220;Security is a process, not a product, and adopting a sound approach to security during the process of application development will allow you to produce tighter, more robust code.&#8221; - Pax Dickinson</p></blockquote>
<p>In this article the author has shown how PHP application be infected and how to protect it. He has described the followings with reference to different articles:</p>
<ul>
<li>Unvalidated Input Errors</li>
<li>Access Control Flaws</li>
<li>Session ID Protection</li>
<li>Cross Site Scripting (XSS) Flaws</li>
<li>SQL Injection Vulnerabilities</li>
<li>Error Reporting</li>
<li>Data Handling Errors</li>
<li>Configuring PHP For Security</li>
</ul>
<p>I found this article knowledgeable. Hope you will like it. You may read it from here <a href="http://www.sitepoint.com/article/php-security-blunders" target="_blank">http://www.sitepoint.com/article/php-security-blunders</a>.</p>
<p>I want to conclude with lines from this article&#8230;</p>
<blockquote><p>&#8220;&#8230;there are many things to be aware of when programming secure PHP applications,  though this is true with any language, and any server platform. PHP is no less  secure than many other common development languages. The most important thing is  to develop a proper security mindset and to know your tools well&#8230;&#8221;</p></blockquote>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=Security%20in%20PHP&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F08%2F26%2Fsecurity-in-php%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/08/26/security-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>cPanel: Class for creating email account and mail forwarder</title>
		<link>http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/</link>
		<comments>http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 09:49:44 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[DOMPDF]]></category>

		<category><![CDATA[Miscellaneous]]></category>

		<category><![CDATA[My Works]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[cpanel]]></category>

		<category><![CDATA[cpanel class]]></category>

		<category><![CDATA[mail creator]]></category>

		<category><![CDATA[mail forwader]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=45</guid>
		<description><![CDATA[This class can be used to create email account and mail forwarders using PHP, without logging to cPanel.  It is an extension of script made by www.zubrag.com. You can access the original link from here http://www.zubrag.com/scripts/cpanel-create-email-account.php. And it is also a modified version of the class &#8220;cpmail&#8221; which was coded by Md. Zakir Hossain [...]]]></description>
			<content:encoded><![CDATA[<p>This class can be used to create email account and mail forwarders using PHP, without logging to cPanel.  It is an extension of script made by www.zubrag.com. You can access the original link from here http://www.zubrag.com/scripts/cpanel-create-email-account.php. And it is also a modified version of the class &#8220;cpmail&#8221; which was coded by Md. Zakir Hossain (Raju), http://www.rajuru.xenexbd.com.  <strong>How to configure:</strong></p>
<ol>
<li><a title="Download cPanel Manager" href="http://sajjadhossain.com/wp-content/uploads/2008/07/cpmailmanager10.rar">Download</a> the zipped file.</li>
<li>Unzip the file. This file contains the class file and an example file.</li>
<li>Open the class file and change these variables -
<ul>
<li>$currentTheme - Your cPanel theme</li>
<li>$userName - Your cPanel user name</li>
<li>$password - Your cPanel password</li>
<li>$domain - Your cPanel domain</li>
<li>$cPanelPort - Your cPanel port [optional]</li>
</ul>
</li>
<li>Include the class in the file where you want to use it.</li>
</ol>
<p><strong>Example:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// include the class file</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="">'class.cpmailmanager.php'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// create an instanse of the class</span>
<span style="color: #000088;">$cp</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CPMailManager<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// create an email account</span>
<span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createEmail</span><span style="color: #009900;">&#40;</span><span style="">'sadat'</span><span style="color: #339933;">,</span> <span style="">'sadat123'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">status</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//account created successfully</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #990000;">echo</span> <span style="">'Mail created successfully'</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #990000;">echo</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// create mail forwarder</span>
<span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createForwarder</span><span style="color: #009900;">&#40;</span><span style="">'sadat'</span><span style="color: #339933;">,</span> <span style="">'msh@example.com'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">echo</span> <span style="">'&lt;br /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// delete mail forwarder</span>
<span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">deleteForwarder</span><span style="color: #009900;">&#40;</span><span style="">'sadat'</span><span style="color: #339933;">,</span> <span style="">'msh@example.com'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">echo</span> <span style="">'&lt;br /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// delete email account</span>
<span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">deleteEmail</span><span style="color: #009900;">&#40;</span><span style="">'sadat'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">echo</span> <span style="">'&lt;br /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span>;</pre></div></div>

<p><a title="cPanel Mail Manager" href="http://sajjadhossain.com/wp-content/uploads/2008/07/cpmailmanager10.rar"><img class="alignleft size-full wp-image-6" style="float: left;" src="http://sajjadhossain.com/wp-content/uploads/2008/01/download.gif" alt="download cPanel: Class for creating email account and mail forwarder" width="95" height="20" title="cPanel: Class for creating email account and mail forwarder" /></a></p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=cPanel%3A%20Class%20for%20creating%20email%20account%20and%20mail%20forwarder&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F07%2F15%2Fcpanel-class-for-creating-email-account-and-mail-forwarder%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgraded my site to latest version of WordPress</title>
		<link>http://sajjadhossain.com/2008/06/28/upgraded-my-site-to-latest-version-of-wordpress/</link>
		<comments>http://sajjadhossain.com/2008/06/28/upgraded-my-site-to-latest-version-of-wordpress/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 11:32:46 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<category><![CDATA[upgrade]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=44</guid>
		<description><![CDATA[For some days I was thinking to update my site to latest version of WordPress. But I was not sure how much time will take to complete the task and what complexity I will have to face.
Today is my holiday and I am a little bit free today. So, I decided to upgrade my WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>For some days I was thinking to update my site to latest version of WordPress. But I was not sure how much time will take to complete the task and what complexity I will have to face.</p>
<p>Today is my holiday and I am a little bit free today. So, I decided to upgrade my WordPress setup. Taking a deep breath I started reading the <a title="Upgrading WordPress - Three Step Upgrade" href="http://codex.wordpress.org/Upgrading_WordPress" target="_blank">&#8220;Upgrading WordPress - <span class="mw-headline">Three Step Upgrade</span>&#8220;</a> guide. Followed the instruction carefully and within half an hour I was able to upgrade it successfully. I found this process very easy and less time consuming.</p>
<p>Thanks WordPress!</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=Upgraded%20my%20site%20to%20latest%20version%20of%20WordPress&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F06%2F28%2Fupgraded-my-site-to-latest-version-of-wordpress%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/06/28/upgraded-my-site-to-latest-version-of-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CodeIgniter - Plugin for DOMPDF</title>
		<link>http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/</link>
		<comments>http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 15:01:10 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[DOMPDF]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code igniter plugin dompdf]]></category>

		<category><![CDATA[pdf]]></category>

		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/</guid>
		<description><![CDATA[I have modified the plugin for DOMPDF which is found in CodeIgniter forum. I have added the paper size and orientation parameters. Here is the code to share with you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
&#60;?php if &#40;!defined&#40;'BASEPATH'&#41;&#41; exit&#40;'No direct script access allowed'&#41;;
&#160;
    function pdf_create&#40;$html, $filename, $stream=true, $papersize = 'letter', $orientation = 'portrait'&#41;
    &#123;
        require_once&#40;&#34;dompdf/dompdf_config.inc.php&#34;&#41;;
&#160;
        $dompdf = new DOMPDF&#40;&#41;;
        $dompdf-&#62;load_html&#40;$html&#41;;
        $dompdf-&#62;set_paper&#40;$papersize, $orientation&#41;;
        $dompdf-&#62;render&#40;&#41;;
&#160;
        if &#40;$stream&#41;
        &#123;
            $options&#91;'Attachment'&#93; = 1;
            $options&#91;'Accept-Ranges'&#93; = 0;
            $options&#91;'compress'&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>I have modified the plugin for DOMPDF which is found in CodeIgniter forum. I have added the paper size and orientation parameters. Here is the code to share with you.</p>

<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
22
23
24
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> pdf_create<span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$stream</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$papersize</span> <span style="color: #339933;">=</span> <span style="">'letter'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orientation</span> <span style="color: #339933;">=</span> <span style="">'portrait'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;dompdf/dompdf_config.inc.php&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        <span style="color: #000088;">$dompdf</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMPDF<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #000088;">$dompdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load_html</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #000088;">$dompdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_paper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$papersize</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orientation</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #000088;">$dompdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$stream</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="">'Attachment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>;
            <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="">'Accept-Ranges'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
            <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="">'compress'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>;
            <span style="color: #000088;">$dompdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">stream</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.pdf&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            write_file<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$filename.pdf&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dompdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">output</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=CodeIgniter%20-%20Plugin%20for%20DOMPDF&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F06%2F21%2Fcodeigniter-plugin-for-dompdf%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DOMPDF without PDFLib as back-end PDF support</title>
		<link>http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/</link>
		<comments>http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 14:47:27 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[DOMPDF]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[ci and pdf]]></category>

		<category><![CDATA[code igniter]]></category>

		<category><![CDATA[codeigniter with dompdf]]></category>

		<category><![CDATA[dompdf without pdflib]]></category>

		<category><![CDATA[pdf]]></category>

		<category><![CDATA[pdf ci]]></category>

		<category><![CDATA[pdf codeigniter]]></category>

		<category><![CDATA[pdflib]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/</guid>
		<description><![CDATA[I was implementing PDF generation in one of projects which is built with CodeIgniter. I searched for PDF support for CodeIgniter and found help on CI forum. I followed the instruction given there and used DOMPDF. The result was satisfactory though I faced an issue. I was happy, but the problem was with the PDFLib. [...]]]></description>
			<content:encoded><![CDATA[<p>I was implementing PDF generation in one of projects which is built with CodeIgniter. I searched for PDF support for CodeIgniter and found <a target="_blank" href="http://codeigniter.com/wiki/PDF_generation_using_dompdf/">help on CI forum</a>. I followed the instruction given there and used DOMPDF. The result was satisfactory though I faced an <a target="_blank" href="http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/">issue</a>. I was happy, but the problem was with the PDFLib. Its not free and our client would not buy it. I thought that DOMPDF will not work without the help of PDFLib. Soon I loss my happiness and started looking for an alternate solution. Then our team decided to use HTML2FPDF. But the result was not satisfactory. We had to rewrite our html files. It was lacking lots of HTML support. I was not happy with the output. So I started googling again for a PDF library. While searching I came accross a library called HTML2PS/HTML2PDF. But, it seemed to me complex. I again started searching for any solution which will help me use DOMPDF in my project without PDFLib. At last I got the solution from <a target="_blank" href="http://www.digitaljunkies.ca/dompdf/install.php">DOMPDF site</a> ;).</p>
<p>&#8220;&#8230;Edit dompdf_config.inc.php to fit your installation. If you leave the DOMPDF_PDF_BACKEND setting at &#8216;auto&#8217; dompdf will use PDFLib if it is installed, otherwise it will use the bundled R&amp;OS CPDF class&#8230;&#8221;</p>
<p>I was very much happy to read this. I might have missed this while installing DOMPDF for the first time. Thanks DOMPDF for a nice interface and output. Really DOMPDF made our coding not just easy, but saved our times :).</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=DOMPDF%20without%20PDFLib%20as%20back-end%20PDF%20support&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F06%2F21%2Fdompdf-without-pdflib-as-back-end-pdf-support%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DOMPDF Attachment issue in IE (Internet Explorer)</title>
		<link>http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/</link>
		<comments>http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/#comments</comments>
		<pubDate>Fri, 30 May 2008 11:06:35 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[DOMPDF]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Attachment]]></category>

		<category><![CDATA[code igniter]]></category>

		<category><![CDATA[IE]]></category>

		<category><![CDATA[issue]]></category>

		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/</guid>
		<description><![CDATA[I have used DOMPDF in my project. But I was facing problem with Attachment. In FireFox it was working fine. But in Internet Explorer (I used IE 6) it ended with an error. In IE it was showing the download dialogue box offering the script page I used to generate the PDF file. When I [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">I have used DOMPDF in my project. But I was facing problem with Attachment. In FireFox it was working fine. But in Internet Explorer (I used IE 6) it ended with an error. In IE it was showing the download dialogue box offering the script page I used to generate the PDF file. When I tried to download the file it showed an error.</p>
<p class="MsoNormal">I searched the web and found no suitable solution. I followed the instruction given in <a href="http://www.corenettech.com/blog/index.php/2008/04/06/using-dompdf-with-windows-and-ie/">http://www.corenettech.com/blog/</a> but it didn’t work :(. But I got an idea from this post. I started digging the code and have done following changes to PDFLib_Adapter class (available in DOMPDF_DiRECTORY/include/pdflib_adapter.cls.php).</p>
<p class="MsoNormal">I have removed the following line (line 829):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>829
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: private&quot;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p class="MsoNormal">and added</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;MSIE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Expires: 0'</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Cache-Control: must-revalidate, post-check=0, pre-check=0'</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Transfer-Encoding: binary&quot;</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Pragma: public'</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: private&quot;</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Transfer-Encoding: binary&quot;</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Expires: 0'</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="">'Pragma: no-cache'</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p class="MsoNormal">After</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: application/pdf&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: $attach; filename=<span style="color: #000099; font-weight: bold;">\&quot;</span>$filename<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>That’s it! My code started working :).</p>
<p>Hope this will save your time of surfing the net ;).</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=DOMPDF%20Attachment%20issue%20in%20IE%20%28Internet%20Explorer%29&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F05%2F30%2Fdompdf-attachment-issue-in-ie-internet-explorer%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Paging Class using PHP and MySQL</title>
		<link>http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/</link>
		<comments>http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 17:21:30 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
		
		<category><![CDATA[My Works]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code for php pagination]]></category>

		<category><![CDATA[code for php paging]]></category>

		<category><![CDATA[pagination]]></category>

		<category><![CDATA[pagination class]]></category>

		<category><![CDATA[paging]]></category>

		<category><![CDATA[paging class]]></category>

		<category><![CDATA[php pagination]]></category>

		<category><![CDATA[php paging]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/</guid>
		<description><![CDATA[Based on my last post on paging using PHP and MySQL, I have coded this class. It is very easy to implement and it will save your time. Here is a code snippet to show how simple to use it.

//include the class file
include&#40;'Pager.php'&#41;;
&#160;
//making connection to the database
mysql_connect&#40;'localhost', 'root', ''&#41;;
mysql_select_db&#40;'test'&#41;;
&#160;
//prepare SQL
$sql = 'SELECT * FROM books';
&#160;
//create [...]]]></description>
			<content:encoded><![CDATA[<p>Based on my last post on <a href="http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/" target="_blank">paging using PHP and MySQL</a>, I have coded this class. It is very easy to implement and it will save your time. Here is a code snippet to show how simple to use it.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//include the class file</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="">'Pager.php'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//making connection to the database</span>
<span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="">'localhost'</span><span style="color: #339933;">,</span> <span style="">'root'</span><span style="color: #339933;">,</span> <span style="">''</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="">'test'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//prepare SQL</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="">'SELECT * FROM books'</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//create an object of Pager passing the SQL</span>
<span style="color: #000088;">$pager</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Pager<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//set the url. this is the current page</span>
<span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span> <span style="color: #339933;">=</span> <span style="">'index.php'</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//set number of rows. by default it is 10</span>
<span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rowPerPage</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//build the pager</span>
<span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">//get paged data</span>
<span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPagedData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Click the download link given below for a copy of the class. It also includes an working example.</p>
<p><a href="http://sajjadhossain.com/wp-content/uploads/2008/04/pager.rar" title="Pager - Paging class for PHP and MySQL"><img src="http://sajjadhossain.com/wp-content/uploads/2008/01/download.gif" alt="Download" border="0" title="Paging Class using PHP and MySQL" /></a></p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Dream%20House&amp;siteurl=http%3A%2F%2Fsajjadhossain.com%2F&amp;linkname=Paging%20Class%20using%20PHP%20and%20MySQL&amp;linkurl=http%3A%2F%2Fsajjadhossain.com%2F2008%2F04%2F24%2Fpaging-class-using-php-and-mysql%2F"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
