"I recently took a job at a small interactive marketing company," writes Jason, "and, I'm sure like most small firms that hire programmers with little to no experience, the company is constantly putting out fires it started years before. One particular fire came from a client whose website just stopped working all of a sudden."
"It was a server outage or a date-based timebug, but more a message like this:
Jason continued, "the root cause itself was fairly mundane. The developer obviously didn't know how to detect browser capabilities, yet was doing so anyway. I'd imagine that any browser made after 2005 would have probably displayed this alert box, but the client must have only recently updated their browser to IE7. But what actually caused my jaw to drop and me to utter three certain letters was the following bit of zip code 'functionalilty'."
// zip code functionalilty function checkForm() { zipstr = "00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 " + "00012 00014 00015 00016 00017 00018 00019 00020 00022 00026 00027 00028 " + "00029 00031 00032 00033 00034 00035 00037 00038 00039 00040 00041 00042 " + "00043 00044 00045 00047 00048 00049 00050 00051 00052 00053 00054 00055 " + "00056 00057 00058 00059 00060 00061 00063 00064 00065 00066 00067 00068 " + "00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00082 00083 " + "00084 00085 00087 00097 00098 00100 00116 00119 00120 00121 00122 00125 " + "00126 00127 00128 00130 00132 00133 00134 00135 00137 00138 00139 00140 " + "00141 00145 00147 00148 00151 00152 00157 00158 00159 00160 00161 00164 " + "00165 00166 00168 00169 00170 00172 00173 00174 00176 00177 00179 00180 " + "00181 00182 00183 00184 00185 00186 00187 00188 00190 00191 00192 00195 " ......... snip thousands of lines ........ + "99639 99640 99645 99647 99648 99649 99650 99651 99653 99654 99655 99656 " + "99657 99658 99659 99660 99661 99662 99664 99665 99667 99668 99669 99670 " + "99671 99672 99676 99679 99681 99682 99683 99684 99685 99686 99687 99688 " + "99689 99691 99692 99701 99702 99703 99704 99705 99709 99712 99714 99720 " + "99721 99722 99723 99724 99726 99727 99729 99730 99733 99734 99736 99737 " + "99739 99740 99741 99742 99743 99744 99745 99746 99747 99748 99749 99750 " + "99751 99752 99753 99755 99756 99757 99758 99759 99760 99761 99762 99763 " + "99765 99766 99767 99768 99769 99770 99771 99772 99773 99774 99777 99778 " + "99780 99781 99782 99783 99784 99785 99786 99788 99789 99801 99820 99824 " + "99825 99826 99827 99829 99833 99835 99840 99901 99903 99919 99921 99922 " + "99923 99925 99926 99927 99929 99950"; Zip = document.getElementById("Zip").value; //alert(Zip); if (Zip == "") { hideAllErrors(); document.getElementById("ZipError").style.display = "inline"; document.getElementById("Zip").select(); document.getElementById("Zip").focus(); return false; } else { zipary = zipstr.split(" "); for (z in zipary) { if (Zip == zipary[z]) {return true;} } } document.getElementById("ZipError").style.display = "inline"; document.getElementById("Zip").select(); document.getElementById("Zip").focus(); return false; }
"I'm not sure how often the USPS creates new zip codes, but I this code would prevent anyone who lived in a newly created zip code from buying our client's product. Then again, they'd probably be better going to a competitor, anyway."