<?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>Dream House &#187; PHP</title>
	<atom:link href="http://sajjadhossain.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajjadhossain.com</link>
	<description>Courage to do something...</description>
	<lastBuildDate>Sun, 07 Nov 2010 06:45:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SSL (HTTPS) URLs and CodeIgniter (Extending the core)</title>
		<link>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 17:25:54 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=241</guid>
		<description><![CDATA[In one of my previous post I have shown how we can use both secure and non-secure URLs. Now I am going to show how we can do this, extending native libraries. What we are going to do&#8230; We will create secure version of some functions. For this we will create a helper file &#8216;my_url_helper.php&#8217; [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/' rel='bookmark' title='SSL (HTTPS) URLs and CodeIgniter'>SSL (HTTPS) URLs and CodeIgniter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div><img class="alignleft size-full wp-image-111" title="ci_logo_flame" src="http://sajjadhossain.com/wp-content/uploads/2008/10/ci_logo_flame.jpg" alt="ci logo flame SSL (HTTPS) URLs and CodeIgniter (Extending the core)" width="63" height="69" />In one of my previous <a href="http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_blank">post</a> I have shown how we can use both secure and non-secure URLs. Now I am going to show how we can do this, extending native libraries.</div>
<div><strong>What we are going to do&#8230;</strong></div>
<div>We will create secure version of some functions. For this we will create a helper file &#8216;my_url_helper.php&#8217; and save it in &#8216;system/application/helpers&#8217;. We will be creating secure version of following functions:</div>
<div>
<ul>
<li>site_url()</li>
<li>base_url()</li>
<li>anchor()</li>
<li>redirect()</li>
</ul>
</div>
<div>Lets&#8217; start&#8230;</div>
<div>First we will add the following config element in the config file:</div>

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

<div>Then, open the my_url_helper.php file (system/application/helpers/my_url_helper.php) and add the following codes.</div>

<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: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'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="color: #0000ff;">''</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: #339933;">;</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: #339933;">;</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="color: #0000ff;">'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: #339933;">;</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="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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="color: #0000ff;">'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="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</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: #339933;">;</span>
&nbsp;
        <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="color: #0000ff;">'!^\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: #339933;">;</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: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <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="color: #0000ff;">''</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: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <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="color: #0000ff;">''</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: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">.</span><span style="color: #000088;">$title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</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="color: #0000ff;">'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="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'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="color: #0000ff;">'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: #339933;">;</span>
                                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">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: #009900; 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: #339933;">;</span>
                                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div>Now, I will extend the Config library (system/libraries/Config.php). I assume that the sub class prefix is set as &#8216;MY_&#8217; in config file (system/application/config/config.php). Create a file &#8216;MY_Config.php&#8217; in &#8216;system/application/libraries&#8217; folder and save the file with following code.</div>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MY_Config <span style="color: #000000; font-weight: bold;">extends</span> CI_Config
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> MY_Config<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span><span style="color: #004000;">CI_Config</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <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="color: #0000ff;">''</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="color: #0000ff;">'/'</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: #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="color: #0000ff;">''</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="color: #0000ff;">'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="color: #0000ff;">'index_page'</span><span style="color: #009900;">&#41;</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: #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="color: #0000ff;">'url_suffix'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">''</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="color: #0000ff;">'url_suffix'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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="color: #0000ff;">'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="color: #0000ff;">'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: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div><strong>Now what we have&#8230;</strong></div>
<div>Now we have secured versions of those function. You may now use them as their insecured version. Enjoy coding <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink SSL (HTTPS) URLs and CodeIgniter (Extending the core)" class='wp-smiley' title="SSL (HTTPS) URLs and CodeIgniter (Extending the core)" /> .</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2010%2F08%2F18%2Fssl-https-urls-and-codeigniter-extending-the-core%2F&amp;title=SSL%20%28HTTPS%29%20URLs%20and%20CodeIgniter%20%28Extending%20the%20core%29" id="wpa2a_2"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 SSL (HTTPS) URLs and CodeIgniter (Extending the core)"  title="SSL (HTTPS) URLs and CodeIgniter (Extending the core)" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/' rel='bookmark' title='SSL (HTTPS) URLs and CodeIgniter'>SSL (HTTPS) URLs and CodeIgniter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Security in PHP</title>
		<link>http://sajjadhossain.com/2008/08/26/security-in-php/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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 [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<div id="attachment_113" class="wp-caption alignleft" style="width: 397px"><img class="size-full wp-image-113" title="php_security" src="http://sajjadhossain.com/wp-content/uploads/2008/08/php_security.jpg" alt="php security Security in PHP" width="387" height="340" /><p class="wp-caption-text">PHP Security</p></div>
<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; &#8211; 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><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F08%2F26%2Fsecurity-in-php%2F&amp;title=Security%20in%20PHP" id="wpa2a_4"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Security in PHP"  title="Security in PHP" /></a></p><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/08/26/security-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</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/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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[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 (Raju), [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/' rel='bookmark' title='Paging Class using PHP and MySQL'>Paging Class using PHP and MySQL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-116" title="cpanel_logo" src="http://sajjadhossain.com/wp-content/uploads/2008/07/cpanel_logo.jpg" alt="cpanel logo cPanel: Class for creating email account and mail forwarder" width="190" height="90" />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#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">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 &#8211; Your cPanel theme</li>
<li>$userName &#8211; Your cPanel user name</li>
<li>$password &#8211; Your cPanel password</li>
<li>$domain &#8211; Your cPanel domain</li>
<li>$cPanelPort &#8211; 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" 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="color: #0000ff;">'class.cpmailmanager.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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><span style="color: #339933;">;</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="color: #0000ff;">'sadat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sadat123'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #b1b100;">echo</span> <span style="color: #0000ff;">'Mail created successfully'</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: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span><span style="color: #339933;">;</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="color: #0000ff;">'sadat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'msh@example.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span><span style="color: #339933;">;</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="color: #0000ff;">'sadat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'msh@example.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span><span style="color: #339933;">;</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="color: #0000ff;">'sadat'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span><span style="color: #339933;">;</span></pre></div></div>

<p><a title="cPanel Mail Manager" href="http://sajjadhossain.com/wp-content/uploads/2008/07/cpmailmanager10.rar#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><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><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F07%2F15%2Fcpanel-class-for-creating-email-account-and-mail-forwarder%2F&amp;title=cPanel%3A%20Class%20for%20creating%20email%20account%20and%20mail%20forwarder" id="wpa2a_6"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 cPanel: Class for creating email account and mail forwarder"  title="cPanel: Class for creating email account and mail forwarder" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/' rel='bookmark' title='Paging Class using PHP and MySQL'>Paging Class using PHP and MySQL</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CodeIgniter &#8211; Plugin for DOMPDF</title>
		<link>http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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 [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/' rel='bookmark' title='DOMPDF Attachment issue in IE (Internet Explorer)'>DOMPDF Attachment issue in IE (Internet Explorer)</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/' rel='bookmark' title='DOMPDF without PDFLib as back-end PDF support'>DOMPDF without PDFLib as back-end PDF support</a></li>
</ol>]]></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" 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="color: #0000ff;">'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="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$papersize</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'letter'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orientation</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'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><span style="color: #339933;">;</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: #339933;">;</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: #339933;">;</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: #339933;">;</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><span style="color: #339933;">;</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="color: #0000ff;">'Attachment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Accept-Ranges'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'compress'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</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: #339933;">;</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;<span style="color: #006699; font-weight: bold;">$filename</span>.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: #339933;">;</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><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F06%2F21%2Fcodeigniter-plugin-for-dompdf%2F&amp;title=CodeIgniter%20%26%238211%3B%20Plugin%20for%20DOMPDF" id="wpa2a_8"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 CodeIgniter   Plugin for DOMPDF"  title="CodeIgniter   Plugin for DOMPDF" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/' rel='bookmark' title='DOMPDF Attachment issue in IE (Internet Explorer)'>DOMPDF Attachment issue in IE (Internet Explorer)</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/' rel='bookmark' title='DOMPDF without PDFLib as back-end PDF support'>DOMPDF without PDFLib as back-end PDF support</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</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/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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. [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/' rel='bookmark' title='DOMPDF Attachment issue in IE (Internet Explorer)'>DOMPDF Attachment issue in IE (Internet Explorer)</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/' rel='bookmark' title='CodeIgniter &#8211; Plugin for DOMPDF'>CodeIgniter &#8211; Plugin for DOMPDF</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-120" style="padding:0 5px 5px 0" title="dompdf_logo" src="http://sajjadhossain.com/wp-content/uploads/2008/06/dompdf_logo.png" alt="dompdf logo DOMPDF without PDFLib as back end PDF support" width="150" height="57" />I was implementing PDF generation in one of projects which is built with CodeIgniter. I searched for PDF support for CodeIgniter and found <a href="http://codeigniter.com/wiki/PDF_generation_using_dompdf/" target="_blank">help on CI forum</a>. I followed the instruction given there and used DOMPDF. The result was satisfactory though I faced an <a href="http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_blank">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 href="http://www.digitaljunkies.ca/dompdf/install.php" target="_blank">DOMPDF site</a> <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink DOMPDF without PDFLib as back end PDF support" class='wp-smiley' title="DOMPDF without PDFLib as back end PDF support" /> .</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 <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile DOMPDF without PDFLib as back end PDF support" class='wp-smiley' title="DOMPDF without PDFLib as back end PDF support" /> .</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F06%2F21%2Fdompdf-without-pdflib-as-back-end-pdf-support%2F&amp;title=DOMPDF%20without%20PDFLib%20as%20back-end%20PDF%20support" id="wpa2a_10"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 DOMPDF without PDFLib as back end PDF support"  title="DOMPDF without PDFLib as back end PDF support" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/' rel='bookmark' title='DOMPDF Attachment issue in IE (Internet Explorer)'>DOMPDF Attachment issue in IE (Internet Explorer)</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/' rel='bookmark' title='CodeIgniter &#8211; Plugin for DOMPDF'>CodeIgniter &#8211; Plugin for DOMPDF</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</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/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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 [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/' rel='bookmark' title='DOMPDF without PDFLib as back-end PDF support'>DOMPDF without PDFLib as back-end PDF support</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/' rel='bookmark' title='CodeIgniter &#8211; Plugin for DOMPDF'>CodeIgniter &#8211; Plugin for DOMPDF</a></li>
<li><a href='http://sajjadhossain.com/2009/05/14/internet-explorer-developer-toolbar/' rel='bookmark' title='Internet Explorer Developer Toolbar'>Internet Explorer Developer Toolbar</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><img class="alignleft size-full wp-image-124" style="padding:0 5px 5px 0;" title="dompdf_ie" src="http://sajjadhossain.com/wp-content/uploads/2008/05/dompdf_ie.png" alt="dompdf ie DOMPDF Attachment issue in IE (Internet Explorer)" width="150" height="108" />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 <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad DOMPDF Attachment issue in IE (Internet Explorer)" class='wp-smiley' title="DOMPDF Attachment issue in IE (Internet Explorer)" /> . 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"><div class="code"><pre class="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><span style="color: #339933;">;</span></pre></div></div>

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

<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;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'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="color: #0000ff;">'Expires: 0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cache-Control: must-revalidate, post-check=0, pre-check=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #339933;">;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pragma: public'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #339933;">;</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: #339933;">;</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: #339933;">;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Expires: 0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Pragma: no-cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="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: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: <span style="color: #006699; font-weight: bold;">$attach</span>; filename=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$filename</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That’s it! My code started working <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile DOMPDF Attachment issue in IE (Internet Explorer)" class='wp-smiley' title="DOMPDF Attachment issue in IE (Internet Explorer)" /> .</p>
<p>Hope this will save your time of surfing the net <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink DOMPDF Attachment issue in IE (Internet Explorer)" class='wp-smiley' title="DOMPDF Attachment issue in IE (Internet Explorer)" /> .</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F05%2F30%2Fdompdf-attachment-issue-in-ie-internet-explorer%2F&amp;title=DOMPDF%20Attachment%20issue%20in%20IE%20%28Internet%20Explorer%29" id="wpa2a_12"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 DOMPDF Attachment issue in IE (Internet Explorer)"  title="DOMPDF Attachment issue in IE (Internet Explorer)" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/06/21/dompdf-without-pdflib-as-back-end-pdf-support/' rel='bookmark' title='DOMPDF without PDFLib as back-end PDF support'>DOMPDF without PDFLib as back-end PDF support</a></li>
<li><a href='http://sajjadhossain.com/2008/06/21/codeigniter-plugin-for-dompdf/' rel='bookmark' title='CodeIgniter &#8211; Plugin for DOMPDF'>CodeIgniter &#8211; Plugin for DOMPDF</a></li>
<li><a href='http://sajjadhossain.com/2009/05/14/internet-explorer-developer-toolbar/' rel='bookmark' title='Internet Explorer Developer Toolbar'>Internet Explorer Developer Toolbar</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/05/30/dompdf-attachment-issue-in-ie-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Paging Class using PHP and MySQL</title>
		<link>http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</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;; [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/' rel='bookmark' title='Paging using PHP and MySQL'>Paging using PHP and MySQL</a></li>
<li><a href='http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/' rel='bookmark' title='cPanel: Class for creating email account and mail forwarder'>cPanel: Class for creating email account and mail forwarder</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Based on my last post on <a href="http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" 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" 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="color: #0000ff;">'Pager.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'root'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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="color: #0000ff;">'SELECT * FROM books'</span><span style="color: #339933;">;</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><span style="color: #339933;">;</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="color: #0000ff;">'index.php'</span><span style="color: #339933;">;</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><span style="color: #339933;">;</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><span style="color: #339933;">;</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><span style="color: #339933;">;</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#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" title="Pager - Paging class for PHP and MySQL"><img src="http://sajjadhossain.com/wp-content/uploads/2008/01/download.gif" alt="download Paging Class using PHP and MySQL" border="0" title="Paging Class using PHP and MySQL" /></a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F04%2F24%2Fpaging-class-using-php-and-mysql%2F&amp;title=Paging%20Class%20using%20PHP%20and%20MySQL" id="wpa2a_14"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Paging Class using PHP and MySQL"  title="Paging Class using PHP and MySQL" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/' rel='bookmark' title='Paging using PHP and MySQL'>Paging using PHP and MySQL</a></li>
<li><a href='http://sajjadhossain.com/2008/07/15/cpanel-class-for-creating-email-account-and-mail-forwarder/' rel='bookmark' title='cPanel: Class for creating email account and mail forwarder'>cPanel: Class for creating email account and mail forwarder</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Paging using PHP and MySQL</title>
		<link>http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 08:30:27 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code for php pagination]]></category>
		<category><![CDATA[code for php paging]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[php pagination]]></category>
		<category><![CDATA[php paging]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=28</guid>
		<description><![CDATA[I have coded a class for paging, you may find it here. ### Code for Paging Starts ### //index no of the page $pageIndex = &#40;&#40;int&#41;$_REQUEST&#91;'pageIndex'&#93; == 0&#41; ? 1 : &#40;int&#41;$_REQUEST&#91;'pageIndex'&#93;; &#160; //number of rows $rowPerPage = 10; &#160; //counting total number of rows $sql = 'SELECT COUNT(*)         FROM {your_table_name}         [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/' rel='bookmark' title='Paging Class using PHP and MySQL'>Paging Class using PHP and MySQL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have coded a class for paging, you may find it <a href="http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">### Code for Paging Starts ###
</span><span style="color: #666666; font-style: italic;">//index no of the page</span>
<span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pageIndex'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pageIndex'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//number of rows</span>
<span style="color: #000088;">$rowPerPage</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//counting total number of rows</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT COUNT(*)
        FROM {your_table_name}
        WHERE {IF ANY CONDITION}'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</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: #339933;">,</span> <span style="color: #000088;">$link_identifier</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// total records</span>
<span style="color: #000088;">$totalRecords</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// number of pages</span>
<span style="color: #000088;">$totalPages</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalRecords</span><span style="color: #339933;">/</span><span style="color: #000088;">$rowPerPage</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$totalPages</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalPages</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$startIndex</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$rowPerPage</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalRecords</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$rowPerPage</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$endIndex</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$startIndex</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$rowPerPage</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: #000088;">$endIndex</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalRecords</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$totalPages</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: #000088;">$totalRecords</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$totalPages</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$rowPerPage</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$endIndex</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalRecords</span><span style="color: #339933;">;</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: #000088;">$totalRecords</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;">$rangeStart</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$startIndex</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalRecords</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$rowPerPage</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$totalPages</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$rangeEnd</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalRecords</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: #000088;">$rangeEnd</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$endIndex</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$range</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Showing '</span>  <span style="color: #339933;">.</span> <span style="color: #000088;">$rangeStart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' - '</span><span style="color: #339933;">.</span><span style="color: #000088;">$rangeEnd</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' of '</span><span style="color: #339933;">.</span><span style="color: #000088;">$totalRecords</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// link for next page</span>
<span style="color: #000088;">$nextLink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'page_name.php?pageIndex='</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// link for previous page</span>
<span style="color: #000088;">$previousLink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'page_name.php?pageIndex='</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageIndex</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// fetching data using pagination</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT *
            FROM {your_table_name}
            WHERE {IF ANY CONDITION}
            LIMIT <span style="color: #006699; font-weight: bold;">$startIndex</span>, <span style="color: #006699; font-weight: bold;">$rowPerPage</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</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: #339933;">,</span> <span style="color: #000088;">$link_identifier</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">### Code for Paging Ends ###</span></pre></div></div>

<p>Now use the resource &#8216;$query&#8217; and do what you want to do.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F03%2F09%2Fpaging-using-php-and-mysql%2F&amp;title=Paging%20using%20PHP%20and%20MySQL" id="wpa2a_16"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Paging using PHP and MySQL"  title="Paging using PHP and MySQL" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/04/24/paging-class-using-php-and-mysql/' rel='bookmark' title='Paging Class using PHP and MySQL'>Paging Class using PHP and MySQL</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/03/09/paging-using-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enabling cURL in XAMPP</title>
		<link>http://sajjadhossain.com/2008/02/25/enabling-curl-in-xampp/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2008/02/25/enabling-curl-in-xampp/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 10:00:03 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[enabling curl]]></category>
		<category><![CDATA[enabling curl in xampp environment]]></category>
		<category><![CDATA[xampp]]></category>
		<category><![CDATA[xampp environment]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=20</guid>
		<description><![CDATA[By default cURL is disable in XAMPP installation. If you want to enable cURL of your XAMPP environment then uncomment the following line: ;extension=php_curl.dll to extension=php_curl.dll in the C:\Program Files\xampp\apache\bin\php.ini file (assuming you have installed XAMPP in &#8220;C:\Program Files&#8221; folder). If you plan to switch version of PHP in XAMPP you may made the change [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-sending-test-mails-with-mercurymail/' rel='bookmark' title='XAMPP &#8211; Sending test mails with MercuryMail'>XAMPP &#8211; Sending test mails with MercuryMail</a></li>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-my-favorite-php-environment/' rel='bookmark' title='XAMPP &#8211; My favorite PHP environment'>XAMPP &#8211; My favorite PHP environment</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>By default cURL is disable in XAMPP installation. If you want to enable cURL of your XAMPP environment then uncomment the following line:</p>
<p><span style="font-weight: bold">;extension=php_curl.dll</span></p>
<p>to</p>
<p><span style="font-weight: bold">extension=php_curl.dll</span></p>
<p>in the C:\Program Files\xampp\apache\bin\php.ini file (assuming you have installed XAMPP in &#8220;C:\Program Files&#8221; folder).</p>
<p>If you plan to switch version of PHP in XAMPP you may made the change in following files (assuming you have installed XAMPP in &#8220;C:\Program Files&#8221; folder):</p>
<ul>
<li>C:\Program Files\xampp\php\php5.ini</li>
<li>C:\Program Files\xampp\php\php.ini</li>
<li>C:\Program Files\xampp\php\php4\php.ini</li>
<li>C:\Program Files\xampp\php\php4\php4.ini</li>
</ul>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F02%2F25%2Fenabling-curl-in-xampp%2F&amp;title=Enabling%20cURL%20in%20XAMPP" id="wpa2a_18"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Enabling cURL in XAMPP"  title="Enabling cURL in XAMPP" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-sending-test-mails-with-mercurymail/' rel='bookmark' title='XAMPP &#8211; Sending test mails with MercuryMail'>XAMPP &#8211; Sending test mails with MercuryMail</a></li>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-my-favorite-php-environment/' rel='bookmark' title='XAMPP &#8211; My favorite PHP environment'>XAMPP &#8211; My favorite PHP environment</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/02/25/enabling-curl-in-xampp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XAMPP &#8211; Sending test mails with MercuryMail</title>
		<link>http://sajjadhossain.com/2008/01/28/xampp-sending-test-mails-with-mercurymail/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2008/01/28/xampp-sending-test-mails-with-mercurymail/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 16:33:08 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[mercury]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=19</guid>
		<description><![CDATA[XAMPP comes with MercuryMail. To use it for sending test mails, you can do the followings: 1. Start Mercury Mail from XAMPP control panel. 2. Navigate to Mercury Mail folder in XAMPP installation (Most probably C:\Program Files\xampp\MercuryMail) 3. Double click on mercury.exe and Mercury window will be opened. 4. Go to Configuration -&#62; Local Users [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-my-favorite-php-environment/' rel='bookmark' title='XAMPP &#8211; My favorite PHP environment'>XAMPP &#8211; My favorite PHP environment</a></li>
<li><a href='http://sajjadhossain.com/2008/02/25/enabling-curl-in-xampp/' rel='bookmark' title='Enabling cURL in XAMPP'>Enabling cURL in XAMPP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>XAMPP comes with MercuryMail. To use it for sending test mails, you can do the followings:</p>
<p>1. Start Mercury Mail from XAMPP control panel.<br />
2. Navigate to Mercury Mail folder in XAMPP installation (Most probably C:\Program Files\xampp\MercuryMail)<br />
3. Double click on mercury.exe and Mercury window will be opened.<br />
4. Go to Configuration -&gt; Local Users<br />
5. Add a user with password (Suppose sajjad)<br />
6. Close this window.</p>
<p>That&#8217;s it.</p>
<p>Now you can send mail to <a href="mailto:sajjad@localhost#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">sajjad@localhost</a> or <a href="mailto:sajjad@localhost.com#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">sajjad@localhost.com</a> (Mecury Mail should be started).</p>
<p>To receive mail configure outlook express with localhost as pop3 and SMTP server.</p>
<p>Hope these information will be helpful.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F01%2F28%2Fxampp-sending-test-mails-with-mercurymail%2F&amp;title=XAMPP%20%26%238211%3B%20Sending%20test%20mails%20with%20MercuryMail" id="wpa2a_20"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 XAMPP   Sending test mails with MercuryMail"  title="XAMPP   Sending test mails with MercuryMail" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/28/xampp-my-favorite-php-environment/' rel='bookmark' title='XAMPP &#8211; My favorite PHP environment'>XAMPP &#8211; My favorite PHP environment</a></li>
<li><a href='http://sajjadhossain.com/2008/02/25/enabling-curl-in-xampp/' rel='bookmark' title='Enabling cURL in XAMPP'>Enabling cURL in XAMPP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/01/28/xampp-sending-test-mails-with-mercurymail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

