06:07 AM, February 09, 2010
Y2K and You and Your Scripts
Is Your Website Ready?
We're days away from the big event, you've got your
home and work computers checked, double checked and fixed.
But what about your website? Have you given it a second
thought? Maybe you think your ISP will handle all that
stuff, you don't need to be bothered. Think again. Your ISP
or webhosting company will in all likelihood make sure their
systems are all set, but that will not include
the 'canned' cgi scripts that you've labored so hard over
and uploaded to your site.
All is not lost. You've a few days left and the fixes are
not all that difficult. Listed below you'll find several
of the most popular scripts and the fixes you need to apply
to them.
This fix applies to Standard Ver. 1.02 - March 8, 1999
Commerce.cgi is based on Selena Sol's web store and can be found at http://www.careyinternet.com/main/commerce it uses the variable $sc_current_century.
Find this line:
$year = ($sc_current_century-1) . "$year";
and replace it with the below
$year = $year + 1900;
Available virtually everywhere
Perl Routines to Manipulate Web Browser Cookies
Version 0.911
Place new year definition above the default expire date, not in the same place that you find $year += 1900;
replace default cookie expire date
if (! defined $expires) {
$expires = " expires\=Wed, 31-Dec-1999 00:00:00 GMT;"; }
if expiration not set, expire at 12/31/1999
with
if (! defined $expires) {
$expires = " expires\=Wed, 31-Dec-2031 00:00:00 GMT;"; }
if expiration not set, expire at 12/31/2031
If you are using Matt Wrights cookie.lib you may want to check the default cookie date mine was set to Nov 9, 1999
Replace
$date = "$days[$wday], $months[$mon] $mday, 19$year at $time";
With
$year += 1900;
$date = "$days[$wday], $months[$mon] $mday, $year at $time";
Replace this
$date = "on $days[$wday], $months[$mon] $mday, 19$year at $hour:$min:$sec";
with this
$year += 1900;
$date = "on $days[$wday], $months[$mon] $mday, $year at $hour:$min:$sec";
In Selena Sol's scripts, the setup files call for $current_century this will have to be changed on the first of Jan for programs such as Web Store, DB Manager, and DB Search. To fix it replace the line below in the main setup files for each of those programs, usually web_store.cgi, db_manager.cgi, and db_search.cgi.
Fixes are posted here: Radical Hacks
Replace the line
$year = ($current_century-1) . "$year";
with
$year = $year + 1900;
Selena Sol's DB_Search.cgi
./Library/db-lib.pl
replace
$year = ($current_century-1) . $year
if (length($day) < 3);
with
$year = $year + 1900
if (length($day) < 3);
Replace
$date = "@months[$mon] $mday, 19$year";
with
$year = $year + 1900;
$date = "@months[$mon] $mday, $year";
The free version: last modified: 12/13/97 copyright (c) 1997.
This fix is also applicable to version 3.01 last modified: 7/25/98, the latest version is available here: http://awsd.com/scripts/ for purchase.
change the default cookie date from
$Cookie_Exp_Date = "Fri, 31-Dec-1999 00:00:00 GMT";
to
$Cookie_Exp_Date = "Wed, 31-Dec-2031 00:00:00 GMT";
you could use a later date as described above for cookie-lib.cgi
Replace this line
if ($use_time == 1) {
with
$year = $year % 100;
$year = "0" . $year if $year < 10 ;
if ($use_time == 1) {
###########################
Replace
$long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
with
$date_command = "/bin/date";
$long_date = `$date_command +"%A, %B %d, %Y at %T "`;
chop($long_date);
This gives you a start on popular scripts but you might want to
double check your other scripts. Do a search for localtime, $year, and $y within
each script and use the examples set above to replace the variable
if the script is adding 19 to it... Some say
19$year.. like Matt's formmail.. also check the cookie expire date set in any programs using cookies.
References:
Perl Documentation localtime(time)
"All array elements are numeric, and come straight out of a struct tm. In
particular this means that $mon has the range 0..11 and $wday has the range
0..6 with sunday as day 0. Also, $year is the number of years since 1900,
that is, $year is 123 in year 2023, and not simply the last two digits of
the year. "
Other Resources:
Y2K Problems...and Solutions
As many others have pointed out, Y2K has come and gone and we're all still here. While no major problems arose thanks to all the diligent work by programmers over the last several years, Web developers have noticed that there have been some Y2K-related problems with certain scripts. This page will point you to articles and resources that will help you recover from more than a Y2K hangover. Keep checking back to this page, as we'll be adding more "fixes" and resources as we locate them.
Copyright © 1998-2010.
Privacy Policy
All Rights Reserved.
|