Viewing file: timeit.pl (10.68 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
#-------------------------------------------------------------------#
# (c) timeit v1.1 (Y2K compliant)
#-------------------------------------------------------------------#
#
# Created Aug 1999 by avika. ("The CGIPATH")
#
# http://www.avika.com/thecgipath scripts@avika.com
#
#-------------------------------------------------------------------#
# You may freely distribute this script, and modify it for your
# needs. Although we do ask that you keep the above notice in tact.
# This script does not have any hyperlinks, so in return
# please leave the notice as is. Distribution of this script must
# be FREE. You may choose to profit only from installation of this
# script.
# If you modify this script, you may place your modification details
# below this notice so you can recieve credit for it. Enjoy the
# script.
#-------------------------------------------------------------------#
# Modification Details (Please do not remove)
#-------------------------------------------------------------------#
#
# Modified by :
# Date Modified :
# Version :
# URL :
# Email :
# What's New :
#
#-------------------------------------------------------------------#
#
# Modified by :
# Date Modified :
# Version :
# URL :
# Email :
# What's New :
#
#-------------------------------------------------------------------#
#
# Please leave all modified user information as is. It's only fair
# that everyone who modifies this script gets recognized for it.
#
#-------------------------------------------------------------------#
#
#####################################################################
#-------------------------------------------------------------------#
#
# First thing you need to do is make sure you are pointing to the
# right path for perl. At the very top, this should be >>
# #!/usr/local/bin/perl or #!/usr/bin/perl5 ask your server's
# administrator if you don't know. (If your server only allows *.cgi
# extensions then just change *.pl to *.cgi)
# It's easy to put the time and date on your page(s). It only takes
# some choosing and modifications to suit your needs. Okay so lets
# get started. First you choose the format of how you would like your
# date and or time displayed. Here are you choices:
#
#-------------------------------------------------------------------#
# Date Formats:
# ( Example of Format 1 >> Monday, August 15th 1999, 2:30:10 P.M. )
#-------------------------------------------------------------------#
#
# 1 = Day Month date year hour:minutes:seconds am/pm
# 2 = Day date Month year hour:minutes:seconds am/pm
# 3 = Month date year hour:minutes:seconds am/pm
# 4 = date Month year hour:minutes:seconds am/pm
#
#-------------------------------------------------------------------#
# ( Example of Format 5 >> Monday, August 15th 1999 )
#-------------------------------------------------------------------#
#
# 5 = Day Month date year
# 6 = Month date year
#
#-------------------------------------------------------------------#
# ( Example of Format 7 >> 08/15/1999 )
#-------------------------------------------------------------------#
#
# 7 = Month / Date / year
# 8 = Date / Month / year
#
#-------------------------------------------------------------------#
# ( Just want the time displayed? 9 >> 2:30:10 P.M. )
#-------------------------------------------------------------------#
#
# 9 = hour:minutes:seconds am/pm
# 10 = hour:minutes:seconds
# 11 = hour:minutes am/pm
#
#-------------------------------------------------------------------#
# ( and a few more for the picky people :)
#-------------------------------------------------------------------#
#
# 12 = Day Month date year hour:minutes am/pm
# 13 = Month date year hour:minutes
# 14 = Month / Date / year hour:minutes am/pm
# 15 = Day Month / Date / year hour:minutes am/pm
# 16 = Day hour:minutes am/pm
#
# *****>>Put your numbered choice below:
#
$format = 1;
#
#-------------------------------------------------------------------#
# So you've made your choice? These are your other options :
# **(NOTE: If you don't want a particular option like Bold letters etc..just # leave the line blank ie: $bold = ''; or $input = ""; etc...)
#-------------------------------------------------------------------#
# (Example of $input >> {{Today is;}} Monday, August 15th 1999, 2:30:10 P.M.)
# Whatever pleases you here: ie: Updated on : , Our time is : , etc... Just # make sure that you leave a space after your comment, or your date will look # like this >> Today is;Monday...
#
$input = "";
#-------------------------------------------------------------------#
# (Example of $input_time >> ... Monday, August 15th 1999, {{at}} 2:30:10)
# Same thing goes here, whatever you want. Remember to leave a space.
#
$input_time = "at ";
#-------------------------------------------------------------------#
# Choose your font size, color and style(face) 'default 000000 is Black'
#
$font = '<font face=verdana size=1 color=#FFFF00>';
#-------------------------------------------------------------------#
# Do you want your letters bold or italic, or maybe both?
# Leave the tags in if you want these choices, or delete them if you don't,
# ie: $italics = '';
#
$bold = '<b>';
$italics = '<i>';
#-------------------------------------------------------------------#
# This is your division mark between the day and month and the year and time.
# ( Example : Monday{{,}} August...1999{{,}} 2:3.. or Monday{{//}}
# August...1999{{//}} 2:3..)
# Whatever you prefer : // . , : ; ' & > You get the point :)
# Don't forget Leave a space.
#
$divide = ", ";
#-------------------------------------------------------------------#
# You shouldn't have to change this, but if your server conflicts with your
# local time just minus or add the time difference ie: Your server time is
# 10:00 AM and you are 1:00 PM just type in +3 or your server is 10:00 AM
# and you are 7:00 AM type in -3;
#
$timeoffset = +7;
#-------------------------------------------------------------------#
# That's it for your preferences. All you need to do now is upload this file # to your directory and CHMOD 755
# This is how to call the script from your page(s). Just change the
# directory name to match yours. Place it where you want the date to show.
#
# SSI tag >>
#
# <!--#exec cgi="/cgi-bin/timeit.pl"-->
#
# ***Note some servers require that you have your page extension *.shtml
# inorder for SSI tags to work.
#
###########################################################################
#
# There's really no need to change anything below......
#
###########################################################################
print ("Content-type: text/html\n\n");
@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,$yday,$isdst) = localtime(time + (3600*$timeoffset));
$hour = "0$hour" if ($hour < 10);
$min = "0$min" if ($min < 10);
$sec = "0$sec" if ($sec < 10);
if ($hour >= 12) { $variable = "P.M."; }
else { $variable = "A.M."; }
if ($hour == 0) { $hour = 12; }
if ($hour > 12) { $hour -= 12; }
if ($year eq "99") { $year = 1900 + $year;
} else { $year = 2000 + $year - 100; }
if ($mday eq "1") { $hy = "st";
} elsif ($mday eq "21") { $hy = "st";
} elsif ($mday eq "31") { $hy = "st";
} elsif ($mday eq "2") { $hy = "nd";
} elsif ($mday eq "22") { $hy = "nd";
} elsif ($mday eq "3") { $hy = "rd";
} elsif ($mday eq "23") { $hy = "rd";
} else { $hy = "th"; }
$day = $days[$wday];
$month = $months[$mon];
$month_no = ++$mon;
$date = "$mday$hy";
$date_no = $mday;
$time = "$hour:$min:$sec $variable";
$time_sv = "$hour:$min $variable";
$time_var = "$hour:$min:$sec";
$time_sec = "$hour:min";
print "<!-- BEGIN timeit v1.1 (c) 1999-2000 avika get yours at: http://www.avika.com/thecgipath -->\n";
if ($format eq "1") {
print "$bold$italics$font$input$day$divide$month $date $year$divide$input_time$time</i></b></font>\n";
} elsif ($format eq "2") {
print "$bold$italics$font$input$day$divide$date $month $year$divide $input_time$time</i></b></font>";
} elsif ($format eq "3") {
print "$bold$italics$font$input$month $date $year$divide$input_time$time</i></b></font>";
} elsif ($format eq "4") {
print "$bold$italics$font$input$date $month $year$divide$input_time$time</i></b></font>";
} elsif ($format eq "5") {
print "$bold$italics$font$input$day$divide$month $date $year</i></b></font>";
} elsif ($format eq "6") {
print "$bold$italics$font$input$month $date $year</i></b></font>";
} elsif ($format eq "7") {
print "$bold$italics$font$input$month_no/$date_no/$year</i></b></font>";
} elsif ($format eq "8") {
print "$bold$italics$font$input$date_no/$month_no/$year</i></b></font>";
} elsif ($format eq "9") {
print "$bold$italics$font$input$time</i></b></font>";
} elsif ($format eq "10") {
print "$bold$italics$font$input$time_var</i></b></font>";
} elsif ($format eq "11") {
print "$bold$italics$font$input$time_sv</i></b></font>";
} elsif ($format eq "12") {
print "$bold$italics$font$input$day$divide$month $date $year$divide $input_time$time_sv</i></b></font>";
} elsif ($format eq "13") {
print "$bold$italics$font$input$month $date $year$divide$input_time$time_sec</i></b></font>";
} elsif ($format eq "14") {
print "$bold$italics$font$input$month_no/$date_no/$year$divide $input_time$time_sv</i></b></font>";
} elsif ($format eq "15") {
print "$bold$italics$font$input$day$divide$month_no/$date_no/$year$divide $input_time$time_sv</i></b></font>";
} elsif ($format eq "16") {
print "$bold$italics$font$input$day$divide$input_time$time_sv</i></b></font>";
print "<!-- END timeit v1.1 (c) 1999-2000 avika get yours at: http://www.avika.com/thecgipath -->\n";
}
#############################################################################
# #
# (c) timeit.pl created by avika ("The CGIPATH") scripts@avika.com #
# #
#############################################################################
|