<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Official FireBird Blog</title>
	<atom:link href="http://firebird84vn.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://firebird84vn.wordpress.com</link>
	<description>Now and Forever</description>
	<lastBuildDate>Tue, 10 Jul 2007 05:59:51 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='firebird84vn.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9806f5ba049eb47707b5b13d85d5903d?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Official FireBird Blog</title>
		<link>http://firebird84vn.wordpress.com</link>
	</image>
			<item>
		<title>Intro to cron</title>
		<link>http://firebird84vn.wordpress.com/2007/07/10/intro-to-cron/</link>
		<comments>http://firebird84vn.wordpress.com/2007/07/10/intro-to-cron/#comments</comments>
		<pubDate>Tue, 10 Jul 2007 05:59:51 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/07/10/intro-to-cron/</guid>
		<description><![CDATA[Newbie: Intro to cron
Date: 30-Dec-99
Author: cogNiTioN &#60;cognition@attrition.org&#62;

Cron

This file is an introduction to cron, it covers the basics of what cron does,
and how to use it.

What is cron?

Cron is the name of program that enables unix users to execute commands or
scripts (groups of commands) automatically at a specified time/date. It is
normally used for sys admin commands, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=18&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre><strong>Newbie: Intro to cron
Date: 30-Dec-99
Author: cogNiTioN &lt;<a href="mailto:cognition@attrition.org">cognition@attrition.org</a>&gt;</strong>
<u><strong>
Cron
</strong></u>
This file is an introduction to cron, it covers the basics of what cron does,
and how to use it.
<u><strong>
What is cron?
</strong></u>
Cron is the name of program that enables unix users to execute commands or
scripts (groups of commands) automatically at a specified time/date. It is
normally used for sys admin commands, like <em>makewhatis</em>, which builds a
search database for the <em>man -k</em> command, or for running a backup script,
but can be used for anything. A common use for it today is connecting to
the internet and downloading your email.

This file will look at Vixie Cron, a version of cron authored by Paul Vixie.
<u><strong>
How to start Cron
</strong></u>
Cron is a daemon, which means that it only needs to be started once, and will
lay dormant until it is required. A Web server is a daemon, it stays dormant
until it gets asked for a web page. The cron daemon, or <em>crond</em>, stays dormant
until a time specified in one of the config files, or <em>crontabs</em>.

On most Linux distributions crond is automatically installed and entered into
the start up scripts. To find out if it's running do the following:
<strong>
cog@pingu $ ps aux | grep crond
root       311  0.0  0.7  1284  112 ?        S    Dec24   0:00 crond
cog       8606  4.0  2.6  1148  388 tty2     S    12:47   0:00 grep crond
</strong>
The top line shows that crond is running, the bottom line is the search
we just run.

If it's not running then either you killed it since the last time you rebooted,
or it wasn't started.

To start it, just add the line <em>crond</em> to one of your start up scripts. The
process automatically goes into the back ground, so you don't have to force
it with <em>&amp;</em>. Cron will be started next time you reboot. To run it without
rebooting, just type <em>crond</em> as root:
<strong>
root@pingu # crond
</strong>
With lots of daemons, (e.g. httpd and syslogd) they need to be restarted
after the config files have been changed so that the program has a chance
to reload them. Vixie Cron will automatically reload the files after they
have been edited with the <em>crontab</em> command. Some cron versions reload the
files every minute, and some require restarting, but Vixie Cron just loads
the files if they have changed.
<u><strong>
Using cron
</strong></u>
There are a few different ways to use cron (surprise, surprise). 

In the <em>/etc</em> directory you will probably find some sub directories called
'<em>cron.hourly</em>', '<em>cron.daily</em>', '<em>cron.weekly</em>' and '<em>cron.monthly</em>'. If you place
a script into one of those directories it will be run either hourly, daily,
weekly or monthly, depending on the name of the directory. 

If you want more flexibility than this, you can edit a crontab (the name
for cron's config files). The main config file is normally <em>/etc/crontab</em>.
On a default RedHat install, the crontab will look something like this:
<strong>
root@pingu # cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
</strong>
The first part is almost self explanatory; it sets the variables for cron.

<em>SHELL</em> is the 'shell' cron runs under. If unspecified, it will default to
the entry in the <em>/etc/passwd</em> file.

<em>PATH</em> contains the directories which will be in the search path for cron
e.g if you've got a program 'foo' in the directory /usr/cog/bin, it might
be worth adding /usr/cog/bin to the path, as it will stop you having to use
the full path to 'foo' every time you want to call it.

<em>MAILTO</em> is who gets mailed the output of each command. If a command cron is
running has output (e.g. status reports, or errors), cron will email the output
to whoever is specified in this variable. If no one if specified, then the
output will be mailed to the owner of the process that produced the output.

<em>HOME</em> is the home directory that is used for cron. If unspecified, it will
default to the entry in the <em>/etc/passwd</em> file.

Now for the more complicated second part of a crontab file.
An entry in cron is made up of a series of fields, much like the /etc/passwd
file is, but in the crontab they are separated by a space. There are normally
seven fields in one entry. The fields are:
<strong>
minute hour dom month dow user cmd
</strong>
<em>minute</em>	This controls what minute of the hour the command will run on,
	 and is between '0' and '59'
<em>hour</em>	This controls what hour the command will run on, and is specified in
         the 24 hour clock, values must be between 0 and 23 (0 is midnight)
<em>dom</em>	This is the Day of Month, that you want the command run on, e.g. to
	 run a command on the 19th of each month, the dom would be 19.
<em>month</em>	This is the month a specified command will run on, it may be specified
	 numerically (0-12), or as the name of the month (e.g. May)
<em>dow</em>	This is the Day of Week that you want a command to be run on, it can
	 also be numeric (0-7) or as the name of the day (e.g. sun).
<em>user</em>	This is the user who runs the command.
<em>cmd</em>	This is the command that you want run. This field may contain
	 multiple words or spaces.

If you don't wish to specify a value for a field, just place a <em>*</em> in the
field.

e.g.<strong>
01 * * * * root echo "This command is run at one min past every hour"
17 8 * * * root echo "This command is run daily at 8:17 am"
17 20 * * * root echo "This command is run daily at 8:17 pm"
00 4 * * 0 root echo "This command is run at 4 am every Sunday"
* 4 * * Sun root echo "So is this"
42 4 1 * * root echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * root echo "This command is run hourly on the 19th of July"
</strong>
Notes:

Under dow 0 and 7 are both Sunday.

If both the dom and dow are specified, the command will be executed when
either of the events happen.
e.g.<strong>
* 12 16 * Mon root cmd</strong>
Will run cmd at midday every Monday and every 16th, and will produce the
same result as both of these entries put together would:
<strong>* 12 16 * * root cmd
* 12 * * Mon root cmd</strong>

Vixie Cron also accepts lists in the fields. Lists can be in the form, 1,2,3
(meaning 1 and 2 and 3) or 1-3 (also meaning 1 and 2 and 3).
e.g.
<strong>59 11 * * 1,2,3,4,5 root backup.sh</strong>
Will run backup.sh at 11:59 Monday, Tuesday, Wednesday, Thursday and Friday,
as will:
<strong>59 11 * * 1-5 root backup.sh </strong>

Cron also supports 'step' values.
A value of <em>*/2</em> in the dom field would mean the command runs every two days
and likewise, <em>*/5</em> in the hours field would mean the command runs every
5 hours.
e.g.
<strong>* 12 10-16/2 * * root backup.sh</strong>
is the same as:
<strong>* 12 10,12,14,16 * * root backup.sh</strong>

<strong>*/15 9-17 * * * root connection.test</strong>
Will run connection.test every 15 mins between the hours or 9am and 5pm

Lists can also be combined with each other, or with steps:
<strong>* 12 1-15,17,20-25 * * root cmd</strong>
Will run cmd every midday between the 1st and the 15th as well as the 20th
and 25th (inclusive) and also on the 17th of every month.
<strong>* 12 10-16/2 * * root backup.sh</strong>
is the same as:
<strong>* 12 10,12,14,16 * * root backup.sh</strong>

When using the names of weekdays or months, it isn't case sensitive, but only
the first three letters should be used, e.g. Mon, sun or Mar, jul.

Comments are allowed in crontabs, but they must be preceded with a '#', and
must be on a line by them self.  

<u><strong>
Multiuser cron
</strong></u>
As Unix is a multiuser OS, some of the apps have to be able to support
multiple users, cron is one of these. Each user can have their own crontab
file, which can be created/edited/removed by the command <em>crontab</em>. This
command creates an individual crontab file and although this is a text file,
as the <em>/etc/crontab</em> is, it shouldn't be edited directly. The crontab file is
often stored in <em>/var/spool/cron/crontabs/&lt;user&gt;</em> (Unix/Slackware/*BSD),
<em>/var/spool/cron/&lt;user&gt;</em> (RedHat) or <em>/var/cron/tabs/&lt;user&gt;</em> (SuSE),
but might be kept elsewhere depending on what Un*x flavor you're running.

To edit (or create) your crontab file, use the command <em>crontab -e</em>, and this
will load up the editor specified in the environment variables <em>EDITOR</em> or
<em>VISUAL</em>, to change the editor invoked on Bourne-compliant shells, try:
<strong>cog@pingu $ export EDITOR=vi</strong>
On C shells:
<strong>cog@pingu $ setenv EDITOR vi</strong>
You can of course substitute vi for the text editor of your choice.

Your own personal crontab follows exactly the same format as the main
<em>/etc/crontab</em> file does, except that you need not specify the <em>MAILTO</em>
variable, as this entry defaults to the process owner, so you would be mailed
the output anyway, but if you so wish, this variable can be specified.
You also need not have the user field in the crontab entries. e.g.
<strong>
min hr dom month dow cmd
</strong>
Once you have written your crontab file, and exited the editor, then it will
check the syntax of the file, and give you a chance to fix any errors.

If you want to write your crontab without using the crontab command, you can
write it in a normal text file, using your editor of choice, and then use the
crontab command to replace your current crontab with the file you just wrote.
e.g. if you wrote a crontab called cogs.cron.file, you would use the cmd
<strong>
cog@pingu $ crontab cogs.cron.file
</strong>
to replace your existing crontab with the one in cogs.cron.file.

You can use
<strong>
cog@pingu $ crontab -l
</strong>
to list your current crontab, and
<strong>
cog@pingu $ crontab -r
</strong>
will remove (i.e. delete) your current crontab.

Privileged users can also change other user's crontab with:
<strong>
root@pingu # crontab -u
</strong>
and then following it with either the name of a file to replace the
existing user's crontab, or one of the -e, -l or -r options.

According to the documentation the <em>crontab</em> command can be confused by the
<em>su</em> command, so if you running a <em>su</em>'ed shell, then it is recommended you
use the -u option anyway.
<u><strong>
Controlling Access to cron
</strong></u>
Cron has a built in feature of allowing you to specify who may, and who
may not use it. It does this by the use of <em>/etc/cron.allow</em> and <em>/etc/cron.deny</em>
files. These files work the same way as the allow/deny files for other
daemons do. To stop a user using cron, just put their name in cron.deny, to
allow a user put their name in the cron.allow. If you wanted to prevent all
users from using cron, you could add the line <em>ALL</em> to the cron.deny file:
<strong>
root@pingu # echo ALL &gt;&gt;/etc/cron.deny
</strong>
If you want user <strong>cog</strong> to be able to use cron, you would add the line <strong>cog</strong>
to the cron.allow file:
<strong>
root@pingu # echo cog &gt;&gt;/etc/cron.allow
</strong>
If there is neither a cron.allow nor a cron.deny file, then the use of cron
is unrestricted (i.e. every user can use it).  If you were to put the name of
some users into the cron.allow file, without creating a cron.deny file, it
would have the same effect as creating a cron.deny file with ALL in it.
This means that any subsequent users that require cron access should be
put in to the cron.allow file.
<u><strong>
Output from cron
</strong></u>
As I've said before, the output from cron gets mailed to the owner of the
process, or the person specified in the <em>MAILTO</em> variable, but what if you
don't want that? If you want to mail the output to someone else, you can
just pipe the output to the command <em>mail</em>.
e.g.
<strong>
cmd | mail -s "Subject of mail" user
</strong>
If you wish to mail the output to someone not located on the machine, in the
above example, substitute <em>user</em> for the email address of the person who
wishes to receive the output.

If you have a command that is run often, and you don't want to be emailed
the output every time, you can redirect the output to a log file (or
<em>/dev/null</em>, if you really don't want the output).
e,g
<strong>
cmd &gt;&gt; log.file
</strong>
Notice we're using two <em>&gt;</em> signs so that the output appends the log file and
doesn't clobber previous output.
The above example only redirects the standard output, not the standard error,
if you want all output stored in the log file, this should do the trick:
<strong>
cmd &gt;&gt; logfile 2&gt;&amp;1
</strong>
You can then set up a cron job that mails you the contents of the file at
specified time intervals, using the cmd:
<strong>
mail -s "logfile for cmd" &lt;log.file
</strong> 

Now you should be able to use cron to automate things a bit more.
A future file going into more detail, explaining the differences between
the various different crons and with more worked examples, is planned.

<u><strong>
Additional Reference:
</strong></u>
<strong>Man pages:</strong><em> cron(8) crontab(5) crontab(1)</em>

<strong>Book:</strong><em> _Running Linux_ (O'Reilly ISBN: 1-56592-469-X)</em></pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=18&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/07/10/intro-to-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>HTTP Headers and the PHP header() Function</title>
		<link>http://firebird84vn.wordpress.com/2007/07/03/http-headers-and-the-php-header-function/</link>
		<comments>http://firebird84vn.wordpress.com/2007/07/03/http-headers-and-the-php-header-function/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 09:02:42 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/07/03/http-headers-and-the-php-header-function/</guid>
		<description><![CDATA[Introduction
Many beginning and intermediate PHP programmers seem to think the header() function  is some kind of strange voodoo. They work from examples and code snippets and are able to get things done with it,  but they don&#8217;t know quite how it works. That was certainly the  way I regarded header() the first [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=17&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2>Introduction</h2>
<p class="twocol" style="border-width:0;">Many beginning and intermediate PHP programmers seem to think the <code><a href="http://www.php.net/manual/function.header.php">header()</a></code> function  is some kind of strange voodoo. They work from examples and code snippets and are able to get things done with it,  but they don&#8217;t know quite how it works. That was certainly the  way I regarded <code>header()</code> the first time I saw it.</p>
<p>In reality, it&#8217;s  quite simple. In this tutorial, I&#8217;ll explain a little about how HTTP headers work, how they relate to PHP, and a little about their meta tag equivalents.</p>
<p class="twocol">Hopefully by the time you&#8217;re done reading this, you&#8217;ll feel more confident about how to use the <code>header()</code> function, and even have some new ideas about how it can help you. We&#8217;ll also cover some other important topics related to HTTP headers and PHP.  Before we talk about any programming at all, though, we need to quickly (and incompletely) go over how HTTP (<strong>H</strong>yper<strong>T</strong>ext <strong>T</strong>ransfer <strong>P</strong>rotocol) works in general.</p>
<h2><a title="http_overview" name="http_overview" id="http_overview"></a>HTTP Overview</h2>
<p class="fullwidth">&nbsp;</p>
<h3>Headers: words in a conversation</h3>
<p><a href="http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol">HTTP</a> is the protocol (the set of &#8216;rules&#8217;) for transferring data (e.g. HTML in web pages, pictures, files) between web servers and client browsers, and usually takes place on <a href="http://en.wikipedia.org/wiki/Port_%28computing%29#Network_port">port</a> 80. This is where the &#8216;<code>http://</code>&#8216; in website URLs comes from.</p>
<p>The first time most people make a web page, they write the HTML on their computer, view it locally in a browser, upload it to their server, and view it on the web. It might seem like viewing a page locally and viewing it on the server is exactly the same, and that the only data going back and forth between the server and the browser is the HTML and any images included in the page. But there is actually a lot of other information that you do not see when you view a file on the web — the <em>headers</em>.</p>
<p>Headers can be separated into two broad types: <em>Request</em> headers that your browser sends to the server when you request a file, and <em>Response</em> headers that the server sends to the browser when it serves the file. Think of these headers as the words in a conversation taking place between the browser and the server. I like to imagine the server as a librarian, and the browser as a researcher asking for a library resource. The browser walks up to the server at the main desk (port 80) and says something like, &#8220;Hi, my name is Mozilla, and I&#8217;m looking for the resource with the call number &#8216;www.expertsrt.com&#8217;. Can you get it for me?&#8221; The server listens, and responds &#8220;Yes, I found it, let me send it to you. The data in the item is HTML text, and it says &#8216;<code>&lt;html&gt;</code>&#8230;&#8217;&#8221; The browser reads through, and comes to an image tag, and asks the server for item with the location in the <code>src</code> attribute. The server looks, finds the file and says &#8220;This file is a PNG image, and the data is&#8230;.&#8221; You get the idea.</p>
<p>Another conversation might go like this:</p>
<p><em>Browser:</em> Hi, I&#8217;m Mozilla, can I have the file at &#8216;www.expertsrt.com/moved.html&#8217;?<br />
<em>Server:</em> That file is no longer there, it is at &#8216;www.expertsrt.com/newloc.html&#8217;.<br />
<em>Browser:</em> Hi, I&#8217;m Mozilla, can I have the file at &#8216;www.expertsrt.com/newloc.html&#8217;?<br />
<em>Server:</em> I found the file. Look at it for 10 seconds and then ask me again. It&#8217;s HTML text and it reads&#8230;.<br />
&#8230;10 seconds&#8230;<br />
<em>Browser:</em>&gt; Hi, I&#8217;m Mozilla, can I have the file at &#8216;www.expertsrt.com/newloc.html&#8217;?<br />
<em>Server:</em> I found the file. Look at it for 10 seconds and then ask me again. It&#8217;s HTML text and it reads&#8230;.<br />
&#8230;10 seconds&#8230;<br />
<em>Browser:</em> Hi, I&#8217;m Mozilla, can I have the file at &#8216;www.expertsrt.com/newloc.html&#8217;?<br />
<em>Server:</em> I found the file. Look at it for 10 seconds and then ask me again. It&#8217;s HTML text and it reads&#8230;.<br />
&#8230;.and so on, until the browser is redirected by the user&#8230;.</p>
<p>As you can see, there is a lot going on that headers control. Using the <code>header()</code> function, you can make the server send any headers that you need want, which allows you to do some really cool things beyond just sending plain old HTML.</p>
<h3>Seeing the whole conversation</h3>
<p>Before moving ahead, let&#8217;s get a better idea of how HTTP headers work by viewing a webpage <em>without</em> a browser, so we can see the converation in is entirety. Start by opening a command prompt (in windows, go to Start-&gt;Run, type <code>cmd</code>, and click &#8220;OK&#8221;&#8230;if you&#8217;re using linux you probably already know). At the prompt, type:</p>
<p class="codelisting">&nbsp;</p>
<pre><code>telnet expertsrt.com 80</code></pre>
<p>and press Enter. This will connect you to expertsrt.com on port 80. Next, copy and paste just the text below:</p>
<p class="codelisting">&nbsp;</p>
<pre><code>GET / HTTP/1.1
Host: expertsrt.com</code></pre>
<p>Don&#8217;t worry if when you type or paste the text, it does not show up in your command window and all you see is the cursor &#8212; it is indeed being sent to the server. The first line says you are using the <code>GET</code> request method to get the resource <code>/</code> (i.e. the file in the base directory of the host), and that you are using HTTP version 1.1. The second tells the server which host you want to connect to. When you finish typing &#8216;expertsrt.com&#8217;, hit Enter twice (and twice only). You should almost immediately get a response that looks like:</p>
<p class="codelisting">&nbsp;</p>
<pre><code>HTTP/1.1 301 Moved Permanently
Date: Wed, 08 Feb 2006 07:44:07 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) mod_auth_pgsql/2.0.2b1 mod_ssl/2.0.54 OpenSSL/0.9.7e
Location: http://www.expertsrt.com/
Content-Length: 233
Content-Type: text/html; charset=iso-8859-1

&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;301 Moved Permanently&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Moved Permanently&lt;/h1&gt;
&lt;p&gt;The document has moved &lt;a href="http://www.expertsrt.com/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</code></pre>
<p>Whoops! Looks like we requested a resource that wasn&#8217;t there; it&#8217;s been permanently moved to the new Location <code>http://www.expertsrt.com</code>. If you were using a browser, you&#8217;d only see the HTML — everything before the first blank line is the headers. In fact, modern browsers are even smarter than that — when they see the <code>Location</code> header on the third line, they automatically go there so you don&#8217;t have to type in a new URL. Let&#8217;s go to the new URL. By this point, you probably got disconnected while you were reading this. If so, just press your up arrow on the keyboard to get your <code>telnet</code> command back, and press enter to reconnect. If you&#8217;re still connected, you can just go ahead and type the following:</p>
<p class="codelisting">&nbsp;</p>
<pre><code>GET / HTTP/1.1
Host: www.expertsrt.com</code></pre>
<p>and press Enter twice after the second line. You&#8217;ll get another similar response telling you that the page is <em>actually</em> at <code>http://www.expertsrt.com/index.php</code>. The server is particular, isn&#8217;t it? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Repeat the above, but this time type</p>
<p class="codelisting">&nbsp;</p>
<pre><code>GET /index.php HTTP/1.1
Host: www.expertsrt.com</code></pre>
<p>Notice that the name of the file we want is in the first line. This time we get flooded with text: the HTML from ERT&#8217;s homepage. The headers look like</p>
<p class="codelisting">&nbsp;</p>
<pre><code>HTTP/1.1 200 OK
Date: Wed, 08 Feb 2006 08:20:07 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) mod_auth_pgsql/2.0.2b1 mod_ssl/2.0.54 OpenSSL/0.9.7e
X-Powered-By: PHP/4.4.0
Transfer-Encoding: chunked
Content-Type: text/html</code></pre>
<p>Simple, no?. Let&#8217;s move forward and see how this relates to your programming. Don&#8217;t worry if you didn&#8217;t understand every single thing that we just did. The important thing is to have a general feel for how the browser and server talk to each other, and to realize that <em>there is nothing magic about it.</em> The take home points are:</p>
<ul>
<li>The browser and the server talk to each other using headers</li>
<li>Headers are sent before the main content, and are separated from the main content by a a   double-<a href="http://www.google.com/search?q=define%3ACRLF">CRLF</a>/newline.</li>
<li>In the header section, there is one header per line. The name of the header comes first, followed by a colon and a space, followed by the content/value of the header:
<p class="codelisting"><code>Header-Name: header-value</code></p>
</li>
<li>Headers can contain many types of information and instructions that the server and browser use to help each other know what to do next</li>
</ul>
<p class="note" style="margin-bottom:2em;"><strong>Note</strong>: If you&#8217;re the type who likes to really dig into the details, you can look at <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</a> for the complete HTTP/1.1 specification in all its glory. In particular, <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14">Section 14</a> offers a complete definition for each header field.</p>
<p class="twocol" style="border-width:0;">&nbsp;</p>
<h2><a title="phpheaders" name="phpheaders" id="phpheaders"></a>PHP <code>header()</code>: The Basics</h2>
<p>Notice the response headers <code>X-Powered-By: PHP/4.4.0</code> and <code>Content-Type: text/html</code> that were returned when we finally got to the homepage. PHP was designed from the beginning to output HTML (the &#8216;H&#8217; in PHP stands for &#8216;Hypertext&#8217;), and the first time a script generates output (e.g. by using <code>echo</code>), PHP automatically includes those headers for you. This is very convenient, but also contributes to the confusion many PHP beginners have regarding headers — in more &#8216;bare bones&#8217; languages like Perl that were not originally designed for the web, sending output without including your own headers produces the dreaded &#8216;500 Internal Server Error&#8217;, so Perl web programmers have no choice but to learn about headers immediately.</p>
<p>The <code><a href="http://www.php.net/manual/function.header.php">header()</a></code> function sends HTTP response headers; nothing more, nothing less.</p>
<hr />
<p class="twocol"> Using this function, you can make your scripts send headers of your choosing to the browser, and create some very useful and dynamic results. However, the first thing you need to know about the <code>header()</code> function is that you have to use it <strong>before</strong> PHP has sent any output (and therefore its default headers).</p>
<p>I doubt there is a PHP programmer in the world who has never seen an error that looks like</p>
<p class="codelisting"> <strong>Warning:</strong> Cannot modify header information &#8211; headers already sent by&#8230;..</p>
<p>As we said above, the response headers are separated from the content by a blank line. This means you can only send them <em>once</em>, and if your script has any output (even a blank line or space before your opening <code><span style="color:#0000bb;">&lt;?php</span></code> tag), PHP does so without asking you. For example, consider the script below, which seems logical enough:</p>
<p class="fullwidth">&nbsp;</p>
<p class="codelisting"><code><span style="color:#000000;"> Welcome to my website!&lt;br /&gt;<br />
<span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(</span><span style="color:#0000bb;">$test</span><span style="color:#007700;">){<br />
echo </span><span style="color:#dd0000;">"You're in!"</span><span style="color:#007700;">;<br />
}<br />
else{<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/someotherpage.php'</span><span style="color:#007700;">);<br />
}<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>What this script is <em>trying</em> to do is redirect the visitor using the <code>Location</code> header if <code>$test</code> is not true. Do you see the problem? The &#8216;Welcome&#8230;&#8217; text gets sent no matter what, so the headers are automatically sent. By the time <code>header()</code> is called, it&#8217;s already too late: instead of getting redirected, the user will just see an error message (or if you have error reporting off, nothing but the &#8216;Welcome&#8230;&#8217; text).</p>
<p>There are basically two solutions to this. The first is to rewrite the code
</p>
<p class="fullwidth">&nbsp;</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(</span><span style="color:#0000bb;">$test</span><span style="color:#007700;">){<br />
echo </span><span style="color:#dd0000;">'Welcome to my website&lt;br /&gt;You're in!'</span><span style="color:#007700;">;<br />
}<br />
else{<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/someotherpage.php'</span><span style="color:#007700;">);<br />
}<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>The second is <a href="http://www.php.net/outcontrol">output buffering</a>, which can be somewhat more elegant and easy to use. In our example above, rewriting the code wasn&#8217;t much trouble, but imagine if there had been quite a bit of HTML to move around — it could be pretty cumbersome, and it might make our code harder to follow. While our first example caused an error, the <em>logic of the program</em> was fine. Output buffering allows you to hold on to (&#8216;buffer&#8217;) output (even HTML outside of PHP code tags) and send it to the browser only when you explicitly say to do so. This way you can program however you would like to, and explicitly send the output after you&#8217;ve specified any headers you need to. The two relevant functiosns are <code><a href="http://www.php.net/manual/function.ob-start.php">ob_start()</a></code>, which turns output buffering on, and <code><a href="http://www.php.net/manual/function.ob-flush.php">ob_flush()</a></code>, which sends the content that has accumulated in the buffer:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
ob_start</span><span style="color:#007700;">();  </span><span style="color:#666666;">//begin buffering the output<br />
</span><span style="color:#0000bb;">?&gt;<br />
</span>Welcome to my website!<br />
<span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(</span><span style="color:#0000bb;">true</span><span style="color:#007700;">){<br />
echo </span><span style="color:#dd0000;">"You're in!"</span><span style="color:#007700;">;<br />
}<br />
else{<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/someotherpage.php'</span><span style="color:#007700;">);<br />
}</span></span></code></p>
<p><span style="color:#0000bb;">ob_flush</span><span style="color:#007700;">(); </span><span style="color:#666666;">//output the data in the buffer<br />
</span><span style="color:#0000bb;">?&gt;</span></p>
<p>I encourage you to read more about all of the output buffering functions, which can be quite useful. You should flush the output buffer as soon as possible, especially if you have quite a bit of content to send. Otherwise, your page will appear to load slower, becuase the content will be sent only after it has been entirely assembled, rather than as it is available.
</p>
<p class="note"><strong>Note: The 2nd argument</strong> If you call <code>header()</code> more than once for the same header field, the value for that header will be the one included in the <em>last</em> call you made. For example,</p>
<p class="codelisting"> <code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Some-Header: Value-1'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Some-Header: Value-2'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>would produce the header <code>Some-Header: Value-2</code>. You can cause both headers to be sent by using the second <em><code>replace</code></em> argument for header, which is <code>true</code> by default. If you set this to <code>false</code>, the second header value will not replace the first, and both will be sent. So the code</p>
<p class="codelisting"> <code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Some-Header: Value-1'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Some-Header: Value-2'</span><span style="color:#007700;">, </span><span style="color:#0000bb;">false</span><span style="color:#007700;">); </span><span style="color:#666666;">//don't replace the first value<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>will produce the header <code>Some-Header: Value-1, Value-2</code>. You will rarely need this, but is good to know.</p>
<p>Armed with a good understanding of how HTTP headers and PHP work together, let&#8217;s look at some specific examples of using this functionality.</p>
<h2><a title="phpheaderex" name="phpheaderex" id="phpheaderex"></a>PHP <code>header()</code>: Some Examples</h2>
</p>
<p class="note"><strong>Note:</strong> The code snippets appearing below are just that: snippets from complete working code. When you you include them in your own programs, remember to define all your variables, assign default values, and adhere to other good programming practices.</p>
<h3>Redirecting with the <code>Location</code> header</h3>
<p>We&#8217;ve seen this one a couple times above: it redirects the browser.</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/new_location.html'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>While you can somtimes get away with supplying a relative URL for the value, according to the HTTP specification, you should really use an absolute URL.</p>
<p>One mistake that is easy to make with the <code>Location</code> header is not calling <code><a href="http://www.php.net/manual/function.exit.php">exit</a></code> directly afterwards (you may not always want to do this, but usually you do). The reason this is a mistake is that the PHP code of the page continues to execute even though the user has gone to a new location. In the best case, this uses system resources unnecessarily. In the worst case, you may perform tasks that you never meant to. Consider the code below:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#666666;">//Redirect users with access level below 4<br />
</span><span style="color:#007700;">if (</span><span style="color:#0000bb;">check_access_level</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$username</span><span style="color:#007700;">) &lt; </span><span style="color:#0000bb;">4</span><span style="color:#007700;">){<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/someotherpage.php'</span><span style="color:#007700;">);<br />
}</span></span></code></p>
<p><span style="color:#666666;">//Mail users with higher access level the secret code<br />
</span><span style="color:#0000bb;">mail_secret_code</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$username</span><span style="color:#007700;">);<br />
echo </span><span style="color:#dd0000;">&#8216;The secret email is on its way!&#8217;</span><span style="color:#007700;">;<br />
</span><span style="color:#0000bb;">?&gt;</span></p>
<p>Unauthorized users are indeed redirected, but in fact, they too will receive the email, because the script continues to run. To avoid this, the part for authorized users could be wrapped in an <code>else{}</code> statement, but it is cleaner and easier to call <code>exit</code> immediately after the <code>header</code> command to end the execution of the script:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#666666;">//Redirect users with access level below 4<br />
</span><span style="color:#007700;">if (</span><span style="color:#0000bb;">check_access_level</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$username</span><span style="color:#007700;">) &lt; </span><span style="color:#0000bb;">4</span><span style="color:#007700;">){<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Location: http://www.mysite.com/someotherpage.php'</span><span style="color:#007700;">);<br />
exit; </span><span style="color:#666666;">//stop script execution<br />
</span><span style="color:#007700;">}</span></span></code></p>
<p><span style="color:#666666;">//Mail users with higher access level the secret code<br />
</span><span style="color:#0000bb;">mail_secret_code</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$username</span><span style="color:#007700;">);<br />
echo </span><span style="color:#dd0000;">&#8216;The secret email is on its way!&#8217;</span><span style="color:#007700;">;<br />
</span><span style="color:#0000bb;">?&gt;</span></p>
<h3>Redirecting with the <code>Refresh</code> header</h3>
<p>The <code>Refresh</code> redirects users like the <code>Location</code> header does, but you can add a delay before the user is redirected. For example, the following code would redirect the user to a new page after displaying the current one for 10 seconds:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Refresh: 10; url=http://www.mysite.com/otherpage.php'</span><span style="color:#007700;">);<br />
echo </span><span style="color:#dd0000;">'You will be redirected in 10 seconds'</span><span style="color:#007700;">;<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>Another common application is to force a page to update repeatedly by &#8216;redirecting&#8217; to the current page (see the second &#8216;conversation&#8217; <a href="http://www.expertsrt.com/tutorials/Matt/HTTP_headers.html#secondconv">above</a>). For example, here is a simple page that will &#8216;count&#8217; down from 10, with a 3 second pause between numbers:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(!isset(</span><span style="color:#0000bb;">$_GET</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'n'</span><span style="color:#007700;">])){<br />
</span><span style="color:#0000bb;">$_GET</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'n'</span><span style="color:#007700;">] = </span><span style="color:#0000bb;">10</span><span style="color:#007700;">;<br />
}</span></span></code></p>
<p>if(<span style="color:#0000bb;">$_GET</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'n'</span><span style="color:#007700;">] &gt; </span><span style="color:#0000bb;">0</span><span style="color:#007700;">){<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">&#8216;Refresh: 3; url=&#8217; </span><span style="color:#007700;">. </span><span style="color:#0000bb;">$_SERVER</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'PHP_SELF'</span><span style="color:#007700;">].</span><span style="color:#dd0000;">&#8216;?n=&#8217; </span><span style="color:#007700;">. (</span><span style="color:#0000bb;">$_GET</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'n'</span><span style="color:#007700;">]-</span><span style="color:#0000bb;">1</span><span style="color:#007700;">)  );<br />
echo </span><span style="color:#0000bb;">$_GET</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'n'</span><span style="color:#007700;">];<br />
}<br />
else{<br />
echo </span><span style="color:#dd0000;">&#8216;BLAST OFF!&#8217;</span><span style="color:#007700;">;<br />
}<br />
</span><span style="color:#0000bb;">?&gt;</span>
</p>
<p class="note"><strong>Note:</strong> If the refresh time is set to 0, then the <code>Refresh</code> header is effectively the same as the <code>Location</code> header.</p>
<h3>Serving different types of files and generating dynamic content using the <code>Content-Type</code> header</h3>
<p>The <code>Content-Type</code> header tells the browser what type of data the server is about to send. Using this header, you can have your PHP scripts output anything from plain text files to images or zip files. The table below lists frequently-used <a href="http://en.wikipedia.org/wiki/Mime_type">MIME types</a>:</p>
<p class="twocol" style="width:55%;border-width:0;">You can do several interesting things with this. For example, perhaps you want to send the user a pre-formatted text file rather than HTML:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Type: text/plain'</span><span style="color:#007700;">);<br />
echo </span><span style="color:#0000bb;">$plain_text_content</span><span style="color:#007700;">;<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>Or perhaps you&#8217;d like to prompt the user to download the file, rather than viewing it in the browser. With the help of the <code>Content-Disposition</code> header, it&#8217;s easy to do, and you can even suggest a file name for the user to use:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Type: application/octet-stream'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Disposition: attachment; '<br />
</span><span style="color:#007700;">.</span><span style="color:#dd0000;">'filename="plain_text_file.txt"'</span><span style="color:#007700;">);<br />
echo </span><span style="color:#0000bb;">$plain_text_content</span><span style="color:#007700;">;<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>Maybe you need to serve a file for download, but you&#8217;d like to obscure its true location and name, and only serve it to users who are logged in:</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(</span><span style="color:#0000bb;">$b_is_logged_in</span><span style="color:#007700;">){<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Type: application/octet-stream'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Disposition: attachment; '<br />
</span><span style="color:#007700;">.</span><span style="color:#dd0000;">'filename="'</span><span style="color:#007700;">.</span><span style="color:#0000bb;">$different_filename</span><span style="color:#007700;">.</span><span style="color:#dd0000;">'"'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">readfile</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'/path/to/files/' </span><span style="color:#007700;">. </span><span style="color:#0000bb;">$filename</span><span style="color:#007700;">);<br />
}<br />
else{<br />
echo </span><span style="color:#dd0000;">'You are not authorized to view this file'</span><span style="color:#007700;">;<br />
}<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>Perhaps you&#8217;ve dynamically generated an image using PHP&#8217;s <a href="http://www.php.net/manual/ref.image.php">image functions</a> and you want to display it to the user. You could create a file <code>build_image.php</code> like this</p>
<p class="twocol" style="width:35%;">
<table style="margin-bottom:2em;">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>text/html</td>
<td>HTML (PHP default)</td>
</tr>
<tr>
<td>text/plain</td>
<td>Plain Text</td>
</tr>
<tr>
<td>image/gif</td>
<td>GIF Image</td>
</tr>
<tr>
<td>image/jpeg</td>
<td>JPEG Image</td>
</tr>
<tr>
<td>image/png</td>
<td>PNG Image</td>
</tr>
<tr>
<td>video/mpeg</td>
<td>MPEG Video</td>
</tr>
<tr>
<td>audio/wav</td>
<td>WAV Audio</td>
</tr>
<tr>
<td>audio/mpeg</td>
<td>MP3 Audio</td>
</tr>
<tr>
<td>video/mov<br />
video/quicktime</td>
<td>Quicktime Video</td>
</tr>
<tr>
<td>video/x-ms-wmv</td>
<td>Windows WMV video</td>
</tr>
<tr>
<td>audio/x-ms-wma</td>
<td>Windows WMA audio</td>
</tr>
<tr>
<td>audio/x-realaudio</td>
<td>RealPlayer Audio/Video (.rm)</td>
</tr>
<tr>
<td>audio/x-pn-realaudio</td>
<td>RealPlayer Audio/Video (.ram)</td>
</tr>
<tr>
<td>video/x-msvideo<br />
video/avi</td>
<td>AVI Video</td>
</tr>
<tr>
<td>application/pdf</td>
<td>PDF Document</td>
</tr>
<tr>
<td>application/msword</td>
<td>MS Word .doc file</td>
</tr>
<tr>
<td>application/zip</td>
<td>Zip File</td>
</tr>
<tr>
<td>application/octet-stream</td>
<td>Misc. data. Use to force download or open with application.*</td>
</tr>
<tr>
<td>x-foo/x-bar</td>
<td>Misc. data. Use to force download or open with application.*</td>
</tr>
</table>
<p class="fullwidth">&nbsp;</p>
<p class="codelisting"><code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#666666;">//build the image above<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Content-Type: image/jpeg'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">imagejpeg</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$image_resouce</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">?&gt;</span>  </span> </code>
</p>
<p class="note" style="margin:30px;"><strong>Note</strong>: Beware of <a href="http://www.php.net/magic_quotes">magic_quotes</a>! PHP&#8217;s automatic escaping of special characters with a backslash may seem like a good idea at first, but most good programmers generally agree that it (a) encourages sloppy programming that does not validate input and (b) causes annoyances in well-written code that would not occur if &#8220;magic quoting&#8221; were turned off. One such annoyance is the corruption of binary data. In the example above, if <a href="http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-runtime"><code>magic_quotes_runtime</code></a> is on, the data that <code>readfile()</code> outputs may have backslashes added to it, thus corrupting the file that is sent to the user. Ideally, you should turn <code>magic_quotes_runtime</code> off in your <code>php.ini</code> file to avoid this, but if you do not have access to the configuration file, you can also use the <a href="http://www.php.net/manual/en/function.set-magic-quotes-runtime.php">set_magic_quotes_runtime()</a> function (pass is the <code>0</code> (zero) integer) to turn the setting off.</p>
<p>Happily, the <a href="http://www.php.net/%7Ederick/meeting-notes.html#magic-quotes">minutes</a> of a recent PHP Developer meeting show that they have decided to abandon magic quotes in future versions (6+) of PHP. Until everyone upgrades, however, keeping the problems this feature can cause in mind can save you quite a bit of trouble and frustration.<br />
You might pass the parameters necessary to generate the image via the URL so you can access them in the <code>$_GET</code> array. Then in another page, you might include this image using an <code>img</code> tag:</p>
<p class="codelisting"><code><span style="color:#000000;"> &lt;img src="build_image.php<span style="color:#0000bb;">&lt;?php </span><span style="color:#007700;">echo </span><span style="color:#dd0000;">"?$user_id&amp;$caption"</span><span style="color:#007700;">; </span><span style="color:#0000bb;">?&gt;</span>"&gt;</span> </code></p>
<p>The possibilities are more or less endless. The more PHP programming you do, the more you will find that the <code>Content-Type</code> header truly is your friend.</p>
<p class="note"><strong>Note</strong>: The way that browser are <em>supposed</em> to handle content of various MIME types, and the way they actually <em>do</em> may not always be consistent (especially with Internet Explorer), so you&#8217;re well-advised to test your pages in the browsers you need to support to make sure they behave as expected. The PHP Manual has many helpful tips in the <a href="http://www.php.net/manual/function.header.php#usernotes">user-contributed comments</a> on the <code>header()</code> page.</p>
<h3>Preventing Page Caching</h3>
<p>PHP pages often generate very dynamic content, and to prevent users from missing updates by viewing cached pages, it is often helpful to be able to tell browsers not to cache certain pages. The following snippet works quite well on  the browsers that are likely to visit your site:</p>
<p class="codelisting"> <code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Cache-Control: no-cache, no-store, must-revalidate'</span><span style="color:#007700;">); </span><span style="color:#666666;">//HTTP/1.1<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Expires: Sun, 01 Jul 2005 00:00:00 GMT'</span><span style="color:#007700;">);<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Pragma: no-cache'</span><span style="color:#007700;">); </span><span style="color:#666666;">//HTTP/1.0<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>The <code>Expires</code> header can be any date in the past. As with MIME types, browsers (especially older ones) may not always listen properly to your caching instructions (although most modern ones will).</p>
<h3>Other Applications</h3>
<p>There are other ways you can use headers as well, such as setting the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Response Code</a>, or in performing <a href="http://www.php.net/manual/features.http-auth.php">HTTP Authentication</a> (if you are running PHP as an Apache module). Now that you understand how <code>header()</code> works and how to use it, you&#8217;ll be able to do all sorts of things you might not have thought of before.</p>
<p><a title="requestheaders" name="requestheaders" id="requestheaders"></a></p>
<h2>Request Headers in PHP</h2>
<p>We&#8217;ve covered some of the things you can do with response headers above. We can also get a great deal of information from the request headers received by the server from the browser. There are two ways to access these. First, many of the values in the <a href="http://www.php.net/reserved.variables"><code>$_SERVER</code> array</a> are determined from the request headers. Second, if PHP is installed as an Apache module, then <a href="http://www.php.net/manual/function.apache-request-headers.php">apache_request_headers()</a> will return an array of all request headers (even those not in <code>$_SERVER</code>).</p>
<h3>Security first: don&#8217;t trust request headers</h3>
<p>Since request headers are set by the browser, which is controlled by the client, <strong>you must never trust request headers for information that is important to the security of your site</strong>. A good example is the <code>$_SERVER['HTTP_REFERER']</code> variable, which <em>should</em> hold the URL of the page that referred the user to the current one. A common mistake among beginners is to think that they can use this to make sure that users only access pages through a certain path, and that they therefore do not need to worry about server side data validation. For example, consider this code, which attempts to make sure that data has been submitted from a specific page, rather than a custom form on another website:</p>
<p class="codelisting"> <code><span style="color:#000000;"> <span style="color:#0000bb;">&lt;?php<br />
</span><span style="color:#007700;">if(</span><span style="color:#0000bb;">$_SERVER</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'HTTP_REFERER'</span><span style="color:#007700;">] != </span><span style="color:#dd0000;">'http://www.mysite.com/myform.html'</span><span style="color:#007700;">){<br />
</span><span style="color:#0000bb;">header</span><span style="color:#007700;">(</span><span style="color:#dd0000;">'Refresh: 5; url=http://www.mysite.com/myform.html'</span><span style="color:#007700;">);<br />
echo </span><span style="color:#dd0000;">'You must use the form on my site...redirecting now.'</span><span style="color:#007700;">;<br />
}<br />
else{<br />
</span><span style="color:#0000bb;">insert_data</span><span style="color:#007700;">(</span><span style="color:#0000bb;">$_POST</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'var1'</span><span style="color:#007700;">], </span><span style="color:#0000bb;">$_POST</span><span style="color:#007700;">[</span><span style="color:#dd0000;">'var2'</span><span style="color:#007700;">]);<br />
}<br />
</span><span style="color:#0000bb;">?&gt;</span> </span> </code></p>
<p>This might work to deter an unsophisticated hacker who is using his web browser to submit data through a custom form, but someone who is a little more savvy could easily submit data via a telnet session like we did above, including the request header
</p>
<p class="codelisting"> <code>Referer: http://www.mysite.com/myform.html</code></p>
<p>and easily defeat this &#8216;protection&#8217;. The moral of the story is: use HTTP request headers to gather statistics and to help make the user experience more pleasant — most request headers you receive will be supplied by standard browsers and will be entirely truthful&#8230;But <strong>do not</strong> rely on request headers for any issues pertaining to security.</p>
<h3>Using HTTP request headers</h3>
<p>There are several things you can do with these. Using <code>$_SERVER['HTTP_USER_AGENT']</code> you can detect the type of browser the user says it has. You might check the <code>$_SERVER['HTTP_ACCEPT_LANGUAGE']</code> (perhaps along with <code>$_SERVER['HTTP_ACCEPT_CHARSET']</code> and some <a href="http://www.expertsrt.com/articles/Rod/city_country_IP.php">IP address geolocation</a>) to help determine the best language in which to serve your pages to a given user. Although <code>$_SERVER['HTTP_REFERER']</code> is not reliable for security purposes, it could be useful as an aid for building statistics about your website traffic or customizing content to match the path the user took to reach a given page. If for some reason you want to manipulate the raw query string used when the page was accessed, you can look in <code>$_SERVER['QUERY_STRING']</code>. Looking in <code>$_SERVER['REQUEST_METHOD']</code> will tell you whether your page was accessed via  <code>GET</code> or <code>POST</code>. There&#8217;s quite a bit of information there for you to find creative uses for.  <a title="metaequiv" name="metaequiv" id="metaequiv"></a></p>
<h2>HTML Meta Tag HTTP Header Equivalents</h2>
<p>Chances are, before reading this article, you have seen or used the HTML meta tag below to redirect a user:</p>
<p class="codelisting"> <code>&lt;meta http-equiv="refresh" content="0;http://www.mysite.com/somepage.html" /&gt;</code></p>
<p>Look familiar? The &#8216;http-equiv&#8217; meta tags are &#8216;equivalent&#8217; to HTTP response headers, and were introduced so that people writing HTML pages without server side programming would have access to the powerful functionality described above. Using these meta tags is simple: they can be placed anywhere in the <code>&lt;head&gt;</code> of the document, and their <code>http-equiv</code> attribute contains the header name, while the <code>content</code> attribute contains the value for the header.</p>
<p>I&#8217;ve found that these, like the HTTP headers in general, often produce confusion, but now they should seem quite simple to you. Although I usually prefer to use the PHP <code>header()</code> function, these meta tag HTTP header equivalents are often very handy for things like specifying the character set. For example, I often use this is my HTML pages (and sometimes my PHP ones):</p>
<p class="codelisting"> <code>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</code></p>
<p class="note">  <strong>Note:</strong> Support for HTTP headers as equivalet meta tags is not uniformally supported, so it is usually safer and  faster to use the headers themselves if you can. Also, it should be obvious that some headers and values will not work as meta  equivalents: you cannot set the <code>Content-Type</code> to <code>image/png</code> when the real headers have been sent and the  browser is already reading the HTML <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a title="conclusion" name="conclusion" id="conclusion"></a></p>
<h2>Conclusion</h2>
<p>Now that you are done with this article, you should have a pretty firm grasp of how HTTP works, how request and response headers are used, and how you can employ this functionality in your programming. This reasonably detailed knowledge should also enable you to start thinking more critically about your web application efficiency and security. I hope that as you move forward with your programming, you will find that you&#8217;ve become quite comfortable working with HTTP headers, and that you are able to exploit them to make your job easier and your pages better.</p>
<p>As a parting thought, remember that headers are like words: they convey information and ask for certain actions to be performed, but by themselves they don&#8217;t force anything to happen. 99.9% of the time, cooperative browsers are talking to cooperative servers, and everything happens smoothly. But you have to remember that, as in life, every once in a while you&#8217;ll run across a jerk (a hacker), or someone who&#8217;s got his own way of doing things (Internet Explorer). Web development is very much a job of customer service, so you&#8217;ve got to do your best to keep the crooks out, and accomodate the customers with &#8217;special needs.&#8217;</p>
<p>Source: http://www.expertsrt.com</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=17&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/07/03/http-headers-and-the-php-header-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>Skipping to Another Action</title>
		<link>http://firebird84vn.wordpress.com/2007/06/30/skipping-to-another-action/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/30/skipping-to-another-action/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 06:14:37 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/30/skipping-to-another-action/</guid>
		<description><![CDATA[In some cases, the action execution ends by requesting a new action execution. For instance, an action handling a form submission in a POST request usually redirects to another action after updating the database. Another example is an action alias: the index action is often a way to display a list, and actually forwards to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=15&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In some cases, the action execution ends by requesting a new action execution. For instance, an action handling a form submission in a POST request usually redirects to another action after updating the database. Another example is an action alias: the <code>index</code> action is often a way to display a list, and actually forwards to a <code>list</code> action.</p>
<p>The action class provides two methods to execute another action:</p>
<ul>
<li>If the action forwards the call to another action:
<pre><span class="re0">$this</span>-&gt;<span class="me1">forward</span><span class="br0">(</span><span class="st0">'otherModule'</span>, <span class="st0">'index'</span><span class="br0">)</span>;</pre>
</li>
<li>If the action results in a web redirection:
<pre><span class="re0">$this</span>-&gt;<span class="me1">redirect</span><span class="br0">(</span><span class="st0">'otherModule/index'</span><span class="br0">)</span>; <span class="re0">$this</span>-&gt;<span class="me1">redirect</span><span class="br0">(</span><span class="st0">'http://www.google.com/'</span><span class="br0">)</span>;</pre>
</li>
</ul>
<blockquote><p>The code located after a forward or a redirect in an action is never executed. You can consider that these calls are equivalent to a <code>return</code> statement. They throw an <code>sfStopException</code> to stop the execution of the action; this exception is later caught by symfony and simply ignored.</p></blockquote>
<p>The choice between a redirect or a forward is sometimes tricky. To choose the best solution, keep in mind that a forward is internal to the application and transparent to the user. As far as the user is concerned, the displayed URL is the same as the one requested. In contrast, a redirect is a message to the user&#8217;s browser, involving a new request from it and a change in the final resulting URL.</p>
<p>If the action is called from a submitted form with <code>method="post"</code>, you should always do a redirect. The main advantage is that if the user refreshes the resulting page, the form will not be submitted again; in addition, the back button works as expected by displaying the form and not an alert asking the user if he wants to resubmit a POST request.</p>
<p>There is a special kind of forward that is used very commonly. The <code>forward404()</code> method forwards to a &#8220;page not found&#8221; action. This method is often called when a parameter necessary to the action execution is not present in the request (thus detecting a wrongly typed URL). Listing 6-12 shows an example of a <code>show</code> action expecting an <code>id</code> parameter.</p>
<p class="figure">Listing 6-12 &#8211; Use of the <code>forward404()</code> Method</p>
<pre>public <span class="kw2">function</span> executeShow<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>   <span class="re0">$article</span> = ArticlePeer::<span class="me2">retrieveByPK</span><span class="br0">(</span><span class="re0">$this</span>-&gt;<span class="me1">getRequestParameter</span><span class="br0">(</span><span class="st0">'id'</span><span class="br0">)</span><span class="br0">)</span>;   <span class="kw1">if</span> <span class="br0">(</span>!<span class="re0">$article</span><span class="br0">)</span>   <span class="br0">{</span>     <span class="re0">$this</span>-&gt;<span class="me1">forward404</span><span class="br0">(</span><span class="br0">)</span>;   <span class="br0">}</span> <span class="br0">}</span></pre>
<blockquote><p>If you are looking for the error 404 action and template, you will find them in the <code>$sf_symfony_ data_dir/modules/default/</code> directory. You can customize this page by adding a new <code>default</code> module to your application, overriding the one located in the framework, and by defining an <code>error404</code> action and an error404Success template inside. Alternatively, you can set the error_404_module and error_404_ action constants in the <code>settings.yml</code> file to use an existing action.</p></blockquote>
<p>Experience shows that, most of the time, an action makes a redirect or a forward after testing something, such as in Listing 6-12. That&#8217;s why the sfActions class has a few more methods, named <code>forwardIf()</code>, <code>forwardUnless()</code>, <code>forward404If()</code>, <code>forward404Unless()</code>, <code>redirectIf()</code>, and <code>redirectUnless()</code>. These methods simply take an additional parameter representing a condition that triggers the execution if tested true (for the <code>xxxIf()</code> methods) or false (for the <code>xxxUnless()</code> methods), as illustrated in Listing 6-13.</p>
<p class="figure">Listing 6-13 &#8211; Use of the <code>forward404If()</code> Method</p>
<pre><span class="co1">// This action is equivalent to the one shown in Listing 6-12</span> public <span class="kw2">function</span> executeShow<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>   <span class="re0">$article</span> = ArticlePeer::<span class="me2">retrieveByPK</span><span class="br0">(</span><span class="re0">$this</span>-&gt;<span class="me1">getRequestParameter</span><span class="br0">(</span><span class="st0">'id'</span><span class="br0">)</span><span class="br0">)</span>;   <span class="re0">$this</span>-&gt;<span class="me1">forward404If</span><span class="br0">(</span>!<span class="re0">$article</span><span class="br0">)</span>; <span class="br0">}</span>   <span class="co1">// So is this one</span> public <span class="kw2">function</span> executeShow<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>   <span class="re0">$article</span> = ArticlePeer::<span class="me2">retrieveByPK</span><span class="br0">(</span><span class="re0">$this</span>-&gt;<span class="me1">getRequestParameter</span><span class="br0">(</span><span class="st0">'id'</span><span class="br0">)</span><span class="br0">)</span>;   <span class="re0">$this</span>-&gt;<span class="me1">forward404Unless</span><span class="br0">(</span><span class="re0">$article</span><span class="br0">)</span>; <span class="br0">}</span></pre>
<p>Using these methods will not only keep your code short, but it will also make it more readable.</p>
<blockquote><p>When the action calls forward404() or its fellow methods, symfony throws an sfError404Exception that manages the 404 response. This means that if you need to display a 404 message from somewhere where you don&#8217;t want to access the controller, you can just throw a similar exception.</p></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=15&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/30/skipping-to-another-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>Đối phó với&#8230; côn trùng</title>
		<link>http://firebird84vn.wordpress.com/2007/06/28/d%e1%bb%91i-pho-v%e1%bb%9bi-con-trung/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/28/d%e1%bb%91i-pho-v%e1%bb%9bi-con-trung/#comments</comments>
		<pubDate>Thu, 28 Jun 2007 06:04:24 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/28/d%e1%bb%91i-pho-v%e1%bb%9bi-con-trung/</guid>
		<description><![CDATA[Chữa côn trùng chui vào tai
-Khi côn trùng chui vào tai, bạn hãy hướng tai mình vào ánh đèn sáng, vì côn trùng dễ bị thu hút bởi ánh sáng.
 Xua muỗi
-Muỗi khá “ghét” hành lá. Vậy khi nào quên mua thuốc chống muỗi thì chúng ta có thể bóp vài lá hành sống để [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=13&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Chữa côn trùng chui vào tai</strong><br />
-Khi côn trùng chui vào tai, bạn hãy hướng tai mình vào ánh đèn sáng, vì côn trùng dễ bị thu hút bởi ánh sáng.<br />
<strong> Xua muỗi</strong><br />
-Muỗi khá “ghét” hành lá. Vậy khi nào quên mua thuốc chống muỗi thì chúng ta có thể bóp vài lá hành sống để dưới gầm bàn thì không có &#8220;chàng&#8221; muỗi ghé thăm.<br />
<strong> Tỏi đuổi gián</strong><br />
-Gián kỵ mùi tỏi, tỏi với liều lượng thấp có thể giết ấu trùng. Ðể tỏi tươi trong tủ thức ăn thì gián không có chui vào.<br />
<strong> Hoa vạn thọ giúp đuổi ong</strong><br />
-Cây hoa Vạn Thọ được trồng sát hay chung quanh cái ghế ngoài vườn thì mấy con ong không thích tới thăm.<br />
<strong> Khi bị ong và muỗi chích, kiến cắn</strong><br />
-Nên rửa ngay vết ong hoặc muỗi chích bằng nước muối thật mặn (càng mặn càng đỡ đau), sau đó dùng bông gòn thấm nước nóng có pha muối hoặc giấm chua đắp lên chỗ bị chích. Nếu chúng ta bị ong chích và vết thương gây nhiều nhức nhối, khó chịu thì chúng ta thử lấy nhíp nhổ ngòi của ong ra. Sau đó, chỉ cần lấy lá ngò tây vò nát đắp lên chỗ đau. Khoảng vài phút, vết thương sẽ dễ chịu hơn. Riêng đối với trường hợp bị muỗi chích, kiến cắn thì đơn giản hơn, chúng ta chỉ cần cắt những khoanh hành tây đắp lên chỗ những vết muỗi cắn, kiến cắn. Trong vòng vài phút, chúng ta sẽ cảm thấy hết ngứa ngáy, khó chịu. Lá bạc hà bóp nhỏ và đắp lên cũng có tác dụng như trên.<br />
<strong> Diệt mối</strong><br />
-Thuốc sát trùng chỉ làm chết những con mối xuất hiện ngoài khe rãnh, còn những con ẩn núp bên trong hay những trứng mối ở trong ổ vẫn còn như thường và vẫn chờ dịp làm hại chúng ta như thường. Chúng ta hãy chịu khó làm theo cách sau: mua một ít nụ đinh hương ở tiệm thuốc, cắm những nụ đinh hương đó vào trong một trái cam tươi, để nguyên trái cam tươi đó vào những nơi có mối đang ăn hại đồ vật. Chính mùi nụ đinh hương tiết ra làm tiệt đường sinh sản của giống mối. Nên nhớ dùng cho đến khi bị khô héo thì lại tiếp tục làm như vậy.<br />
<strong>Trừ kiến</strong><br />
-Tuy sức phá hoại của kiến không đáng kể, nhưng các chị em nội trợ không khỏi bực mình khi thấy từng bầy kiến hôi, kiến lửa kéo nhau đi trên vách hay trên sàn nhà. Ngoài những loại kiến bò dưới đất ra, vào mùa mưa, ở nông thôn còn có kiến cánh. Loại này không phá hoại gì mấy nhưng kiến bay đầy nhà cũng gây nhiều phiền phức.<br />
-Chúng ta có thể tránh những phiền toái này bằng cách: nghiền nát đường và bột men bánh mì với số lượng bằng nhau. Sau đó, chúng ta nhỏ vào đó vài giọt nước và trộn lại như bột làm bánh. Tiếp theo, chúng ta đem bột này để vào những nơi có ổ kiến. Mùi đường sẽ làm cho kiến kéo ra tha những miếng bột này vào tổ để ăn với nhau.<br />
-Bột men bánh mì khi chạy vào bụng kiến sẽ nở lớn ra và kiến sẽ vỡ bụng mà chết. Phương pháp này lạ đối với người Việt Nam nhưng lại là phương pháp thông dụng nhất của Tây Phương. Các bạn hãy áp dụng thử xem kết quả thế nào?</p>
<p>NHẬT TRIỀU(tuoitre online)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=13&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/28/d%e1%bb%91i-pho-v%e1%bb%9bi-con-trung/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>Làm gì để tránh viêm họng khi nắng nóng?</title>
		<link>http://firebird84vn.wordpress.com/2007/06/27/lam-gi-d%e1%bb%83-tranh-viem-h%e1%bb%8dng-khi-n%e1%ba%afng-nong/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/27/lam-gi-d%e1%bb%83-tranh-viem-h%e1%bb%8dng-khi-n%e1%ba%afng-nong/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 02:06:17 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Medicine]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/27/lam-gi-d%e1%bb%83-tranh-viem-h%e1%bb%8dng-khi-n%e1%ba%afng-nong/</guid>
		<description><![CDATA[




Có thể uống siro giảm ho trước khi quyết định dùng kháng sinh.
Ảnh: Corbis.


Trời quá nóng, nhiều bà mẹ băn khoăn vì nếu không bật máy điều hòa thì trẻ vật vã khó chịu, mà bật thì sợ trẻ bị viêm họng và ho.
Bác sĩ Phạm Mạnh Thân, Trưởng phòng kế hoạch tổng hợp Bệnh [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=12&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><table align="left" border="0" cellpadding="3" cellspacing="0" width="1">
<tr>
<td><img src="http://vnexpress.net/Vietnam/Doi-song/2007/06/3B9F777D/24.jpg" border="1" height="198" width="155" /></td>
</tr>
<tr>
<td class="Image">Có thể uống siro giảm ho trước khi quyết định dùng kháng sinh.<br />
Ảnh: <em>Corbis.</em></td>
</tr>
</table>
<p class="Lead">Trời quá nóng, nhiều bà mẹ băn khoăn vì nếu không bật máy điều hòa thì trẻ vật vã khó chịu, mà bật thì sợ trẻ bị viêm họng và ho.</p>
<p class="Normal">Bác sĩ Phạm Mạnh Thân, Trưởng phòng kế hoạch tổng hợp Bệnh viện Xanh Pôn (Hà Nội), cho biết, trong những ngày nắng nóng này, số người lớn và trẻ em đến khám do viêm đường hô hấp đều tăng. Đặc biệt, có đến 80-85% trẻ đến khám bệnh là do vấn đề ở đường hô hấp. Bác sĩ cũng giải đáp những thắc mắc thường gặp về hiện tượng này:</p>
<p class="Normal">&nbsp;</p>
<p class="Normal">&nbsp;</p>
<p class="Normal"><em>- Tại sao khi trời nóng, con người lại dễ bị viêm họng?</em></p>
<p class="Normal">
- Thời tiết nóng làm giảm sức đề kháng của cơ thể nên dễ gây viêm đường hô hấp, nếu nặng có thể gây viêm họng mủ, viêm amiđan mủ. Nguy cơ càng cao khi có sự thay đổi nhiệt độ đột ngột, chẳng hạn như: Uống nước quá lạnh khi đang nóng hay khi đang toát mồ hôi, vừa ở ngoài trời nóng về đã tắm nước lạnh, từ bên ngoài bước ngay vào phòng lạnh hoặc ngược lại&#8230;
</p>
<p class="Normal">Đặc biệt, việc uống nước lạnh rất dễ gây viêm đường hô hấp bởi nó làm nhiệt độ ở vùng họng giảm đột ngột. Tuy nhiên, đây lại là sở thích và thói quen của nhiều người trong mùa hè. Tốt nhất chỉ nên uống nước mát vừa, nếu thích nước lạnh thì chỉ nên uống từ từ từng ngụm nhỏ.</p>
<p class="Normal"><em>- Nhiều người cho rằng việc dùng máy điều hòa nhiệt độ rất có hại cho đường hô hấp, nhất là trẻ em. Điều đó có đúng không?</em></p>
<p class="Normal">- Bởi cái nóng làm giảm sức để kháng nên việc dùng máy điều hòa vào những ngày quá nóng là cần thiết. Những ngày nóng thường đi kèm với độ ẩm cao, cơ thể rất khó tự cân bằng nên sinh ra mệt mỏi, nhất là trẻ em sẽ kém ăn, toát mồ hôi và dễ bị viêm họng.</p>
<p class="Normal">Tuy nhiên, nếu dùng điều hòa không hợp lý thì thiết bị tiện nghi này lại là yếu tố gây viêm đường hô hấp. Tránh nằm ở nơi luồng gió trực tiếp phả vào. Nhiệt độ chỉ nên để ở mức 24 độ C. Nên tạo ra một &#8220;vùng đệm&#8221; có nhiệt độ vừa phải trước khi vào hoặc ra khỏi phòng lạnh. Khi không bật máy, cần mở cửa phòng cho thoáng khí, thường xuyên vệ sinh máy lạnh để tránh nhiễm bẩn.</p>
<p class="Normal"><em>- Với những nhà không có máy điều hòa thì sao?</em></p>
<p class="Normal">- Việc dùng quạt máy giúp mọi người dễ chịu hơn nếu không có máy điều hòa. Tuy nhiên vào những ngày độ ẩm không khí cao, quạt máy không giúp được gì nhiều, dù nằm quạt vẫn ra mồ hôi. Trong trường hợp này vẫn nên dùng quạt với cường độ vừa phải, đồng thời dùng khăn lau mồ hôi thường xuyên cho trẻ. Tránh để quạt thốc gió vào mặt.</p>
<p class="Normal"><em>- Có nên tắm nước lạnh vào mùa nóng? </em></p>
<p class="Normal">- Để làm dịu cơn nóng, nhiều người bơm nước từ bể chứa ngầm dưới nền nhà để tắm, bởi nước trong bể thường mát lạnh, chỉ 8-12 độ C. Với những người khỏe mạnh đã quen rèn luyện với sự thay đổi môi trường, nước lạnh này làm họ khoan khoái. Nhưng với người yếu và trẻ em, tắm nước lạnh như vậy không tốt, dễ gây cảm hoặc viêm đường hô hấp. Tốt nhất nên tắm nước khoảng 20 độ C, nghĩa là pha nước lạnh này với nước ở bể chứa ngoài trời (nhiệt độ khoảng 30-32 độ C), hoặc dự trữ nước ở các thùng chứa trong nhà.</p>
<p class="Normal"><em>- Có nên dùng kháng sinh khi bị viêm họng, ho do nắng nóng?</em></p>
<p class="Normal"> - Có đến 90-95% trường hợp viêm đường hô hấp khi nắng nóng là do virus, chỉ 5-10% do vi khuẩn. Vì vậy với đa số bệnh nhân, việc dùng kháng sinh là vô ích, thậm chí làm tăng nguy cơ nhờn thuốc trong những lần ốm sau. Vì vậy ban đầu, chỉ nên tăng sức đề kháng bằng chế độ ăn và bổ sung sinh tố, dùng thuốc chữa triệu chứng như hạ sốt nếu sốt cao, siro ho hoặc các loại thuốc nam chữa ho nếu ho nhiều. Sau vài ngày không đỡ, nên đến bác sĩ để được chỉ định kháng sinh nếu cần. Nếu đi khám khi mới có triệu chứng, bác sĩ cũng không cho dùng kháng sinh ngay.</p>
<p class="Normal" align="right"><strong>Hải Hà</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=12&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/27/lam-gi-d%e1%bb%83-tranh-viem-h%e1%bb%8dng-khi-n%e1%ba%afng-nong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>

		<media:content url="http://vnexpress.net/Vietnam/Doi-song/2007/06/3B9F777D/24.jpg" medium="image" />
	</item>
		<item>
		<title></title>
		<link>http://firebird84vn.wordpress.com/2007/06/26/11/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/26/11/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 03:38:26 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/26/11/</guid>
		<description><![CDATA[
&#160;
Here is FireBird
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=11&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:center;"><img src="http://firebird84vn.files.wordpress.com/2007/06/sad_man.jpg" alt="sad_man.jpg" /></p>
<p style="text-align:center;" align="center">&nbsp;</p>
<p style="text-align:center;" align="center">Here is FireBird</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=11&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/26/11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>

		<media:content url="http://firebird84vn.files.wordpress.com/2007/06/sad_man.jpg" medium="image">
			<media:title type="html">sad_man.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>All out of love &#8211; Air Supply</title>
		<link>http://firebird84vn.wordpress.com/2007/06/25/all-out-of-love-air-supply/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/25/all-out-of-love-air-supply/#comments</comments>
		<pubDate>Mon, 25 Jun 2007 06:28:24 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Listen and Feel]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/25/all-out-of-love-air-supply/</guid>
		<description><![CDATA[ I am lying alone with my head on the phone
Thinking of you till it hurts
I know you&#8217;re hurt too
but what else can we do
Tormented and torn apart
I wish I could carry your smile in my heart
For times when my life seems so low
It would make me believe what tomorrow could bring
When today doesn&#8217;t really [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=9&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><font face="comic sans ms,papyrus, arial, helvetica" size="2"> I am lying alone with my head on the phone<br />
Thinking of you till it hurts<br />
I know you&#8217;re hurt too<br />
but what else can we do<br />
Tormented and torn apart</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">I wish I could carry your smile in my heart<br />
For times when my life seems so low<br />
It would make me believe what tomorrow could bring<br />
When today doesn&#8217;t really know, doesn&#8217;t really know</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">  CHORUS<br />
I&#8217;m all out of love, I&#8217;m so lost without you<br />
I know you were right, believing for so long<br />
I&#8217;m all out of love, what am I without you<br />
I can&#8217;t be too late to say that<br />
I was so wrong</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">I want you to come back and carry me home<br />
Away from this long lonely nights<br />
I&#8217;m reaching for you, are you feeling it too<br />
Does the feeling seem oh, so right</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">And what would you say if I called on you now<br />
And said that I can&#8217;t hold on?<br />
There&#8217;s no easy way, it gets harder each day<br />
Please love me or I&#8217;ll be gone, I&#8217;ll be gone</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">CHORUS</font></p>
<p><font face="comic sans ms,papyrus, arial, helvetica" size="2">Ooh, what are you thinking of<br />
What are you thinking of<br />
What are you thinking of<br />
what are you thinking of </font></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=9&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/25/all-out-of-love-air-supply/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>Love, Works and Nothing</title>
		<link>http://firebird84vn.wordpress.com/2007/06/25/love-works-and-nothing/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/25/love-works-and-nothing/#comments</comments>
		<pubDate>Mon, 25 Jun 2007 05:45:12 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[My Stories]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/25/love-works-and-nothing/</guid>
		<description><![CDATA[Today, it is a bad day with me.
Why? Why do someone say  about that with me?  They don&#8217;t understand or really want that. I don&#8217;t know.
What? What happen with me in  a new day? I  don&#8217;t know.
But i am happy  beacause of having some good friends who really understand and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=6&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today, it is a bad day with me.<br />
Why? Why do someone say  about that with me?  They don&#8217;t understand or really want that. I don&#8217;t know.<br />
What? What happen with me in  a new day? I  don&#8217;t know.</p>
<p>But i am happy  beacause of having some good friends who really understand and share my troubles.</p>
<p>Tonight, i have a meeting with my old friend. Hopefully, It is better.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=6&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/25/love-works-and-nothing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
		<item>
		<title>Ngư ông &amp; Thương gia (Marketing Magazine)</title>
		<link>http://firebird84vn.wordpress.com/2007/06/23/ng%c6%b0-ong-th%c6%b0%c6%a1ng-gia-marketing-magazine/</link>
		<comments>http://firebird84vn.wordpress.com/2007/06/23/ng%c6%b0-ong-th%c6%b0%c6%a1ng-gia-marketing-magazine/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 14:25:57 +0000</pubDate>
		<dc:creator>firebird84vn</dc:creator>
				<category><![CDATA[Business Stories]]></category>

		<guid isPermaLink="false">http://firebird84vn.wordpress.com/2007/06/23/ng%c6%b0-ong-th%c6%b0%c6%a1ng-gia-marketing-magazine/</guid>
		<description><![CDATA[Chuyện kể rằng có 1 ngư ông nằm dài thư giãn trên bãi biển. Một thương gia giàu có nổi tiếng đi ngang qua, nhiền thầy bèn hỏi chuyện ngư ông: &#8220;Tại sao ông lại nằm đây, ông không đi làm, ông không thấy bao nhiêu người đổ mồ hôi sôi nước mắt làm việc [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=5&subd=firebird84vn&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Chuyện kể rằng có 1 ngư ông nằm dài thư giãn trên bãi biển. Một thương gia giàu có nổi tiếng đi ngang qua, nhiền thầy bèn hỏi chuyện ngư ông: &#8220;Tại sao ông lại nằm đây, ông không đi làm, ông không thấy bao nhiêu người đổ mồ hôi sôi nước mắt làm việc ngoài kia đó sao ?&#8221;.<br />
Ngư ông bình thản hỏi lại: &#8220;Thế theo ông làm việc vất vả để làm gì ?&#8221;.<br />
Thương gia rất ngạt nhiên: &#8220;Ông thật là lạ, làm việc thì mới có tiền&#8221;.<br />
Người ngư phủ vẫn với giọng nói như vậy: &#8220;Vậy thế ông kiếm được tiền rồi để làm gì&#8221;.<br />
Người thương gia bắt đầu cảm thấy khó chịu nhưng vẫn có gắng trả lời: &#8220;Tôi thật chưa gặp ai như ông, có tiền ông có thể mua được mọi thứ: nhà cửa, xe hơi, đi du lịch,&#8230; Chẳng lẻ ông chưa bao giờ nghĩ đến nó&#8221;.<br />
&#8220;Tôi biết nhưng tại sao ông lại thích được tất cả những thứ đó ?&#8221; &#8211; Ngư ông nói.<br />
Thương gia cảm thấy tức giận và trả lời: &#8220;Ừ thì ông cứ nằm đẩy thư giãn thoải mái, ông có thể nằm dài trên bãi biển mà chẳng phải lo nghĩ gì&#8221;.<br />
Ngư ông trả lời:&#8221;Thế ông không thấy tui nằm rất xung sướng và thoải mái đó sao!&#8221;.</p>
<p>Trong đời, nhiều người nghĩ họ sẽ hạnh phúc, vui vẻ khi có được nhiều của cải vật chất và họ mãi mê kiếm tìm nó trong quá khứ, hiện tại và tương lai. Tuy nhiên, nếu dành 1 chút thời gian dừng lại và quan sát những gì mình đang có họ sẽ thấy ngay niềm hạnh phúc đơn giản mà quá khứ họ đã kiếm tìm được. Hiện tại là tương lai của quá khứ và là quá khứ của tương lai, nếu chúng ta bỏ qua hiện tại thì ngây lập tức chúng ta mất cả quá khứ lẫn tương lai, đồng nghĩa với việc chúng ta mất đi hạnh phúc. Có 1 câu rất hay: &#8220;<em>Hãy sống từng ngày trọn vẹn, trân quý những người ngay bên cạnh mình, những thứ mình đang có và yêu cuộc sống mình hơn</em>&#8220;.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/firebird84vn.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/firebird84vn.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/firebird84vn.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/firebird84vn.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/firebird84vn.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/firebird84vn.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/firebird84vn.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/firebird84vn.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/firebird84vn.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/firebird84vn.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/firebird84vn.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/firebird84vn.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=firebird84vn.wordpress.com&blog=1069990&post=5&subd=firebird84vn&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://firebird84vn.wordpress.com/2007/06/23/ng%c6%b0-ong-th%c6%b0%c6%a1ng-gia-marketing-magazine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/398741d3a6b8beddeb1f0cf3971b706a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">firebird84vn</media:title>
		</media:content>
	</item>
	</channel>
</rss>