#!/usr/bin/perl print "Content-type:text/html\n\n"; use Time::Local; $today = timelocal(localtime); $now = &unix_to_date($today); sub unix_to_date { # -------------------------------------------------------- # Returns the date in the format "mm-dd-yyyy". # Warning: If you change the default format, you must also modify the &date_to_unix # subroutine below which converts your date format into a unix time in seconds for sorting purposes. my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time()); ($day < 10) and ($day = "0$day"); $mon += 1; ($mon < 10) and ($mon = "0$mon"); $year += 1900; return "$mon\/$day\/$year"; } $datafile = "default.db"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/ ~!/g; $FORM{$name} = $value; } open(OUTF,">>default.db") or dienice("Couldn't open default.db for writing: $!"); # This locks the file so no other CGI can write to it at the # same time... flock(OUTF,2); # Reset the file pointer to the end of the file, in case # someone wrote to it while we waited for the lock... seek(OUTF,0,2); print OUTF "$now|$FORM{'serialnumber'}|$FORM{'partnumber'}|$FORM{'quantity'}|$FORM{'DIMMOpt'}|\n"; close(OUTF); print <New record has been added !

New record has been added today $now !


Thanks !!
EndHTML sub dienice { my($msg) = @_; print "

Error

\n"; print $msg; exit; } 3. getpart.pl This is a perl script from someone, it take serial number and give me part number and it pulled from a website. Example: $getpart 1234ABCD I will get the result is $501-1234-01