<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>techcosupport.com &#187; Redirect</title>
	<atom:link href="http://techcosupport.com/press/tag/redirect/feed/" rel="self" type="application/rss+xml" />
	<link>http://techcosupport.com/press</link>
	<description>Techco Support Site - Helping your business grow through Technology, Training and Coaching</description>
	<lastBuildDate>Fri, 30 Dec 2011 10:40:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Make sure you exit after a PHP Header Location</title>
		<link>http://techcosupport.com/press/make-sure-you-exit-after-a-php-header-location/</link>
		<comments>http://techcosupport.com/press/make-sure-you-exit-after-a-php-header-location/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 21:51:39 +0000</pubDate>
		<dc:creator>bgt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Redirect]]></category>

		<guid isPermaLink="false">http://techcosupport.com/press/?p=304</guid>
		<description><![CDATA[<p>We came accross a bug in a bot filtering page the other day. The page called a routine which used a regular expression to check for validly formatted input. The function was called from several places and worked fine. In just one branch it appeared to fail to validate the input, and continued execution of <span style="color:#777"> . . . &#8594; Read More: <a href="http://techcosupport.com/press/make-sure-you-exit-after-a-php-header-location/">Make sure you exit after a PHP Header Location</a></span>]]></description>
			<content:encoded><![CDATA[<p>We came accross a bug in a bot filtering page the other day.  The page called a routine which used a regular expression to check for validly formatted input.  The function was called from several places and worked fine.  In just one branch it appeared to fail to validate the input, and continued execution of the page instead of redirecting to the   target page.</p>
<p>The reason?   Someone left out the exit; after the Header Location call, which allows the execution to continue down the page.  Moral:  Make sure you call <strong>exit</strong> after a PHP Header call to Location if you want execution to branch immediately!</p>
<p><code><?php<br />
if (InvalidInput($Stuff))<br />
  {<br />
    header("Location: http://www.example.com/"); /* Redirect browser */<br />
    exit; /* Make sure that code below does not get executed when we redirect. */<br />
  }<br />
/* Execute on valid input */<br />
?></code></p>
<div align="right" style="float: right; padding: 5px 0px 0px 5px;"><a name="fb_share" type="button" share_url="http://techcosupport.com/press/make-sure-you-exit-after-a-php-header-location/"></a><div style="display:none;"><a href="http://government-politics.forum1000.com">government,politics</a>&nbsp;<a href="http://news365live.com">news,politics</a>&nbsp;<a href="http://worldnews365online.com">news,politics</a></div></div>]]></content:encoded>
			<wfw:commentRss>http://techcosupport.com/press/make-sure-you-exit-after-a-php-header-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

