<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Crying Glowing Sun</title>
	<atom:link href="http://mahtonu.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mahtonu.wordpress.com</link>
	<description>Tonu's another Web blog</description>
	<lastBuildDate>Sat, 26 Sep 2009 08:12:42 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mahtonu.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b73a3b58a63f640620cc63f8d0b0b719?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Crying Glowing Sun</title>
		<link>http://mahtonu.wordpress.com</link>
	</image>
			<item>
		<title>Cache PHP output for high traffic websites. PEAR: Cache_Lite</title>
		<link>http://mahtonu.wordpress.com/2009/09/25/cache-php-output-for-high-traffic-websites-pear-cache_lite/</link>
		<comments>http://mahtonu.wordpress.com/2009/09/25/cache-php-output-for-high-traffic-websites-pear-cache_lite/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 14:37:46 +0000</pubDate>
		<dc:creator>M A Hossain Tonu</dc:creator>
				<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Website Optimization]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Cache_Lite]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[high traffic]]></category>
		<category><![CDATA[Site Optimization]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://mahtonu.wordpress.com/?p=51</guid>
		<description><![CDATA[Intro…
Now days the WebPages are outcome of heavy script processing in order to provide more dynamicity to page visitors. The utility of server side scripting is to adopt more engineering on web. When the page gets more visitors or becomes more popular, you have to ensure that, that traffic doesn’t stack or queued in front [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=51&subd=mahtonu&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro…</strong></p>
<p>Now days the WebPages are outcome of heavy script processing in order to provide more dynamicity to page visitors. The utility of server side scripting is to adopt more engineering on web. When the page gets more visitors or becomes more popular, you have to ensure that, that traffic doesn’t stack or queued in front of your freaky web server. All you have to do is to serve them with your page and ofcourse serve it <strong>faster</strong>. Again server side scripting requires processing and compiling.</p>
<blockquote><p>In order to serve pages faster, to make light use of server side processing and compiling and to survive within heavy traffic, caching dynamic script output is needed.</p></blockquote>
<p><strong>The Need For Speed…</strong></p>
<p>Every time a request hits your web server, PHP has to do a lot of processing, all of your codes have to be compiled and executed for a single traffic hit every time. Interesting thing will be if the outcomes of all these processing is identical for each visitors. Say, processing happens every time for visitor 24500 and 24501 while the outputs are so same. Argh!!</p>
<p>What would be if we save the flat HTML generated for visitor 24500 and serve that to 24501 as well??? That will be awesome <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  coz this leads to less processing and faster page handover. This da mechanism we are talking about, yeah! Cache PHP output <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Well we can write such optimization system but there is a smart package in PEAR called Cache_Lite that can do this job for us. Let’s check out why Cache_Lite:</p>
<ul>
<li>It saves time of writing new caching codes <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </li>
<li>It&#8217;s optimized for high traffic websites</li>
<li>Robust, easy to implement</li>
<li>Have time to time documentation</li>
<li>Bunch of cool features. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p><strong>Installation…</strong></p>
<p>The Cache_Lite class comes courtesy of PEAR, the “PHP Extension and Application Repository” (<a href="http://pear.php.net">http://pear.php.net</a>). In case you didn&#8217;t know, PEAR is an online repository of free PHP software, including classes and modules for everything from data archiving to XML parsing. When you install PHP, a whole bunch of PEAR modules get installed as well; the Cache_Lite class is one of them.</p>
<p><em>In case not installed then…</em></p>
<p>It is just like coding hello world!! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>On ubuntu:</p>
<pre>sudo aptitude -y update
sudo aptitude install php-pear</pre>
<p>Now that we have PEAR, i would use it to install the Cache_Lite extension</p>
<pre>sudo pear install Cache_Lite</pre>
<p>Perfect! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>Checking whether installed/ checking PEAR verson:</strong></p>
<p>Both <strong>pear</strong> and <strong>pecl</strong> tools should be available everywhere on command line. For that to work, pear&#8217;s binary (<tt>bin</tt>) directory should be in your <tt>PATH</tt> variable.</p>
<p>To verify it works, simply type <strong>pear</strong>. A list of commands should be shown:</p>
<div style="background:#ffffff none repeat scroll 0 0;width:100%;color:#000000;">
<pre>$ pear
Commands:
build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
...</pre>
</div>
<p>You should further test that PEAR is up to date:</p>
<div style="background:#ffffff none repeat scroll 0 0;width:100%;color:#000000;">
<pre>$ pear version
PEAR Version: 1.7.2
PHP Version: 5.2.6RC4-pl0-gentoo
Zend Engine Version: 2.2.0
Running on: Linux ...</pre>
</div>
<p>More installation queries here: <a href="http://pear.php.net/manual/en/installation.checking.php">http://pear.php.net/manual/en/installation.checking.php</a></p>
<p><strong>Implementation…</strong></p>
<pre class="brush: php;">
&lt;?php

// Include the package
require_once('Cache/Lite.php'); // make sure cache_lite script path

// Set a id for this cache
$id = '123';

// Set a few options
$options = array(
    'cacheDir' =&gt; '/tmp/',
    'lifeTime' =&gt; 3600
);

// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);

// Test if thereis a valide cache for this id
if ($data = $Cache_Lite-&gt;get($id)) {

    // Cache hit !
    // Content is in $data
    // (...)

} else { // No valid cache found (you have to make the page)

    // Cache miss !
    // Put in $data datas to put in cache
    // (...)
    $Cache_Lite-&gt;save($data);

}

?&gt;
</pre>
<p>More clearly…</p>
<pre class="brush: php;">

&lt;?php
require_once &quot;Cache/Lite.php&quot;;

$options = array(
    'cacheDir' =&gt; '/tmp/',
    'lifeTime' =&gt; 7200,
    'pearErrorMode' =&gt; CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);

if ($data = $cache-&gt;get('id_of_the_page')) {

    // Cache hit !
    // Content is in $data
    echo $data;

} else {

    // No valid cache found (you have to make and save the page)
    $data = '&lt;html&gt;&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;this is a test&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;';
    echo $data;
    $cache-&gt;save($data);

}

?&gt;
</pre>
<p>If you wish use a cache per block and not a global cache, take as example the following script:</p>
<pre class="brush: php;">
&lt;?php
require_once('Cache/Lite.php');

$options = array(
    'cacheDir' =&gt; '/tmp/',
    'lifeTime' =&gt; 3600
);

// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);

if ($data = $Cache_Lite-&gt;get('block1')) {
    echo($data);
} else {
    $data = 'Data of the block 1';
    $Cache_Lite-&gt;save($data);
}

echo('&lt;br&gt;&lt;br&gt;Non cached line !&lt;br&gt;&lt;br&gt;');

if ($data = $Cache_Lite-&gt;get('block2')) {
    echo($data);
} else {
    $data = 'Data of the block 2';
    $Cache_Lite-&gt;save($data);
}

?&gt;
</pre>
<p><strong>Little bit implementation:</strong></p>
<p>The key point is Cache_Lite maintains a unique identifier for every page. Cache_Lite will check for that identifier used before. If so, it will retrieve the stored HTML from disk (can use RAM as turbo charged storage i.e. mount  tmpfs in RAM memory) and echo it right away. If not, we:</p>
<ul>
<li>turn on output buffereing so we can catch all following content</li>
<li>we include the original PHP code</li>
<li>catch the output buffer, and let Cache_Lite store it on disk for the next time.</li>
<li>and then echo it</li>
</ul>
<p>Example:</p>
<pre class="brush: php;">
&lt;?php

/* Include the class */
require_once 'Cache/Lite.php';

/* Set a key for this cache item */
$id = 'newsitem1';

/* Set a few options */
$options = array(
    'cacheDir' =&gt; '/var/www/www.mywebsite.com/cache/',
    'lifeTime' =&gt; 3600
);

/* Create a Cache_Lite object */
$Cache_Lite = new Cache_Lite($options);

/* Test if there is a valid cache-entry for this key */
if ($data = $Cache_Lite-&gt;get($id)) {
    /* Cache hit! We've got the cached content stored in $data! */
} else {
    /* Cache miss! Use ob_start to catch all the output that comes next*/
    ob_start();

    /* The original content, which is now saved in the output buffer */
    include &quot;requiredPhpFile.php&quot;;

    /* We've got fresh content stored in $data! */
    $data = ob_get_contents();

    /* Let's store our fresh content, so next
     * time we won't have to generate it! */
    $Cache_Lite-&gt;save($data, $id);
    ob_get_clean();
}
echo $data;

?&gt;
</pre>
<p><strong>A Special case…</strong></p>
<p>Say a case, is to automatically purge an article&#8217;s cache when a comment has been placed. You could for example place this before Cache_Lite checks if it&#8217;s got a cache page for a specific $id:</p>
<pre class="brush: php;">

&lt;?php
if(isset($_POST[&quot;add_comment&quot;]) &amp;&amp; $_POST[&quot;add_comment&quot;]){
    $Cache_Lite-&gt;remove($id);
}

?&gt;
</pre>
<p>Docs for Cahe_Lite here:</p>
<p><a href="http://pear.php.net/manual/en/package.caching.cache-lite.php">http://pear.php.net/manual/en/package.caching.cache-lite.php</a></p>
Posted in PEAR, PHP, tech, Website Optimization Tagged: Cache_Lite, Caching, high traffic, PEAR, PHP, Site Optimization, tech, technology, Tips, Tricks <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mahtonu.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mahtonu.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mahtonu.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mahtonu.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mahtonu.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mahtonu.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mahtonu.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mahtonu.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mahtonu.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mahtonu.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=51&subd=mahtonu&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mahtonu.wordpress.com/2009/09/25/cache-php-output-for-high-traffic-websites-pear-cache_lite/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cf4a6d8ec447367265a7163117daa911?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Tonu</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Injection: Detailed concept with examples</title>
		<link>http://mahtonu.wordpress.com/2009/04/02/sql-injection-detailed-concept-with-examples/</link>
		<comments>http://mahtonu.wordpress.com/2009/04/02/sql-injection-detailed-concept-with-examples/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 11:28:14 +0000</pubDate>
		<dc:creator>M A Hossain Tonu</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Security]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Database Security]]></category>
		<category><![CDATA[PHP security]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Quota safe]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Injection]]></category>

		<guid isPermaLink="false">http://mahtonu.wordpress.com/?p=33</guid>
		<description><![CDATA[Some days ago one of my junior who is a newbie programmer asked me for an interesting thing when I went their dorm. He said that he want to learn SQL Injection. Unfortunately or fortunately SQL injection is not for learning but we need to learn how to prevent SQL Injection as it is a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=33&subd=mahtonu&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Some days ago one of my junior who is a newbie programmer asked me for an interesting thing when I went their dorm. He said that he want to learn SQL Injection. Unfortunately or fortunately SQL injection is not for learning but <strong>we need to learn how to prevent SQL Injection</strong> as it is a PHP security topic.</p>
<p class="MsoNormal">
<p class="MsoNormal">&#8220;<strong>SQL Injection</strong>&#8221; is subset of the “<strong>an unverified/unsanitized</strong>” user input vulnerability, and the idea is to convince the application to run SQL code that was not intended. If the application is creating SQL strings naively on the fly and then running them, it&#8217;s straightforward to create some real surprises.</p>
<p class="MsoNormal">
<p class="MsoNormal">There have been other papers on SQL injection, including some that are much more detailed, but this one shows the rationale of <strong>discovery</strong> as much as the process of <strong>exploitation</strong>.</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Case Study:</strong></p>
<p class="MsoNormal">
<p class="MsoNormal">The <strong>login page</strong> had a traditional username-and-password form, but also an email-me-mypassword link; the latter proved to be the downfall of the whole system.</p>
<p class="MsoNormal">
<p class="MsoNormal">When entering an email address, the system presumably looked in the user database for that email address, and mailed something to that address. Since my email address is not found, it wasn&#8217;t going to send me anything.</p>
<p class="MsoNormal">
<p class="MsoNormal">So the first test in any SQL-ish form is to enter a single quote as part of the data: the intention is to see if they construct an SQL string literally without sanitizing. When submitting the form with a quote in the email address, we get a 500 error (server failure), and this suggests that the &#8220;broken&#8221; input is actually being parsed literally. Bingo.</p>
<p class="MsoNormal">
<p class="MsoNormal">We speculate that the underlying SQL code looks something like this:</p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">table</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">field </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">= &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">$EMAIL </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;;</span></p>
<p class="MsoNormal">
<p class="MsoNormal">Here, <span style="color:red;">$EMAIL </span>is the address submitted on the form by the user, and the larger query provides the quotation marks that set it off as a literal string. We don&#8217;t know the specific names of the fields or table involved, but we do know their nature, and we&#8217;ll make some good guesses later.</p>
<p class="MsoNormal">
<p class="MsoNormal">When we enter <span style="color:red;">bob@example.com&#8217;</span> &#8211; note the closing quote mark &#8211; this yields constructed SQL:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">table</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">field </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">= &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">bob@example.com&#8217; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;;</span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;color:black;"> </span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;">When this is executed, the SQL parser find the extra quote mark and aborts with a syntax error. How this manifests itself to the user depends on the application&#8217;s internal error-recovery procedures, but it&#8217;s usually different from &#8220;email address is unknown&#8221;. This error response is a dead giveaway that user input is not being sanitized properly and that the application is ripe for exploitation.</span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;"> </span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;">Since the data we&#8217;re filling in appears to be in the <strong>WHERE</strong> clause, let&#8217;s change the nature of that clause in an SQL legal way and see what happens. By entering </span><span style="color:red;">anything&#8217; OR &#8216;x&#8217;='x </span><span style="color:black;">, the resulting SQL is:</span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;color:black;"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">table</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">field </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">= &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">anything&#8217; OR &#8216;x&#8217;='x </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;;</span></p>
<p class="MsoNormal">
<p class="MsoNormal" style="text-align:justify;">Because the application is not really thinking about the query &#8211; merely constructing a string &#8211; our use of quotes has turned a single-component <strong>WHERE</strong> clause into a two-component one, and the &#8216;x&#8217;='x&#8217; clause is guaranteed to be true no matter what the first clause is (there is a better approach for this &#8220;always true&#8221; part that we&#8217;ll touch on later).</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">But unlike the &#8220;real&#8221; query, which should return only a single item each time, this version will essentially return every item in the members database. The only way to find out what the application will do in this circumstance is to try it. Doing so, we were greeted with:</p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p class="MsoNormal"><em><span style="font-family:TTE15BB218t00;">Your login information has been mailed to </span></em><em><span style="font-family:TTE15C0B40t00;"><a href="mailto:random.person@example.com">random.person@example.com</a></span></em><em><span style="font-family:TTE15BB218t00;">.</span></em></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal" style="text-align:justify;">Our best guess is that it&#8217;s the first record returned by the query, effectively an entry taken at random. This person really did get this forgotten-password link via email, which will probably come as surprise to him and may raise warning flags somewhere.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">We now know that we&#8217;re able to manipulate the query to our own ends, though we still don&#8217;t know much about the parts of it we cannot see. But we have observed three different responses to our various inputs:</p>
<p class="MsoNormal" style="text-align:justify;">
<ul style="margin-top:0;" type="square">
<li class="MsoNormal">&#8220;Your      login information has been mailed to email&#8221;</li>
<li class="MsoNormal">&#8220;We      don&#8217;t recognize your email address&#8221;</li>
<li class="MsoNormal">Server      error</li>
</ul>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">The first two are responses to well-formed SQL, while the latter is for bad SQL: this distinction will be very useful when trying to guess the structure of the query.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;"><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--> <!--[if gte mso 10]&gt;--> <!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:15pt;font-family:TTE15C0008t00;">Brute-force password guessing</span></p>
<p class="MsoNormal" style="text-align:justify;">One can certainly attempt brute-force guessing of passwords at the main login page, but many systems make an effort to detect or even prevent this. There could be logfiles, account lockouts, or other devices that would substantially impede our efforts, but because of the nonsanitized inputs, we have another avenue that is much less likely to be so protected.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">We&#8217;ll instead do actual password testing in our snippet by including the email name and password directly. In our example, we&#8217;ll use our victim, <strong>bob@example.com</strong> and try multiple passwords.</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT email, passwd, login_id, full_name</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM members</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE email = &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">bob@example.com&#8217; AND passwd = &#8216;hello123 </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;;</span></p>
<p class="MsoNormal">
<p class="MsoNormal">This is clearly well-formed SQL, so we don&#8217;t expect to see any server errors, and we&#8217;ll know we found the password when we receive the &#8220;your password has been mailed to you&#8221; message. Our mark has now been tipped off, but we do have his password.</p>
<p class="MsoNormal">
<p class="MsoNormal">This procedure can be automated with scripting in perl, and though we were in the process of creating this script, we ended up going down another road before actually trying it.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:15pt;font-family:TTE15C0008t00;">The database isn&#8217;t readonly</span></p>
<p class="MsoNormal">So far, we have done nothing but query the database, and even though a SELECT is readonly, that doesn&#8217;t mean that SQL is. SQL uses the semicolon for statement termination, and if the input is not sanitized properly, there may be nothing that prevents us from stringing our own unrelated command at the end of the query.</p>
<p class="MsoNormal">
<p class="MsoNormal">The most drastic example is:</p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT email, passwd, login_id, full_name</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM members</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE email = &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">x&#8217;; DROP TABLE members; &#8212; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;; &#8212; Boom! </span><span style="font-size:11pt;font-family:Wingdings;color:black;"> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;"> </span></p>
<p class="MsoNormal" style="text-align:justify;">The first part provides a dummy email address &#8212; &#8216;x&#8217; &#8212; and we don&#8217;t care what this query returns: we&#8217;re just getting it out of the way so we can introduce an unrelated SQL command. This one attempts to drop (delete) the entire members table, which really doesn&#8217;t seem too sporting.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">This shows that not only can we run separate SQL commands, but we can also modify the database. This is promising.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal"><span style="font-family:TTE15B7560t00;color:black;"> </span></p>
<p class="MsoNormal"><span style="font-size:15pt;font-family:TTE15C0008t00;">Mail me a password</span></p>
<p class="MsoNormal" style="text-align:justify;">We then realized that though we are not able to add a new record to the members database, we can modify an existing one, and this proved to be the approach that gained us entry.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">From a previous step, we knew that bob@example.com had an account on the system, and we used our SQL injection to update his database record with our email address:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT email, passwd, login_id, full_name</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM members</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE email = &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">x&#8217;;</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">UPDATE members</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">SET email = &#8216;bob@example.com&#8217;</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">WHERE email = &#8216;bob@example.com </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;;</span></p>
<p class="MsoNormal">
<p class="MsoNormal" style="text-align:justify;">After running this, we of course received the &#8220;we didn&#8217;t know your email address&#8221;, but this was expected due to the dummy email address provided. The UPDATE wouldn&#8217;t have registered with the application, so it executed quietly.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">We then used the regular &#8220;I lost my password&#8221; link &#8211; with the updated email address &#8211; and a minute later received this email:</p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">From: system@example.com</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">To: bob@example.com</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">Subject: Intranet login</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">This email is in response to your request for your Intranet log in information.</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">Your User ID is: bob</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">Your password is: hello</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p class="MsoNormal"><span style="font-family:TTE15BB218t00;"> </span></p>
<p class="MsoNormal" style="text-align:justify;">Now it was now just a matter of following the standard login process to access the system.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal"><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--> <!--[if gte mso 10]&gt;--> <!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:15pt;font-family:TTE15C0008t00;">Mitigations (How to Prevent?</span><span style="font-size:15pt;font-family:Wingdings;"> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </span><span style="font-size:15pt;font-family:TTE15C0008t00;">)</span></p>
<p class="MsoNormal" style="text-align:justify;">We believe that web application developers often simply do not think about &#8220;surprise inputs&#8221;, but security people do (including the bad guys), so there are three broad approaches that can be applied here.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal"><strong><span style="font-family:TTE15C0008t00;">Sanitize the input</span></strong></p>
<p class="MsoNormal" style="text-align:justify;">It&#8217;s absolutely vital to sanitize user inputs to insure that they do not contain dangerous codes, whether to the SQL server or to HTML itself. One&#8217;s first idea is to strip out &#8220;bad stuff&#8221;, such as quotes or semicolons or escapes, but this is a misguided attempt. Though it&#8217;s easy to point out some dangerous characters, it&#8217;s harder to point to all of them. The language of the web is full of special characters and strange markup (including alternate ways of representing the same characters), and efforts to authoritatively identify all &#8220;bad stuff&#8221; are unlikely to be successful. Instead, rather than &#8220;remove known bad data&#8221;, it&#8217;s better to &#8220;remove everything but known good data&#8221;: this distinction is crucial. Since &#8211; in our example &#8211; an email address can contain only these characters:</p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">abcdefghijklmnopqrstuvwxyz</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">0123456789</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;">@.-_+</span></p>
<p class="MsoNormal">
<p class="MsoNormal" style="text-align:justify;">It&#8217;s important to note here that email addresses in particular are troublesome to validate programmatically, because everybody seems to have his own idea about what makes one &#8220;valid&#8221;, and it&#8217;s a shame to exclude a good email address because it contains a character you didn&#8217;t think about.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Be aware that &#8220;sanitizing the input&#8221; doesn&#8217;t mean merely &#8220;remove the quotes&#8221;, because even &#8220;regular&#8221; characters can be troublesome. In an example where an integer ID value is being compared against the user input (say, a numeric PIN):</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">table</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE id = </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">23 OR 1=1 </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">; &#8212; Boom! Always matches!</span></p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal"><strong><span style="font-family:TTE15C0008t00;">Escape/Quotesafe the input</span></strong></p>
<p class="MsoNormal" style="text-align:justify;">Even if one might be able to sanitize a phone number or email address, one cannot take this approach with a &#8220;name&#8221; field lest one wishes to exclude the likes of Bill O&#8217;Reilly from one&#8217;s application: a quote is simply a valid character for this field.</p>
<p class="MsoNormal" style="text-align:justify;">One includes an actual single quote in an SQL string by putting two of them together, so this suggests the obvious &#8211; but wrong! &#8211; technique of preprocessing every string to replicate the single quotes:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM customers</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE name = &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">Bill O&#8221;Reilly </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;; &#8212; works OK</span></p>
<p class="MsoNormal">
<p class="MsoNormal" style="text-align:justify;">However, this naive approach can be beaten because most databases support other string escape mechanisms. MySQL, for instance, also permits &#8216; to escape a quote, so after input of &#8216;; DROP TABLE users; &#8212; is &#8220;protected&#8221; by doubling the quotes, we get:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">SELECT </span><span style="font-size:11.5pt;font-family:TTE15B7560t00;color:black;">fieldlist</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">FROM customers</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">WHERE name = &#8216; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:red;">&#8221;; DROP TABLE users; &#8212; </span><span style="font-size:11pt;font-family:TTE15B7560t00;color:black;">&#8216;; &#8212; Boom!</span></p>
<p class="MsoNormal">
<p class="MsoNormal" style="text-align:justify;">The expression &#8221;&#8217; is a complete string (containing just one single quote), and the usual SQL trouble follow. It doesn&#8217;t stop with backslashes either: there is Unicode, other encodings, and parsing oddities all hiding in the weeds to trip up the application designer.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Getting quotes right is notoriously difficult, which is why many database interface languages provide a function that does it for you. When the same internal code is used for &#8220;string quoting&#8221; and &#8220;string parsing&#8221;, it&#8217;s much more likely that the process will be done properly and safely.</p>
<p class="MsoNormal" style="text-align:justify;">
<p class="MsoNormal" style="text-align:justify;">Some examples are the MySQL function <strong>mysql_real_escape_string()</strong> and perl DBD method <strong>$dbh-&gt;quote($value).</strong></p>
<p class="MsoNormal" style="text-align:justify;"><strong><br />
</strong></p>
<p class="MsoNormal" style="text-align:justify;"><strong>These methods must be used.</strong></p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal">All I want to say is “ESCAPE ESCAPE ESCAPE” your values before putting into your query.</p>
<p class="MsoNormal">
<p class="MsoNormal">Cheers! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p class="MsoNormal">
<p class="MsoNormal"><a name="pd_a_1539540"></a><div class="PDS_Poll" id="PDI_container1539540" style="display:inline-block;"></div><script type="text/javascript" language="javascript" charset="utf-8" src="http://static.polldaddy.com/p/1539540.js"></script>
		<noscript>
		<a href="http://answers.polldaddy.com/poll/1539540/">View This Poll</a><br/><span style="font-size:10px;"><a href="http://www.polldaddy.com">survey</a></span>
		</noscript></p>
Posted in MySql, PHP, tech, Web Security Tagged: Database Security, MySql, PHP security, Query, Quota safe, Security, SQL, SQL Injection <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mahtonu.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mahtonu.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mahtonu.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mahtonu.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mahtonu.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mahtonu.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mahtonu.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mahtonu.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mahtonu.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mahtonu.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=33&subd=mahtonu&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mahtonu.wordpress.com/2009/04/02/sql-injection-detailed-concept-with-examples/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cf4a6d8ec447367265a7163117daa911?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Tonu</media:title>
		</media:content>
	</item>
		<item>
		<title>Tricky concepts in PHP</title>
		<link>http://mahtonu.wordpress.com/2008/11/18/tricky-concepts-in-php/</link>
		<comments>http://mahtonu.wordpress.com/2008/11/18/tricky-concepts-in-php/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:49:00 +0000</pubDate>
		<dc:creator>M A Hossain Tonu</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://mahtonu.wordpress.com/?p=11</guid>
		<description><![CDATA[Include Vs Require

include() and require() are  slightly different. Basically, include  is conditional and require is not.

This would include &#8217;somefile&#8217;  if $something is true:

if($something){
 include(&#8220;somefile&#8221;);
}

This would include &#8217;somefile&#8217;  unconditionally

if($something){
 require(&#8220;somefile&#8221;);
}

This would have VERY strange  effects if somefile looked like:

} echo &#8220;Ha! I&#8217;m here regardless of something:  $something&#60;br&#62;n&#8221;;
if (false) {

Another interesting [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=11&subd=mahtonu&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h4 style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="color:#000000;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="text-decoration:underline;">Include Vs Require</span></span></span></span></h4>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">include() and require() are  slightly different.<span> </span>Basically, include  is conditional and require is not.</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">This would include &#8217;somefile&#8217;  if $something is true:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">if($something){</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span>include(&#8220;somefile&#8221;);</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">}</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">This would include &#8217;somefile&#8217;  unconditionally</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">if($something){</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span>require(&#8220;somefile&#8221;);</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">}</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">This would have VERY strange  effects if somefile looked like:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">} echo &#8220;Ha!<span> </span>I&#8217;m here regardless of something:  $something&lt;br&gt;n&#8221;;</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">if (false) {</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">Another interesting example is  to consider what will happen if you use include() or require() inside a  loop.</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">$i = 1;</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">while ($i &lt; 3)  {</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span>require(somefile.$i);</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span>$i ;</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">}</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">Using require() as above will  cause the same file to be used every single iteration.<span> </span>Clearly this is not the intention since the  file name should be changing in each iteration of the loop.<span> </span>We need to use include() as below.<span> </span>Include() will be evaluated at each iteration  of the loop including somefile.0, somefile.1, etc as expected.</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">$i = 1;</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">while ($i &lt; 3)  {</span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span>include(somefile.$i);</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color:#990000;"><span> </span><span> </span>$i  ;</span></span></span></p>
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">}</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">The only interesting question  that remains is what file will be required above.<span> </span>It turns out that PHP uses the value of $i  when it reads the require() statement for the first time.<span> </span>So, the require() loop above will include  something.1 two times.<span> </span>The include()  loop includes something.1 and something.2.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;"><br />
</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;">
<h4 style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="text-decoration:underline;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">Echo Vs  Print</span></span></span></h4>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">There is a difference between  the two, but speed-wise it should be irrelevant which one you use.<span> </span>print() behaves like a function in that you  can do:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">$ret = print &#8220;Hello  World&#8221;;</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">and $ret will be  1.</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">That means that print can be  used as part of a more complex expression where echo cannot.<span> </span>print is also part of the precedence table  which it needs to be if it is to be used within a complex expression.<span> </span>It is just about at the bottom of the  precedence list though.<span> </span>Only &#8220;,&#8221; AND, OR  and XOR are lower.</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">echo is marginally faster  since it doesn&#8217;t set a return value if you really want to get down to the nitty  gritty.</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">If the grammar  is:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">echo expression [,  expression[, expression] &#8230; ]</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">Then</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">echo ( expression, expression  ) </span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">is not valid.<span> </span>( expression ) reduces to just an expression  so this would be valid:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">echo  (&#8220;howdy&#8221;),(&#8220;partner&#8221;);</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">but you would simply write  this as:</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="preformatted" style="margin:0 0 0 .5in;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#990000;">echo  &#8220;howdy&#8221;,&#8221;partner&#8221;;</span></span></p>
<p class="preformatted" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;">if you wanted to use two  expressions.<span> </span>Putting the brackets in  there serves no purpose since there is no operator precedence issue with a  single expression like that.</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Arial;"><span style="font-family:Arial,Helvetica,sans-serif;color:#000000;"><a name="pd_a_1539540"></a><div class="PDS_Poll" id="PDI_container1539540" style="display:inline-block;"></div><script type="text/javascript" language="javascript" charset="utf-8" src="http://static.polldaddy.com/p/1539540.js"></script>
		<noscript>
		<a href="http://answers.polldaddy.com/poll/1539540/">View This Poll</a><br/><span style="font-size:10px;"><a href="http://www.polldaddy.com">survey</a></span>
		</noscript><br />
</span></span></p>
Posted in PHP, tech Tagged: PHP, Tips, Tricks <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mahtonu.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mahtonu.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mahtonu.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mahtonu.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mahtonu.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mahtonu.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mahtonu.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mahtonu.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mahtonu.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mahtonu.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=11&subd=mahtonu&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mahtonu.wordpress.com/2008/11/18/tricky-concepts-in-php/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cf4a6d8ec447367265a7163117daa911?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Tonu</media:title>
		</media:content>
	</item>
		<item>
		<title>অফুরান সম্ভাবনার নাম &#8216;মোরেঞ্জ&#8217;</title>
		<link>http://mahtonu.wordpress.com/2008/06/09/%e0%a6%85%e0%a6%ab%e0%a7%81%e0%a6%b0%e0%a6%be%e0%a6%a8-%e0%a6%b8%e0%a6%ae%e0%a7%8d%e0%a6%ad%e0%a6%be%e0%a6%ac%e0%a6%a8%e0%a6%be%e0%a6%b0-%e0%a6%a8%e0%a6%be%e0%a6%ae-%e0%a6%ae%e0%a7%8b%e0%a6%b0/</link>
		<comments>http://mahtonu.wordpress.com/2008/06/09/%e0%a6%85%e0%a6%ab%e0%a7%81%e0%a6%b0%e0%a6%be%e0%a6%a8-%e0%a6%b8%e0%a6%ae%e0%a7%8d%e0%a6%ad%e0%a6%be%e0%a6%ac%e0%a6%a8%e0%a6%be%e0%a6%b0-%e0%a6%a8%e0%a6%be%e0%a6%ae-%e0%a6%ae%e0%a7%8b%e0%a6%b0/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 20:36:46 +0000</pubDate>
		<dc:creator>M A Hossain Tonu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[bangla]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[morange]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[pim]]></category>
		<category><![CDATA[push mail]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://mahtonu.wordpress.com/?p=4</guid>
		<description><![CDATA[অফিস আর বাসার মধ্যে ছোটাছুটি করতে করতে হাঁপিয়ে উঠেছিলো আসিফ রহমান। অনেক চেষ্টায় ছুটি মিলল ৩ দিনের। দীর্ঘ দিনের পরিকল্পনা অবশেষে বাস্তব হতে যাচ্ছে। ৫ বন্ধু মিলে দে ছুট কক্সবাজারের পথে।
যখন ওদের বাহন কক্সবাজার ছুঁই ছুঁই করছে তখনই বেজে উঠল মোবাইল। মোবাইলের পর্দায় &#8216;বস&#8217; লেখা দেখেই আঁতকে উঠল আসিফ। একরাশ আশঙ্কা মনে, তবু বুকে সাহস [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=4&subd=mahtonu&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>অফিস আর বাসার মধ্যে ছোটাছুটি করতে করতে হাঁপিয়ে উঠেছিলো আসিফ রহমান। অনেক চেষ্টায় ছুটি মিলল ৩ দিনের। দীর্ঘ দিনের পরিকল্পনা অবশেষে বাস্তব হতে যাচ্ছে। ৫ বন্ধু মিলে দে ছুট কক্সবাজারের পথে।</p>
<p>যখন ওদের বাহন কক্সবাজার ছুঁই ছুঁই করছে তখনই বেজে উঠল মোবাইল। মোবাইলের পর্দায় &#8216;বস&#8217; লেখা দেখেই আঁতকে উঠল আসিফ। একরাশ আশঙ্কা মনে, তবু বুকে সাহস নিয়ে মোবাইলে সবুজ বাটন চাপা মাত্র ওপার থেকে ভেসে এলো, &#8220;বায়ারকে যে আজকেই একটা কোটেশান দিতে হয়। এক্ষণই একটু অফিসে এসে সেগুলো পাঠিয়ে যাও প্লিজ।&#8221;</p>
<p>এরকম পরিস্থিতিতে অনেকের মাথায় বাজ ভেঙ্গে পড়লেও হাফ ছেড়ে বাঁচল আসিফ। বসকে বলল, &#8220;দুই মিনিটের মধ্যেই পাঠিয়ে দিচ্ছি।&#8221; বস কিছু না বুঝেই ফোনটি রেখে দিলেন। বসের ফোন রেখেই আসিফ মোবাইলের মাধ্যমেই প্রবেশ করল অফিসের কম্পিউটারে। নিজের ফোল্ডার থেকে কোটেশনটি ইমেইল করে পাঠিয়ে দিলেন সেই বায়ারের কাছে। এর পর হৈ হৈ করতে করতে সোজা কক্সবাজার।</p>
<p>এতটুকু এসে অনেকে &#8216;সায়েন্স ফিকশন&#8217; পড়ছেন ভাবলেও আসলে এই ঘটনার পুরোটাই বাস্তব। এই বাস্তবতার নাম &#8216;মোরেঞ্জ&#8217; (Morange)|</p>
<p>শব্দটি নতুন। এর সুবিধাগুলো আরও নতুন। কাজ করবে মোবাইল ফোনে আর কম্পিউটারে। বলা যায়, একটি মোরেঞ্জ এর সুবিধাযুক্ত মোবাইল সেট আপনার হাতে থাকা মানে আপনি বিশ্বের সবচেয়ে আধুনিক এবং সুবিধাভোগী মানুষ। মোরেঞ্জকে আইফোনের চেয়েও বেশি সুবিধাযুক্ত বলে মনে করা হচ্ছে।</p>
<p><strong>কী এই মোরেঞ্জ?</strong><br />
মোরেঞ্জ হচ্ছে মোবাইলের একটি বিশেষ অ্যাপ্লিকেশন সফটঅয়্যার যা অধিকাংশ জাভা সমর্থিত সেটে কাজ করে। এই সুবিধা পেতে বিশেষ কোন ডিভাইস স্থাপনের প্রয়োজন নেই। ইন্টারনেট থেকে ডাউনলোড করে সফটঅয়্যারটি মোবাইল ফোন ও কম্পিউটারে ইনস্টল করতে হবে।</p>
<p>মোরেঞ্জ সেবাদানকারী প্রতিষ্ঠানের দেওয়া ইউজার নেইম ও গোপন নম্বর ব্যবহার করে এবং মোবাইল নেটওয়ার্কের আওতায় থেকেই মোরেঞ্জের যাবতীয় সুবিধা পাওয়া সম্ভব।</p>
<p>এতে জুড়ে দেওয়া আধুনিক যোগাযোগ পদ্ধতি ও সুবিধাগুলো অবাক করার মতো। এর মধ্যে রয়েছে ইমেইল, নিজের কম্পিউটারে সংযুক্ত হওয়ার জন্য রিমোট ডেস্কটপ, দূরে বসেই ক্যামেরা নিয়ন্ত্রণ, ব্লগিং, ফ্রেন্ড সার্চিংসহ আধুনিক সব সুবিধা।</p>
<p><strong>রিমোট ডেস্কটপ</strong><br />
এটি মোরেঞ্জ ব্যবহার করে পাওয়া জরুরী এবং মজার একটি সুবিধা। মোরেঞ্জের রিমোট ডেক্সটপ সুবিধা ব্যবহার করে মোবাইল ফোন দিয়েই নিয়ন্ত্রণ করতে পারবেন বাসা কিংবা অফিসের ব্যাক্তিগত কম্পিউটারটি। যে কোন জায়গায় অবস্থান করে মোবাইল ফোনের মাধ্যমেই কম্পিউটারে ফাইল আদান প্রদান, ইমেইল চালাচালি, অ্যাড্রেসবুক, ছবি শেয়ারিংসহ আরও অনেক সুবিধা পাওয়া সম্ভব মোরেঞ্জ ব্যবহার করে।</p>
<p><strong>পুশ মেইল</strong><br />
মোরেঞ্জ সুবিধা যুক্ত থাকলে কম্পিউটারে আউটলুক কিংবা ইউডোরায় যেভাবে ইমেইল পাওয়া যায় ঠিক তেমনভাবেই ইমেইলগুলো সময়মতো এসে হাজির হবে আপনার মোবাইলে। এটি &#8216;পপ-থ্রি&#8217; সেবাও সমর্থন করে। সর্বোচ্চ ৫ মেগাবাইট আকারের অ্যাটাচমেন্ট ফাইলও পাঠানো যাবে ইমেইলে। পার্সোনাল মেইল সার্ভারের সঙ্গে যুক্ত হতে সক্ষম এটি। মজার ব্যাপার হচ্ছে, এ সব সুবিধা পেতে মোবাইল পরিসেবা প্রতিষ্ঠানকে প্রদান করতে হবে না অতিরিক্ত কোন অর্থও।</p>
<p><strong>দূরে বসেই ঘরের খবর</strong><br />
মোরেঞ্জ আইপি ক্যামেরা, ওয়াইফাই ক্যামেরা এবং ওয়েব ক্যামেরা সমর্থন করে। ইন্টারনেটে সংযুক্ত থেকে আর মোরেঞ্জের সেবা নিয়ে দেশে কিংবা দেশের বাইরে বসেই দেখতে পাবেন ঘরে বা প্রতিষ্ঠানে স্থাপিত ক্যামেরার সামনে ঘটে যাওয়া সব কিছু।</p>
<p><strong>পুশ আরএসএস<br />
</strong>পুশ আরএসএস সুবিধা এর ব্যবহারবিধিকে আরও সহজ করে দিয়েছে। এই সুবিধায় স্বয়ংক্রিয়ভাবেই মোবাইলে পৌছে যাবে সর্বশেষ সংবাদ, স্টক এক্সচেঞ্জের খবরাখবর। পাবেন বিনোদন, পছন্দের ওয়েবসাইট, ইত্যাদি সব কিছু। মোরেঞ্জের পুশ আরএসএস সুবিধা প্রচলিত সব ধরনের আরএসএস সংস্করণ এবং প্রটোকলকে সমর্থন করে।</p>
<p><strong>পিআইএম সিনক্রোনাইজেশন<br />
</strong>হঠাৎ করেই একটি ঠিকানা জরুরী হয়ে পড়লো। কিন্তু সেটা আছে আপনার কম্পিউটারে। যেখানেই থাকুন না কেন মোরেঞ্জ সুবিধা কম্পিউটারের অ্যাড্রেস বুক, ক্যালেন্ডার, আউটলুক এক্সপ্রেসে থাকা প্রভৃতি তথ্য স্বয়ংক্রিয়ভাবে মোবাইলে নিয়ে আসবে। অর্থ্যাৎ মোরেঞ্জ সুবিধা সম্বলিত মোবাইল আপনার হাতে থাকা মানে আপনার ব্যাক্তিগত কম্পিউটারই আপনার হাতে থাকা।</p>
<p><strong>মোরেঞ্জ কীভাবে কাজ করে</strong><br />
ব্যবহারকারীদের মধ্যস&#8217;তাকারী হিসেবে মূলত মোরেঞ্জ কাজ করে, যা তৃতীয় পক্ষ বা থার্ড পার্টি সেবা হিসেবে পরিচিত। এতে ব্যবহার করা হয় মোরেঞ্জ এন্টারপ্রাইজ (Morange Enterprise) নামের একটি বিশেষ সার্ভার যা ইন্টারনেটের সঙ্গে সরাসরি সংযুক্ত। মোবাইল ফোন মোরেঞ্জ সার্ভারের সঙ্গে যুক্ত হয় জিপিআরএস কিংবা এজ ইন্টারনেট সংযোগের মাধ্যমে। যখন একটি মোবাইল ফোন থেকে ব্যবহারকারীর নাম ও গোপন নম্বর দিয়ে লগইন করা হয় তখন তা সরাসরি যুক্ত হয় মোরেঞ্জ সার্ভারে। একইভাবে কোন কম্পিউটার থেকেও যখন লগইন করা হয় তখনও তা সরাসরি যুক্ত হয় ওই একই সার্ভারের সঙ্গে। যেমনটি বিভিন্ন চ্যাটিং সার্ভারের ক্ষেত্রে ঘটে থাকে। এভাবে মোরেঞ্জ সার্ভারের মাধ্যমে কম্পিউটার ও মোবাইল সংযুক্ত হয়।</p>
<p>মোরেঞ্জ সার্ভার জিপিআরএস, এজ, থ্রিজি, ওয়াইফাই, সিডিএমএ, ওয়্যারলেস ইত্যাদি সংযোগ সমর্থন করে।</p>
<p><strong>মোরেঞ্জ সমর্থিত মোবাইল সেট</strong><br />
জাভা (Java- J2ME MIDP2.0) সমর্থক এবং ইন্টারনেট সংযোগ সুবিধাযুক্ত সেটগুলোর মাধ্যমেই মোরেঞ্জ সুবিধা পাওয়া যাবে। নিচে মোরেঞ্জ সুবিধা নেওয়া সম্ভব এমন কয়েকটি পরীক্ষিত মোবাইল সেটের মডেল উল্লেখ করা হলো।</p>
<p><em><strong>Nokia</strong></em></p>
<p>Nokia 3250, Nokia N70</p>
<p><strong><em>Sony Ericssion</em></strong></p>
<p>Sony Ericssion M600i, Sony Ericssion P900i, Sony Ericssion P990i, Sony Ericssion W800i,</p>
<p><strong><em>Motorolla</em></strong></p>
<p>Motorolla V3X, Motorolla E680i, Motorolla a1200, Motorolla A1000</p>
<p><strong><em>Smart Phone</em></strong></p>
<p>Dopod 838, Dpod 900, O2 Atom, O2 Mini</p>
<p><strong>কোথায় পাবেন মোরেঞ্জ</strong><br />
এবার দ্বিতীয় ধাপ। মোরেঞ্জ সুবিধার জন্য প্রথমেই রেজিস্ট্রেশন করতে হবে। রেজিস্ট্রেশনের জন্য প্রবেশ করতে হবে morange.bdnews24.com সাইটে। এখানে রেজিস্ট্রেশন করে পাওয়া যাবে ব্যবহারকারীর নাম (ইউজার নেম) ও গোপন নম্বর (পাসওয়ার্ড)। রেজিস্ট্রেশন করার পর মোরেঞ্জের দুইটি সফটঅয়্যার ডাউনলোড করতে হবে। একটি মোবাইলের জন্য এবং অন্যটি কম্পিউটারের জন্য। সফটওয়্যার দুটি ডাউনলোড করে মোবাইলে এবং কম্পিউটারে ইনস্টল করে নিতে হবে।</p>
<p><strong>কীভাবে ব্যবহার করবেন</strong><br />
মোবাইলে এটি ইনস্টল করার পর &#8216;Morange&#8217; নামে আলাদা একটি আইকন তৈরি হবে। এই আইকনটিতে ক্লিক করুন। এরই মধ্যে যদি রেজিস্টেশন করে থাকেন তবে &#8216;Log in&#8217; অপশনে যেয়ে ইউজার নেম ও পাসওয়ার্ড দিন। &#8216;মোরেঞ্জ নেটওয়ার্কে সংযুক্ত হয়ে তথ্য আদানপ্রদান করতে চাচ্ছে, অনুমতি দেবেন কি না?&#8217; এ ধরনের একটি বার্তা আসবে। Yes নির্বাচন করুন। তারপর মোবাইলটিকে ইন্টারনেটে সংযুক্ত করার অপশন আসবে। এবার ইন্টারনেটে সংযুক্ত হোন। এভাবে মোরেঞ্জের সঙ্গে যুক্ত হলেই পাওয়া যাবে মোরেঞ্জের সব সুবিধা।</p>
<p>ব্যক্তিগত কম্পিউটারটিকে মোরেঞ্জ সুবিধায় মোবাইলের মাধ্যমে নিয়ন্ত্রণ করতে চাইলে কম্পিউটারেও মোরেঞ্জ সফটওয়্যারটি ইনস্টল করতে হবে এবং কম্পিউটারটিকেও রেজিস্ট্রি করা ইউজার নেম ও পাসওয়ার্ড দিয়ে লগ ইন অবস্থায় রাখতে হবে। এছাড়াও &#8216;ফাইলস ফাংশন&#8217; মেন্যু থেকে Allow Remote File Access অপশনটি অন করে দিতে হবে।</p>
<p><strong>যাদের মোবাইল ফোন নেই</strong><br />
যাদের মোরেঞ্জ যুক্ত মোবাইল ফোন নেই তারা কম্পিউটারের মাধ্যমেও এর অনেক সুবিধা ভোগ করতে পারবেন। কম্পিউটারের জন্য ডাউনলোড করা সফটওয়্যারটি ইনস্টল করলেই হবে। সফটওয়্যারটি ইনস্টল করার পর মেসেঞ্জারের মতো একটি অ্যাপ্লিকেশন আসবে যেখানে ইউজার নেম ও পাসওয়ার্ড বসিয়ে প্রথমে লগ ইন করতে হবে । লগ ইন অবস&#8217;ায় মোরেঞ্জ উইন্ডোতে প্রবেশ করলে একটি কন্ট্রোল প্যানেল উইজার্ড আসবে। এখান থেকেও নিয়ন্ত্রণ করা যাবে ইমেইল অ্যাকাউন্ট, চ্যাট অ্যাকাউন্ট, আরএসএস, ফ্রেন্ডলিস্ট ইত্যাদি।</p>
<p>কম্পিউটারে ইনস্টল করা মোরেঞ্জ থেকে ফোন করার সুবিধাও পাওয়া যাবে। মোরেঞ্জে দেয়া আছে একটি ফোন ডায়ালিং অপশন যার মাধ্যমে কম্পিউটার থেকেই মোবাইল ও ল্যান্ড ফোনে কল করা যাবে। ট্রায়াল ভার্সনে একবার ফ্রি কল করারও সুযোগ আছে।</p>
<p><strong>চ্যাটিং</strong><br />
চ্যাটিং এর জন্য মোরেঞ্জ যে কোন ইমেইল একাউন্ট সমর্থন করে। অর্থ্যাৎ এমএসএন, ইয়াহু মেসেঞ্জার, গুগলটক, আইসিকিউ, এওএলসহ সব ধরনের চ্যাটিং সুবিধাই পাওয়া যাবে এক মোরেঞ্জের মাধ্যমেই।</p>
<p><strong>বন্ধুত্বের সেতুবন্ধন</strong><br />
ইতিমধ্যে ফেস বুকের মতো সাইটগুলো ব্যাপক জনপ্রিয়তা পেয়েছে কেবল কমিউনিটি সুবিধার জন্য। এভাবে মোরেঞ্জ নেটওয়ার্কে যুক্ত থাকা দেশ-বিদেশে বিভিন্ন মোরেঞ্জ ইউজারদের মধ্যেও একটি কমিউনিটি গড়ে তোলার সুযোগ রয়েছে। আর এজন্য কম্পিউটারের সামনে বসার কোন প্রয়োজন নেই। মোরেঞ্জ সুবিধা সংবলিত মোবাইল সেট নিয়েই পাওয়া যাবে এই সুবিধা। ছবিসহ নিজের প্রোফাইল তৈরি করে রাখলে অন্যরাও আপনাকে খুঁজে পাবেন।</p>
<p><strong>নিউজ এবং ব্লগ</strong><br />
বিডিনিউজটুয়েন্টিফোরডটকম, সিএনএনসহ বিভিন্ন সংবাদমাধ্যমের খবর তাৎক্ষণিকভাবে পড়ার সুযোগ পাবেন এই মোরেঞ্জ সুবিধার মাধ্যমে। শুধু তাই নয় এখানে ব্লগিং করার সুবিধাও রয়েছে।</p>
<p><strong>ভার্চুয়াল স্টোরেজ</strong><br />
মোরেঞ্জের প্রত্যেক ব্যবহারকারী পাবেন ১০০ (ট্রায়াল ভার্সনে ৫০ মেগাবাইট) মেগাবাইট করে অনলাইন স্টোরেজ। এই স্টোরেজের মাধ্যমে ফটো, বিভিন্ন ফাইলপত্র শেয়ার করা যাবে।</p>
<p><strong>বিনোদন<br />
</strong>মোরেঞ্জ সুবিধা সংবলিত মোবাইল সেটটি দিয়ে একটি আইপডের চেয়েও বেশি সুবিধা ভোগ করার সুযোগ রয়েছে। বিভিন্ন পডকাস্ট চ্যানেলের সঙ্গে যুক্ত হয়ে রেডিওর মতো দেশি বিদেশি বিভিন্ন অনুষ্ঠান শোনার সুযোগ করে দেবে এটি।</p>
<p><strong>খরচ কেমন, কোথায় কিনবেন?<br />
</strong>বাংলাদেশে মোরেঞ্জের একমাত্র পরিবেশক বিডিনিউজটুয়েন্টিফোরডটকম (<a title="www.bdnews24.com" href="http://www.bdnews24.com/">www.bdnews24.com</a>)|। প্রাথমিক অবস&#8217;ায় ১৫ দিনের জন্য বিনামূল্যে এই সুবিধা দিচ্ছে কর্তৃপক্ষ। এই ট্রায়াল ভার্সনে অনেক সুবিধাই পাওয়া যাবে না এবং ১৫ দিন পরেই রেজিস্ট্রেশন বাতিল হয়ে যাবে।</p>
<p>সব ধরনের সুবিধা পাওয়ার জন্য নিতে হবে এর পেইড ভার্সন। পেইড ভার্সনের জন্য প্রতি মাসে দিতে হবে ৫ মার্কিন ডলার করে অথবা এক বছরের জন্য ৫৫ মার্কিন ডলার।</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mahtonu.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mahtonu.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mahtonu.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mahtonu.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mahtonu.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mahtonu.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mahtonu.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mahtonu.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mahtonu.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mahtonu.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mahtonu.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mahtonu.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=4&subd=mahtonu&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mahtonu.wordpress.com/2008/06/09/%e0%a6%85%e0%a6%ab%e0%a7%81%e0%a6%b0%e0%a6%be%e0%a6%a8-%e0%a6%b8%e0%a6%ae%e0%a7%8d%e0%a6%ad%e0%a6%be%e0%a6%ac%e0%a6%a8%e0%a6%be%e0%a6%b0-%e0%a6%a8%e0%a6%be%e0%a6%ae-%e0%a6%ae%e0%a7%8b%e0%a6%b0/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cf4a6d8ec447367265a7163117daa911?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Tonu</media:title>
		</media:content>
	</item>
		<item>
		<title>Europe: Your I.P. Address Is Personal</title>
		<link>http://mahtonu.wordpress.com/2008/06/09/europe-your-ip-address-is-personal/</link>
		<comments>http://mahtonu.wordpress.com/2008/06/09/europe-your-ip-address-is-personal/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 20:27:34 +0000</pubDate>
		<dc:creator>M A Hossain Tonu</dc:creator>
				<category><![CDATA[IP]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[europe]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://mahtonu.wordpress.com/?p=3</guid>
		<description><![CDATA[Europe: Your I.P. Address Is Personal
By Saul Hansell at January 22, 2008, 3:31 pm
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
At a hearing Monday, a top privacy regulator in Europe said something that needs to be said: I.P. addresses need to be treated as personal information.
I.P. or Internet Protocol addresses are sort of like phone numbers. They identify two different computers that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=3&subd=mahtonu&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Europe: Your I.P. Address Is Personal</strong><br />
By Saul Hansell at January 22, 2008, 3:31 pm<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
At a hearing Monday, a top privacy regulator in Europe said something that needs to be said: I.P. addresses need to be treated as personal information.</p>
<p>I.P. or Internet Protocol addresses are sort of like phone numbers. They identify two different computers that are exchanging information over the Internet. The analogy is imperfect because Internet service providers often switch I.P. addresses around for home users. So knowing an I.P. address doesn’t guarantee you know what computer is at that address right now.</p>
<p>Nonetheless, Peter Scharr, Germany’s data protection commissioner, told a hearing of the European Parliament that I.P. addresses should generally be seen as personal information, according to a report by The Associated Press. Under some laws, and much industry practice, information that can identify an individual is often subjected to tougher standards for how it can be recorded, stored and transmitted than information about anonymous users and groups of users.</p>
<p>Mr. Scharr is the head of a group of European privacy regulators who are preparing a report on how Internet search engines, including Google, Yahoo and Microsoft, comply with Europe’s privacy laws, which are generally much tougher than those in the United States. The issue also relates to Google’s proposed acquisition of DoubleClick, which is still being reviewed by European regulators.</p>
<p>Most search engines keep log files that record every search and include the I.P. address of the computer conducting the search. Google recently said it would start to erase some of the digits in the I.P. numbers held in its files after 18 months.<br />
Google and other companies maintain that I.P. addresses are not personally identifiable information. One part of the argument is that I.P. addresses identify a computer, not the person using it. True. But that’s the same as a telephone; just because a call was made from a number doesn’t tell you exactly who was talking. Nonetheless, I suspect that most people believe their phone number is quite personal.<br />
The other part of the argument has to do with dynamic I.P. addresses, the practice by Internet providers of switching the I.P. address of home users. Even there, I.P. addresses are not as anonymous as they would appear. Internet service providers keep records of what I.P. addresses are assigned to which customers at what times. Combine these I.S.P. records with a log file from a Web site, and you have a map to who has done what on the Internet.</p>
<p>These two sets of records are not typically combined, but law-enforcement officials routinely subpoena them to try to track down criminals who used the Internet. And they sometimes are used as evidence in civil cases.<br />
I’m not saying that I.P. addresses shouldn’t be collected. There are lots of good reasons for Web sites to keep track of their users (and lots of bad ones too). And sites track users in other ways, like with cookies and site logons.<br />
But I do think it is simply too glib for Internet companies to claim they don’t record personal information when they do keep I.P. addresses.<br />
Privacy is an ever more elusive commodity these days. And the minimum standard for any company, online or off, is to tell customers in crystal-clear language what information it collects, what it does with the information and what choices users have if they don’t want that information revealed.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Source: The New York Times<br />
Edition:Thursday, January 25, 2007</p>
<p><!-- google_ad_section_end --></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mahtonu.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mahtonu.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mahtonu.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mahtonu.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mahtonu.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mahtonu.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mahtonu.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mahtonu.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mahtonu.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mahtonu.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mahtonu.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mahtonu.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mahtonu.wordpress.com&blog=3937227&post=3&subd=mahtonu&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mahtonu.wordpress.com/2008/06/09/europe-your-ip-address-is-personal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cf4a6d8ec447367265a7163117daa911?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Tonu</media:title>
		</media:content>
	</item>
	</channel>
</rss>