<?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>brantheory &#187; tips</title>
	<atom:link href="http://www.brantheory.com/tag/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brantheory.com</link>
	<description>theory of a living man</description>
	<lastBuildDate>Tue, 17 Feb 2009 21:42:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Map Tip: Prevent direct linking to your XML data</title>
		<link>http://www.brantheory.com/2009/02/13/google-map-tip-prevent-direct-linking-to-your-xml-data/</link>
		<comments>http://www.brantheory.com/2009/02/13/google-map-tip-prevent-direct-linking-to-your-xml-data/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 05:08:55 +0000</pubDate>
		<dc:creator>bran</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.brantheory.com/?p=169</guid>
		<description><![CDATA[I have been recently working on a project integrating Google Maps API. It&#8217;s pretty straight forward and Google provides an excellent documention.  After working with the API and developing the custom mapping application, I noticed that the implemention exposes the name of the data file (xml, csv, text, etc) in the JavaScript code, example below [...]]]></description>
			<content:encoded><![CDATA[<p>I have been recently working on a project integrating <a href="http://code.google.com/apis/maps/">Google Maps API</a>. It&#8217;s pretty straight forward and Google provides an excellent documention.  After working with the API and developing the custom mapping application, I noticed that the implemention exposes the name of the data file (xml, csv, text, etc) in the JavaScript code, example below (can be seen by viewing page source):</p>
<pre>        <strong>GDownloadUrl("address.xml", function(data) {</strong>
...
)}</pre>
<p>Notice the bold area. &#8220;address.xml&#8221; is the file that contains all the xml data that has been collected and organized. I can pretty much download the file by entering in my address bar:  http://root url/address.xml. Voila, I have basically ripped off someone else&#8217;s data to be used as I see fit. Perhaps to create my own map!</p>
<p>I personally do not want to expose the location of my data file and allow others to download it.  To get around this issue, I have implemented a simple solution.</p>
<p>Rather than &#8220;address.xml&#8221;, I have created a new separate .php file. Let&#8217;s call it address.php. In that file, I check the referrer information to ensure that the request comes from the proper location. If it does, write the xml contents. If not, redirect them somewhere else.</p>
<pre>&lt;?php

    // prevent direct linking to xml files

 if($_SERVER['HTTP_REFERER'] != '') {

          $xml_string = file_get_contents("xml_location/address.xml");

        echo $xml_string;  

 }else{    
     // redirect them somewhere if they try to direct link to this page
      header( 'Location: http://www.google.com' ) ;

 }

?&gt;</pre>
<p>For the Google map, replace xml file with php file<strong> </strong></p>
<p>GDownloadUrl(&#8220;<strong>address.xml</strong>&#8220;, function(data) {  to:  GDownloadUrl(&#8220;<strong>address.php</strong>&#8220;, function(data) {</p>
<p>Simple as that. So if a curious viewer decides to enter &#8220;address.php&#8221; into there browser, they won&#8217;t get any data, just be redirected to some location you decide on.</p>
<p>There are also other ways to do this but IMO this is probably the simplilest and most effective.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brantheory.com/2009/02/13/google-map-tip-prevent-direct-linking-to-your-xml-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Always use server side scripting extensions</title>
		<link>http://www.brantheory.com/2009/02/04/always-use-server-side-scripting-extensions/</link>
		<comments>http://www.brantheory.com/2009/02/04/always-use-server-side-scripting-extensions/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:53:57 +0000</pubDate>
		<dc:creator>bran</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.brantheory.com/?p=164</guid>
		<description><![CDATA[Just a quick tip for all the web designers/developers who do not really program in a scripting language (php, asp, jsp, etc) and mainly stick with HTML (client-side scripting). Assuming your server handles it, when creating your page, always use the server-side scripting (.php, .jsp, etc), and don&#8217;t use .html. Even if don&#8217;t plan on [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick tip for all the web designers/developers who do not really program in a scripting language (php, asp, jsp, etc) and mainly stick with HTML (<a href="http://en.wikipedia.org/wiki/Client-side_scripting">client-side scripting</a>). Assuming your server handles it, when creating your page, always use the <a href="http://en.wikipedia.org/wiki/Server-side_scripting">server-side scripting</a> (<strong>.php, .jsp, etc</strong>), and don&#8217;t use <strong>.html</strong>. Even if don&#8217;t plan on adding or perhaps never will add any server side code to your page.</p>
<p>Why should you do this even though you don&#8217;t actually utilize any programming on the page?</p>
<ul>
<li><strong>Browsers cache pages.</strong> if a returning visitor comes back to that same page and you&#8217;ve made some changes to that page, that person may not see the change. They will only see their saved cache version. Yes there&#8217;s meta tags and tricks to try to get around it but it&#8217;s not guaranteed and not a very elegant solution. Server side scripting pages always serve up the latest content because when viewed because at each call to the page, the</li>
<li><strong>Don&#8217;t pigeon hole yourself</strong>. You never know when you may actually use some scripting on the page. If you suddenly need to add some scripting in the future, you&#8217;ll have to delete that page and create a brand new one.  Say goodbye to any links you&#8217;ve established with the client-side language pages.</li>
<li><strong>More powerful, flexible and gives you room to grow and learn. </strong>Similar to the above, it just gives you more options. Simple as that. It can also inspire you to learn some programming and more creative/advanced techniques in regards to web development.</li>
</ul>
<p>In my opinion, creating standard client-side .html pages is basically useless nowadays and prevents your site from growing.</p>
<p>Special thanks to <a href="http://freddie.ca">freddie.ca</a> who inspired me to post this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brantheory.com/2009/02/04/always-use-server-side-scripting-extensions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
