<?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"
	>

<channel>
	<title>Binary Systems Design</title>
	<atom:link href="http://binarysysdesign.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://binarysysdesign.com</link>
	<description>Development &#38; Contracting</description>
	<pubDate>Wed, 02 Jul 2008 16:05:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Flash files will be indexed by search engines</title>
		<link>http://binarysysdesign.com/2008/07/02/flash-files-will-be-indexed-by-search-engines/</link>
		<comments>http://binarysysdesign.com/2008/07/02/flash-files-will-be-indexed-by-search-engines/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 16:05:36 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Search Engines]]></category>

		<guid isPermaLink="false">http://binarysysdesign.com/?p=16</guid>
		<description><![CDATA[I&#8217;ll preface this post by saying I&#8217;m not a fan of flash. I think flash has a place but is often over used. I chose to label it as over used instead of abused. The abuse has yet to come, but I&#8217;ll get to that. Flash is good for displaying video&#8217;s, music and of course [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll preface this post by saying I&#8217;m not a fan of flash. I think flash has a place but is often over used. I chose to label it as over used instead of abused. The abuse has yet to come, but I&#8217;ll get to that. Flash is good for displaying video&#8217;s, music and of course those browser based flash games that can suck an hour out of your life. Using flash for banners can be useful as well.</p>
<p>With the exception of websites devoted to TV shows, movies or other multimedia as soon as I see the &#8220;loading&#8221; screen for a website developed completely in flash I close the window. One of my biggest arguments against the use of a flash based website was the fact that search engines could not index the content and therefore suffer with lower rankings. This is no longer the case.</p>
<p>As of this week google announced that it now has the ability to <a href="http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html">crawl flash files</a> and index the content. This new feature does not belong soley to google. Adobe released the technology to yahoo as well as google.</p>
<p>As per anything that occurs on the internet this opens new doors for abuse. Search engines will have to find a way to determine legitmate content from black hat SEO practices that include spamming hidden content in an attempt to gain higher search engine positions. You can bet right now there are people that are developing sites using this practice. I think at first they will benefit from these practices and change search engine rankings. Sooner or later the search engines will catch up with them and blacklist those websites (remove them from the index all together).</p>
]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/07/02/flash-files-will-be-indexed-by-search-engines/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How much information should you store online?</title>
		<link>http://binarysysdesign.com/2008/05/30/how-much-information-should-you-store-online/</link>
		<comments>http://binarysysdesign.com/2008/05/30/how-much-information-should-you-store-online/#comments</comments>
		<pubDate>Fri, 30 May 2008 21:07:57 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Industry News]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://binarysysdesign.com/?p=15</guid>
		<description><![CDATA[Putting all of your online information in one place may not be a good idea. A golden rule for financial investment is to make sure your portfolio is diversified. Diversification will protect you if one area of your portfolio does not perform as it should. What does this have to do with storing information online? [...]]]></description>
			<content:encoded><![CDATA[<p>Putting all of your online information in one place may not be a good idea. A golden rule for financial investment is to make sure your portfolio is diversified. Diversification will protect you if one area of your portfolio does not perform as it should. What does this have to do with storing information online? I will focus on three services that aggregate data for a one stop source of information.</p>
<p><span id="more-15"></span></p>
<p><strong><a href="http://google.com/health">Google Health</a></strong></p>
<p>Earlier this week google announced the deployment of their new service that pulls all of your health information to one place under your google login. Maybe on first glance this sounds like a great idea. All of your health records, prescription information in one digital location. Lets forget for a moment the massive amount of information that google gathers everyday. Google employs the best and brightest for security but nothing is 100% secure. It only takes mistake and your information could be anywhere. Most likely the biggest threat comes from the user with poor password selection and management. Google has also teamed up with affiliates to offer a broader range of services such as faxing your health records to your doctor, managing your families health history and prescription management. All of these services linked to your google account. Is this the kind of information you want to store in one place?</p>
<p><strong><a href="http://openid.net">OpenId</a></strong></p>
<p>How many login names and passwords do you have strung across the internet. A blog here, a forum there, bank accounts, shopping. To sign up for just about any service you have to create an account. OpenId is a movement to decrease the amount of online forms you have to fill out to create an account.</p>
<p>From their website</p>
<blockquote><p>&#8220;OpenID eliminates the need for multiple usernames across different websites, simplifying your online experience.</p>
<p>You get to choose the OpenID Provider that best meets your needs and most importantly that you trust. At the same time, your OpenID can stay with you, no matter which Provider you move to. And best of all, the OpenID technology is not proprietary and is completely free.</p>
<p>For businesses, this means a lower cost of password and account management, while drawing new web traffic. OpenID lowers user frustration by letting users have control of their login.</p>
<p>For geeks, OpenID is an open, decentralized, free framework for user-centric digital identity. OpenID takes advantage of already existing internet technology (URI, HTTP, SSL, Diffie-Hellman) and realizes that people are already creating identities for themselves whether it be at their blog, photostream, profile page, etc. With OpenID you can easily transform one of these existing URIs into an account which can be used at sites which support OpenID logins.&#8221;</p></blockquote>
<p>The way it works you sign up for an openID from a provider and instead of using a user name and password for each account you use your single openID URL to login to multiple sites. There is a <a href="http://idcorner.org/2007/08/22/the-problems-with-openid/">great article here</a> that sums up all the potential problems of using openID. In a nutshell this could potentially open you up to multiple types of attacks such as phishing and cross site scripting that will allow someone access to all of your accounts. By using a provider you are also telling that provider every site you access.</p>
<p>I think openID has some very valid applications if used properly. First by hosting your own openID URI and bypassing the providers it gives you more control. Secondly if you are using openID for fairly benign tasks like blogs and forums that do not contain any sensitive information it reduces your risk to an exploit.</p>
<p><strong><a href="http://www.mint.com/">Mint Personal Finance Managment</a></strong></p>
<p>This is just one of several online financial management services that caught my eye. I&#8217;m always looking for a way to not buy another version of quicken and forever remove windows from my hard drive. The best part about this software is its free! Yep,  <a href="http://www.newlinuxuser.com/explain-what-does-free-as-in-beer-and-free-as-in-speech-mean/">free as in beer</a>.</p>
<p>This service pulls all of your financial information to one location. It helps you budget, sends emails when accounts are low and even tells you where you can save money. The service also lets you compare your spending habits with others in the same area. It does this all online through your browser via a simple interface.</p>
<p>How is this free? Mint gets their revenue through affiliates that offer you savings alternatives. For example you spent &#8220;x&#8221; amount of money &#8220;here&#8221; last month, if you shop &#8220;here&#8221; instead we can save you &#8220;x&#8221; amount per month and &#8220;x&#8221; amount per year.</p>
<p>The problem with having all your financial information in one location should be fairly obvious. Regardless the company seems to be doing well with no shortage of users. The other side of the argument is that unless you store your financial information in some type of encrypted format on your local machine you are probably more venerable to a security problem than using a service like this. This is undoubtedly true. If your bank has a security problem they are responsible for your money. In most cases by using this service you have removed them from responsibility.</p>
<p>I&#8217;ll have to admit this service looks amazing but it also looks like a target. I&#8217;ll be watching them closely as my quicken software draws closer to reaching the &#8220;you must buy another version&#8221; point.</p>
<p><strong>Conclusion</strong></p>
<p>Have you ever seen the <a href="http://binarysysdesign.com/wp-admin/http:www.lifelock.com">Life Lock</a> commercial with the CEO driving around new york city, his SSN plastered to a billboard behind a truck? Yeah he got his identity stolen. Nothing is 100% secure and you have to weight the benefits to the risks. Google health? No way, not for me. Its just far too much information in one location and not just my health records. OpenID? Yes, I think it has its applications if done correctly although I have yet to use it myself. Online financial management? The service just looks too good for me to give it a thumbs down. My inner dork is overpowering my paranoia on this one.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/05/30/how-much-information-should-you-store-online/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Charter is going to spy on you for &#8220;enhanced online expierence&#8221;</title>
		<link>http://binarysysdesign.com/2008/05/15/charter-is-going-to-spy-on-you-for-enhanced-online-expierence/</link>
		<comments>http://binarysysdesign.com/2008/05/15/charter-is-going-to-spy-on-you-for-enhanced-online-expierence/#comments</comments>
		<pubDate>Thu, 15 May 2008 15:33:58 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Industry News]]></category>

		<category><![CDATA[ISP]]></category>

		<category><![CDATA[privacy]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://binarysysdesign.com/?p=14</guid>
		<description><![CDATA[I have never been a big fan of charter communications deplorable service but until now they had been just one of more than a handful of large companies that take my money and waste my time. This latest move is far beyond poor service and lack of customer support. It seems charter is making a [...]]]></description>
			<content:encoded><![CDATA[<p>I have never been a big fan of charter communications deplorable service but until now they had been just one of more than a handful of large companies that take my money and waste my time. This latest move is far beyond poor service and lack of customer support. It seems charter is making a move to spy on their costumers in order to increase revenues through targeted advertisements. I stumbled across this <a href="http://yro.slashdot.org/yro/08/05/13/1832256.shtml">slashdot article</a>. You can find more information <a href="http://consumerist.com/5008801/charter-to-begin-tracking-users-searches-and-inserting-targeted-ads">here</a>.</p>
<p><span id="more-14"></span></p>
<p>Charter is not the first ISP to play this game, a company named <a href="http://news.bbc.co.uk/2/hi/technology/7299875.stm">Phorm</a> is already testing this technology in the UK. The implications of this type of data mining are wide.</p>
<p>Imagine every move you make on the internet not only being tracked but software anticipating what you might be looking for based on your history. The first and most obvious issue here is privacy. This has been compared to telephone companies listening to your conversations to decide what type of junk mail to send you.</p>
<p>A more realistic comparison equates this to listening to your phone conversation, going through your junk mail and pasting their own advertisements over the top. For example you go to visit a blog or a news article, charter will intercept that data and add their own over the top of what is being retrieved from the server. The internet is not only being monitored, and logged but also being manipulated before the content reaches you.</p>
<p>Not only does this become a privacy concern but it is also stepping on the toes of other advertising affiliates. The two biggest ways to discourage charter and other ISP&#8217;s from engaging in this activity is changing your ISP and lawsuits. For me personally I would love to see google lead the way to deter this type of behavior. With the majority of their income coming through targeted advertising they stand to lose allot.</p>
<p>In all honesty your ISP knows what web sites you visit already. When you put an address the request goes to your ISP&#8217;s DNS (domain name server) by default to route your request to the proper web page. If you have charter you have already seen this action if you misspell a domain name that doesn&#8217;t exist. Charter brings up their own not so helpful recommendations for your failed attempts. You can bet they make money off of this as well. You can bypass their DNS servers by setting going through <a href="http://www.opendns.com/">OpenDNS</a></p>
<p>In the past I have not paid too much attention to the hype of traveling the internet anonymously. These types of &#8220;services&#8221; is causing me to think twice. Another project that makes it hard to track movements is the <a href="http://www.torproject.org/">Tor Project</a>. &#8220;Tor is a software project that helps you defend against traffic analysis, a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security.[from the tor website]&#8221;</p>
<p>The above methods help keep your activities your own. Another easier step is to just block the ads as they come to your browser. If you use firefox (and you should) there is a simple plugin called <a href="https://addons.mozilla.org/en-US/firefox/addon/10">Adblock</a> that will stop adverts from being displayed.</p>
<p>Just another reason to be glad I canceled my cable subscription.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/05/15/charter-is-going-to-spy-on-you-for-enhanced-online-expierence/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Protect your forms from hijackers</title>
		<link>http://binarysysdesign.com/2008/05/01/protect-your-forms-from-hijackers/</link>
		<comments>http://binarysysdesign.com/2008/05/01/protect-your-forms-from-hijackers/#comments</comments>
		<pubDate>Thu, 01 May 2008 19:08:13 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://binarysysdesign.com/?p=13</guid>
		<description><![CDATA[The topic of protecting your forms from spammers looking to hijack your form mail is old and has been kicked around extensively . As a relatively new developer (2 years at the time of writing) I remember looking for a quick easy solution to protect form mails, so here it is.

A large portion of the [...]]]></description>
			<content:encoded><![CDATA[<p>The topic of protecting your forms from spammers looking to hijack your form mail is old and has been kicked around extensively . As a relatively new developer (2 years at the time of writing) I remember looking for a quick easy solution to protect form mails, so here it is.</p>
<p><span id="more-13"></span></p>
<p>A large portion of the spam found on the internet runs through ISPs in China. So not only are they doing a wonderful job at adding large amounts of lead to consumer products they are also responsible for hosting those wonderful messages that greet you in your inbox. One of the most notorious of these ISP&#8217;s is chinanet.</p>
<p>Because reputable hosting companies do not allow spam to go through their mail servers the spammers  use your own php mail forms to send their wonderful greetings across the globe. Some of them are sophisticated enough to only send a small portion of mail through your form each day to keep the hosting company from flagging it. Once they find your unsecured form they will not let up.</p>
<p>They achieve this by injecting their own headers into your text fields to include a list of recipients and the message. The easiest way to prevent them from doing this is to check the fields for strings used to add these headers with a regular expression. What we are looking for are newline characters, hard returns, their coded equivalents, content-type, to:, cc: and bcc:.</p>
<p>We simply create a function that checks for these inputs and stops the script.</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">function</span> fieldCheck<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$data</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066;">eregi</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;(%0A|%0D|<span style="color: #000099; font-weight: bold;">\n</span>+|<span style="color: #000099; font-weight: bold;">\r</span>+)(content-type:|to:|cc:|bcc:)&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$data</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000066;">die</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Sorry, no spammers allowed.'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Now for each field text field you have in your mail form you simply run the variable through this function. For example you will probably have at least two text fields for the user to enter their name and email address.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></span>
&nbsp;
Name:
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
Email:
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;msg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span></pre></div></div>

<p>Now before the mail() function is called we check for those characters with the fieldCheck() function we just created. Now if any of those characters present the script stops.</p>

<div class="wp_syntax"><div class="code"><pre class="php">fieldCheck<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
fieldCheck<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$mail</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// run your mail function</span></pre></div></div>

<p>Don&#8217;t try to run the fieldCheck() function on the text area data. It will fail if a user hits a hard return for a new paragraph. You can check this data by creating another function that does not check for newlines and hard returns &#8220;%0A|%0D|\n+|\r+&#8221; and only check for the &#8220;content-type:|to:|cc:|bcc:&#8221;</p>
<p>So it would look like this &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">function</span> fieldCheck<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$data</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066;">eregi</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;(%0A|%0D|<span style="color: #000099; font-weight: bold;">\n</span>+|<span style="color: #000099; font-weight: bold;">\r</span>+)&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$data</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000066;">die</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Sorry, no spammers allowed.'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/05/01/protect-your-forms-from-hijackers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP to upload, resize and store multiple images.</title>
		<link>http://binarysysdesign.com/2008/04/14/php-to-upload-resize-and-store-multiple-images/</link>
		<comments>http://binarysysdesign.com/2008/04/14/php-to-upload-resize-and-store-multiple-images/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 18:48:48 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[image upload]]></category>

		<guid isPermaLink="false">http://binarysysdesign.com/?p=12</guid>
		<description><![CDATA[Here is a PHP script sample that uploads multiple images, resizes the images, creates a thumbnail and stores the image pathname with descriptions in a MySQL database. The original code is modified from this example here. The major differences are the quality of images stored and the ability to store multiple images as well as [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a PHP script sample that uploads multiple images, resizes the images, creates a thumbnail and stores the image pathname with descriptions in a MySQL database. The original code is modified from this example <a href="http://www.weberdev.com/get_example-3938.html">here</a>. The major differences are the quality of images stored and the ability to store multiple images as well as a thumbnail.</p>
<p><span id="more-12"></span></p>
<p>For this script I&#8217;m storing the information in two separate tables. One table contains the description attributes of the image (address, price, listing number and description) with the thumbnail path and attributes (width and height). The other table contains only the images used for the slide show. The example I&#8217;m using here is to upload real estate listings. By having one table with the main images and the other table with the description and thumbnail attributes you can easily add more images to any listing.</p>
<p>This is just an example of the script and assumes a couple things. It assumes you have validated the user, and the input to keep your database safe. It also assumes you are using only .jpg images and does not restrict the size. As always, validate and clean your information before upload.</p>
<p>The first thing we need is our form for uploading the images. For this example we are going to upload 5 images of a real estate listing the MLS number(id), address, price and property description. I broke it up into two files pre-upload.php and upload.php.</p>
<p>pre-upload.php</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload.php&quot;</span> <span style="color: #000066;">enctype</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;multipart/form-data&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
MLS Number:
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mls&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
Address:
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;address&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
Price:
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;price&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload0&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload1&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload2&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload3&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;max_file_size&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2000000&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload5&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span></pre></div></div>

<p>While we added a max value size of 2mb&#8217;s to the form input this should not be used as a max size validation as the user will not get any type of error message for values above 2mb. The first image &#8220;upload0&#8243; will be the image that is stored twice, once as thumbnail and once as a regular image.</p>
<p>The real work comes in upload.php. Make sure you chmod777 the folder you are going to use to upload the images.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</pre></td><td class="code"><pre class="php"><span style="color: #808080; font-style: italic;">// connect to the database with your preferred method</span>
<span style="color: #808080; font-style: italic;">// now lets list the variables</span>
<span style="color: #ff0000">$mls</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'mls'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$address</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'address'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$price</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'price'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$description</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'description'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// width and height max values for the main images. Its best to set</span>
<span style="color: #808080; font-style: italic;">// them both at the same value or you will end up with distorted images</span>
<span style="color: #808080; font-style: italic;">// if you upload both landscape and portrait layouts.</span>
<span style="color: #ff0000">$width</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'640'</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$height</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'640'</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// Here we set the name and path for the thumbnails. I chose to put the thumbs</span>
<span style="color: #808080; font-style: italic;">// and the main images in separate folders based on their unique MLS number.</span>
<span style="color: #ff0000">$thumbName</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;images/$mls/thumb.jpg&quot;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// Set the thumb max width and height</span>
<span style="color: #ff0000">$twidth</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'250'</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$theight</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'250'</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//first I want to make sure they actually posted an MLS number or we reject it</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'mls'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066;">die</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;
&nbsp;
You didn't enter a MLS number. Please go back
&nbsp;
&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//now lets make sure this folder doesn't already exist so its not written over</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">file_exists</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;images/$mls&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066;">die</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;
&nbsp;
You are trying to add a listing that already exists
&nbsp;
&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// so far so good lets create the directory on the server and assign the filename</span>
<span style="color: #ff0000">$oldmask</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">umask</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">mkdir</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;images/$mls&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0777</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">umask</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$oldmask</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$ext</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'.jpg'</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$fileName</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;images/$mls/&quot;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// now we will check to see if there is a file, if there is we will put it in an array</span>
<span style="color: #808080; font-style: italic;">// for processing. If there is a file we are going to number them 0-5</span>
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$i</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$i</span><span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$i</span><span style="color: #66cc66;">++</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #000066;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;upload$i&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
     <span style="color: #ff0000">$pic</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000">$i</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;upload$i&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// count the total number of pictures to be resized, uploaded and stored</span>
<span style="color: #ff0000">$totalPics</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">count</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$pic</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// now lets loop the process for each file</span>
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$i</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$i</span><span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span><span style="color: #ff0000">$totalPics</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$i</span><span style="color: #66cc66;">++</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #808080; font-style: italic;">// here is where you can do some file checking for example lets make sure its a .jpg.</span>
  <span style="color: #808080; font-style: italic;">// This would also be a good place to check the file size.</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #000066;">eregi</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'^image/p?jpeg(;.*)?$'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;upload$i&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'type'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
     <span style="color: #808080; font-style: italic;">// we already made the directory so lets make sure we remove it before we kill</span>
     <span style="color: #808080; font-style: italic;">// the script.</span>
    <span style="color: #000066;">rmdir</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;images/$mls&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #000066;">die</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;
&nbsp;
Sorry, this was not a .jpg file
&nbsp;
&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #808080; font-style: italic;">// The images met whatever conditions you set so we move forward.</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">is_uploaded_file</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;upload$i&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> and
    <span style="color: #000066;">copy</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;upload$i&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">&quot;$fileName$i$ext&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
      <span style="color: #808080; font-style: italic;">// find the dimensions</span>
      <span style="color: #ff0000">$simg</span> <span style="color: #66cc66;">=</span> imagecreatefromjpeg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$fileName&quot;</span> <span style="color: #66cc66;">.</span><span style="color: #ff0000;">&quot;$i&quot;</span><span style="color: #66cc66;">.</span> <span style="color: #ff0000;">&quot;$ext&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #ff0000">$currwidth</span> <span style="color: #66cc66;">=</span> imagesx<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$simg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #ff0000">$currheight</span> <span style="color: #66cc66;">=</span> imagesy<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$simg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #808080; font-style: italic;">// if its a portrait layout lets set the max height</span>
      <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$currheight</span><span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span><span style="color: #ff0000">$currwidth</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$zoom</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$width</span><span style="color: #66cc66;">/</span><span style="color: #ff0000">$currheight</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$newheight</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$height</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$newwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$currwidth</span><span style="color: #66cc66;">*</span><span style="color: #ff0000">$zoom</span><span style="color: #66cc66;">;</span>
      <span style="color: #66cc66;">&#125;</span>
      <span style="color: #808080; font-style: italic;">// if its a landscape</span>
      <span style="color: #b1b100;">else</span>
      <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$zoom</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$width</span><span style="color: #66cc66;">/</span><span style="color: #ff0000">$currwidth</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$newwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$width</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$newheight</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$currheight</span><span style="color: #66cc66;">*</span><span style="color: #ff0000">$zoom</span><span style="color: #66cc66;">;</span>
      <span style="color: #66cc66;">&#125;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;">// Alright we have the dimensions sorted out now lets build the image. Using</span>
      <span style="color: #808080; font-style: italic;">// imagecreatetruecolor() instead of imagetruecolorpalette() gives us a better</span>
      <span style="color: #808080; font-style: italic;">// resolution</span>
      <span style="color: #ff0000">$dimg</span> <span style="color: #66cc66;">=</span> imagecreatetruecolor<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$newwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$newheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #ff0000">$palsize</span> <span style="color: #66cc66;">=</span> imagecolorstotal<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$simg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$e</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$e</span><span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span><span style="color: #ff0000">$palsize</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$e</span><span style="color: #66cc66;">++</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$colors</span> <span style="color: #66cc66;">=</span> imagecolorsforindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$simg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$e</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$imagecolorallocate</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$dimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'red'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'green'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'blue'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #66cc66;">&#125;</span>
      imagecopyresized<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$dimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$simg</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$newwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$newheight</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$currwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$currheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #808080; font-style: italic;">// here is where you can set the quality I set it to 90 so they end up being fairly large</span>
      imagejpeg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$dimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">&quot;$fileName&quot;</span> <span style="color: #66cc66;">.</span><span style="color: #ff0000;">&quot;$i&quot;</span><span style="color: #66cc66;">.</span> <span style="color: #ff0000;">&quot;$ext&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">90</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      imagedestroy<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$simg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      imagedestroy<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$dimg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;">// Round off the width and height attributes so we can store it in the database</span>
      <span style="color: #ff0000">$newheight</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$newheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
      <span style="color: #ff0000">$newwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$newwidth</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;">// now lets add the main images to the database</span>
      <span style="color: #ff0000">$sql</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;INSERT INTO images SET
                filename='$fileName$i$ext',
                width='$newwidth',
                height='$newheight'
                &quot;</span><span style="color: #66cc66;">;</span>
&nbsp;
      <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">mysql_query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$sql</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;images uploaded and resized&quot;</span><span style="color: #66cc66;">;</span>
      <span style="color: #66cc66;">&#125;</span>
      <span style="color: #b1b100;">else</span>
      <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;error uploading and resizing images&quot;</span><span style="color: #66cc66;">;</span>
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// lets do it all again for the thumbnail images</span>
<span style="color: #808080; font-style: italic;">// The first image in the upload form &quot;upload0' will be the image we turn into a thumb.</span>
<span style="color: #808080; font-style: italic;">// I added a &quot;t&quot; to all the thumbnail variables</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">is_uploaded_file</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'upload0'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> and
<span style="color: #000066;">copy</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$_FILES</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'upload0'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'tmp_name'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">&quot;$thumbName&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #ff0000">$tsimg</span> <span style="color: #66cc66;">=</span> imagecreatefromjpeg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$thumbname&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #ff0000">$tcurrwidth</span> <span style="color: #66cc66;">=</span> imagesx<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tsimg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tcurrheight</span><span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span><span style="color: #ff0000">$tcurrwidth</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #ff0000">$tzoom</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$twidth</span><span style="color: #66cc66;">/</span><span style="color: #ff0000">$tcurrheight</span><span style="color: #66cc66;">;</span>
    <span style="color: #ff0000">$tnewheight</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$theight</span><span style="color: #66cc66;">;</span>
    <span style="color: #ff0000">$tnewwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$tcurrwidth</span><span style="color: #66cc66;">*</span><span style="color: #ff0000">$tzoom</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #ff0000">$tzoom</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$twidth</span><span style="color: #66cc66;">/</span><span style="color: #ff0000">$tcurrwidth</span><span style="color: #66cc66;">;</span>
    <span style="color: #ff0000">$tnewwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$twidth</span><span style="color: #66cc66;">;</span>
    <span style="color: #ff0000">$tnewheight</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$tcurrheight</span><span style="color: #66cc66;">*</span><span style="color: #ff0000">$tzoom</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #ff0000">$timg</span> <span style="color: #66cc66;">=</span> imagecreatetruecolor<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$newwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tnewheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #ff0000">$tpalsaize</span> <span style="color: #66cc66;">=</span> imagecolorstotal<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tsimg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$e</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$e</span><span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span><span style="color: #ff0000">$palsize</span><span style="color: #66cc66;">;</span> <span style="color: #ff0000">$e</span><span style="color: #66cc66;">++</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #ff0000">$colors</span> <span style="color: #66cc66;">=</span> imagecolorsforindex<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tsimg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    imagecolorallocate<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tdimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'red'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'green'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$colors</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'blue'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
  imagecopyresized<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tdimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tsimg</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tnewwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tnewheight</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tcurrwidth</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$tcurrheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  imagejpeg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tdimg</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$thumbName</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">95</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  imagedestroy<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tdimg</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #ff0000">$tnewheight</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tnewheight</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
  <span style="color: #ff0000">$tnewwidth</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$tnewwidth</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// now lets add the listing information and thumbnail information to the &quot;listing&quot; table</span>
<span style="color: #ff0000">$sql</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;INSERT INTO listing SET
         mls='$mls',
         address='$address',
         price='$price',
         description='$description',
         filename='$thumbName',
         width='$tnewwidth',
         height='$tnewheight'
         &quot;</span><span style="color: #66cc66;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">mysql_query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$sql</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Listing and information stored in database&quot;</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066;">echo</span> <span style="color: #ff0000;">&quot;Error: Listing did not store in database&quot;</span><span style="color: #66cc66;">;</span>
  <span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/04/14/php-to-upload-resize-and-store-multiple-images/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What do the search engines say about you?</title>
		<link>http://binarysysdesign.com/2008/02/11/what-do-the-search-engines-say-about-you/</link>
		<comments>http://binarysysdesign.com/2008/02/11/what-do-the-search-engines-say-about-you/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 21:19:22 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Search Engines]]></category>

		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://localhost/binarysysdesign/?p=8</guid>
		<description><![CDATA[Recently I went looking for a new dentist. I pulled up my handy tool google maps, searched for a business near  	my house. There were about 4 different results within a few miles of my house. Google maps will show you  	pictures of the business (yes even if you never submitted one) website [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I went looking for a new dentist. I pulled up my handy tool google maps, searched for a business near  	my house. There were about 4 different results within a few miles of my house. Google maps will show you  	pictures of the business (yes even if you never submitted one) website listings and reviews. The website  	listings often contain links to other reviewing websites. None of the dentists office has a website so I couldn&#8217;t  	learn much from that. However, a few had reviews.</p>
<p><span id="more-5"></span></p>
<p>The  dentist closest to my house had one review and it was a one star ( out of 5). Curiosity got the best of me  	and I thought I would read what must be a horror story about a local dentist. It turns out the rating had  	nothing to do with the dentist in question. Whoever the reviewer was had given the dentist a one star  	rating because he or she has received a speeding ticket while driving by. The comment from the reviewer  	went on to warn drivers to stay away from this area because of the police department. The reviewer 	even mentioned in the post that he or she was sure the dentist was ok.</p>
<p><!--more--></p>
<p>I&#8217;m sure you see the problem. Your business can get a poor rating for any reason or none at all from anyone.  	This could drive away potential customers. Internet surfers have ADD, if the information can not be found  	quickly with minimal reading they will look elsewhere. For most readers they would of seen a 1 star rating  	and went on to look at other dentists.</p>
<p>This is very common among online communities. In addition to service rating web sites, online forums tend  	to be a place where complaints valid or not are made. Its in your best interest to dedicate someone from  	your business to look for these things through a simple search query. You can even set up automatic  	alerts to be emailed when your business name shows up on a search engine listing.</p>
<p>The easiest to deal with are forum posts. You can often register and either publicly work towards a solution  	or give your side of the story. Most readers can tell a crazy customer that won&#8217;t be satisfied from a legitimate 	complaint especially when the company in question works towards a resolution.</p>
<p>In the end I found a dentist that had a few high ratings and reviews and went with them based solely off  	of what others had written. Don&#8217;t just use google, try the other search engines also to make sure your  	seeing all the top results.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/02/11/what-do-the-search-engines-say-about-you/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New trend in domain registration</title>
		<link>http://binarysysdesign.com/2008/01/18/new-trend-in-domain-registration/</link>
		<comments>http://binarysysdesign.com/2008/01/18/new-trend-in-domain-registration/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 23:24:38 +0000</pubDate>
		<dc:creator>Darren</dc:creator>
		
		<category><![CDATA[Industry News]]></category>

		<category><![CDATA[industry]]></category>

		<category><![CDATA[registrar]]></category>

		<guid isPermaLink="false">http://localhost/binarysysdesign/?p=9</guid>
		<description><![CDATA[There is sub culture of the internet that deals strictly with buying and selling domain names. These individuals are often called &#8220;tasters&#8221;. They may pick up on a buzz word or use a program that they wrote to buy domains in massive numbers. The more popular the domain name the higher the resell price. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>There is sub culture of the internet that deals strictly with buying and selling domain names. These individuals are often called &#8220;tasters&#8221;. They may pick up on a buzz word or use a program that they wrote to buy domains in massive numbers. The more popular the domain name the higher the resell price. I&#8217;m not privy to how lucrative this market is but the fact that it occurs on a large scale means somebody is making money from.</p>
<p><span id="more-4"></span></p>
<p>Network Solutions is the industry leader in domain name registration. There was a time when they were the only source to register your domain. Now you can find a handful of discount registers all over the internet. While Network solutions charges $35/year for a .com or .net address another registrar will charge only $9/year or less. The cheaper domain name solutions have led to an increase in domain name tasters.</p>
<p>Recently Network Solutions has implemented a new procedure to combat these tasters that has left a sour taste in the mouths of the online community. If you use Network Solutions to check the availability of domain name and it is available Network Solutions automatically resisters that domain so it can not be registered through another source. Go ahead give it a shot think of a random domain name and check its availability then use another registrar to see if its still available. You will find that Network Solutions has already registered the domain. They now own it.</p>
<p>This is called &#8220;front running,&#8221; and its completely automated. If you want the domain name you just searched for you are forced to buy it from Network Solutions. This costs Network Solutions nothing because registers are allowed a 5 day grace period to protect from credit card fraud. So for the next five days you have to pay the $35 if you want that domain instead of the $9 bucks you might spend with another service. While this is perfectly legal it raises ethical concerns.</p>
<p>Network Solutions has defended their decision to implement this procedure in order to combat domain name tasters.</p>
<p>This does not mean that the domain name is waiting for you to purchase for the next five days as there is no information passed to associate your search with you or your account. In fact it occurs even if you don&#8217;t have an account with Network Solutions and your not logged in. This will undoubtedly catch many casual users off guard as Network Solutions has one of easier to use interfaces when it comes to searching for a domain name. They will check for misspellings and names that are similar automatically.</p>
<p>In the past I have always recommended Network Solutions to anyone who is registering a domain name as they are the industry leader. Losing control of your domain name can be expensive and time consuming. Given the recent policy changes my opinion (as well as a large part of the internet community) that has changed. In fact I will be moving a couple of my domain names to a new registrar, which will no doubt be a convoluted and painful process.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarysysdesign.com/2008/01/18/new-trend-in-domain-registration/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
