Y2K Patch Revised ~ Easy Instructions

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread


There is a Y2K patch a few posts up but it is a little confusing since the patch is commented out. Here is the easy way to fix it. If you don't, the year 19100 will show up in your email to you and your customers.

You will need to do both smart.cgi and smartadmin.cgi. I will tell you how to do one, repeat steps for the other.

Open WordPad, open smart.cgi. Choose Edit>Find. Enter 19$year and find it.

Just above that line enter this code:

#y2k patch $year = $year - 100; if ($year < 10) { $year = "0$year"; }

Now change 19$year to 20$year

Thats it. Save and upload. Repeat for admin.cgi. This is what the get date subroutine should look like:

# Get the date. sub get_date { @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December');

($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time); if ($hour < 10) { $hour = "0$hour"; } if ($min < 10) { $min = "0$min"; } if ($sec < 10) { $sec = "0$sec"; }

#y2k patch $year = $year - 100; if ($year < 10) { $year = "0$year"; }

$date = "$days[$wday], $months[$mon] $mday, 20$year at $hour\:$min\:$sec";


-- Stephen Warriner (stephen@mvweb.com), January 17, 2000



I see that a carriage return was taken out.

Add this line:

$year = $year - 100; if ($year < 10) { $year = "0$year"; }

change 19$year to 20$year


-- Stephen Warriner (stephen@mvweb.com), January 17, 2000.

I am trying to get this post removed because when I posted it some of my carriage returns disappeared. In the mean time, the actual code that should be pasted looks like this(I hope):

#y2k patch

$year = $year - 100; if ($year < 10) { $year = "0$year"; }

Then change 19$year to 20$year.

If you have problems, drop me an email.

-- Stephen Warriner (stephen@mvweb.com), January 18, 2000.

Stephen, thanks for for fix. it's hard to post code on this board... for those of you who have trouble reading posted code: check the source en copy it from there.


-- Frank (francey@zimbra.nl), January 20, 2000.

Moderation questions? read the FAQ