Thaimisc.com : Countdown
ThaiMisc.Com : Free Webboard | Free GuestBook | Free Poll | Free Ecard Server | Free Java Chat Room | Advertising | Contact Us | Colocation | Web Hosting | Դҹҿ


Category : Perl Scripts Print Article Only Print Aticle With Comment
Countdown
¹ , 08-03-2002
Ѻѹѧͧ任ءѹ٤Ѻ

ʴդѺ ѹй ѹ ФѺ͹ ͧ 鹨ö任ء繻ª ͹Ƿҧ㹡¹ ѹ仹ФѺҹժ Countdown ͡͡ ͧӧҹǡѺ͹Ѻ ǹ繵Ǻ͡ ա ѹ / ͹ / ж֧ѹ ҡ˹ФѺ зش ö͡Ҷ֧ Թҷ Wow!! ҧҴ source code ѹ´աҤѺ#!/usr/bin/perl#@from_date=(yyyy,mm,dd,hh,mm,ss);#Whichmeans:(year,month,day,hour,minute,second)@from_date=(2002,3,15,0,0,0);#Done########################################################$ENV{'QUERY_STRING'}=~s/%2C/,/g;$ENV{'QUERY_STRING'}=~s/=//g;if($ENV{'QUERY_STRING'}){@from_date=split(/,/,$ENV{'QUERY_STRING'});}#Definewhenvariousthingsoccur,differentdates,etc...&define_dates;#CalculatetheDifferencesinthetwodates&calc_dates;#MakeSurewedon'tgetnegativetimes..That'snotcool...&no_negative;#TopofHTMLPageInformation&html_header;#Wedon'twantittosay1Years,now,dowe?Ofcoursenot!&proper_english;#EndofHTMLPageInformation&html_trailer;######################################Subroutinessubdefine_dates{($f_year,$f_month,$f_day,$f_hour,$f_minute,$f_second)=@from_date;($second,$minute,$hour,$day,$month,$year,$wday,$yday,$isdst)=localtime(time);$year+=1900;&leap_year_check;@months=("XX","January","February","March","April","May","June","July","August","September","October","November","December");@days=("XX","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");@days_in_month=(31,$feb_days,31,30,31,30,31,31,30,31,30,31);$date_term="$months[$f_month]$days[$f_day]";unless($f_yeareq'XX'){$date_term="$date_term,$f_year";}unless($f_houreq'XX'){$date_term="$date_term$f_hour";}unless($f_minuteeq'XX'){if($f_minute<10){$date_term="$date_term:0$f_minute";}else{$date_term="$date_term:$f_minute";}}unless($f_secondeq'XX'){if($f_second<10){$date_term="$date_term:0$f_second";}else{$date_term="$date_term:$f_second";}}$current_date="$months[($month+1)]$days[$day],$year$hour";if($minute<10){$current_date="$current_date:0$minute";}else{$current_date="$current_date:$minute";}if($second<10){$current_date="$current_date:0$second";}else{$current_date="$current_date:$second";}}subleap_year_check{$yeardiv=($year/4);$yearint=int($yeardiv);$yeardiv1=($year/100);$yearint1=int($yeardiv1);if($yeardiveq$yearint&&$yeardiv1ne$yearint1){$feb_days="28";}else{$feb_days="29";}}subcalc_dates{$real_year=($f_year-$year);$real_month=(($f_month-1)-$month);$real_day=($f_day-$day);$real_hour=($f_hour-$hour);$real_minute=($f_minute-$minute);$real_second=($f_second-$second);}subno_negative{if($real_second<0){$real_second=($real_second+60);$real_minute--;}if($real_minute<0){$real_minute=($real_minute+60);$real_hour--;}if($real_hour<0){$real_hour=($real_hour+24);$real_day--;}if($real_day<0){$real_day=($real_day+@days_in_month[$month]);$real_month--;}if($real_month<0){$real_month=($real_month+12);$real_year--;}}subproper_english{unless($f_yeareq'XX'){if($real_yeareq'1'){print"$real_yearYear<br>n";}else{print"$real_yearYears<br>n";}}unless($f_montheq'XX'){if($real_montheq'1'){print"$real_monthMonth<br>n";}else{print"$real_monthMonths<br>n";}}unless($f_dayeq'XX'){if($real_dayeq'1'){print"$real_dayDay<br>n";}else{print"$real_dayDays<br>n";}}unless($f_houreq'XX'){if($real_houreq'1'){print"$real_hourHour<br>n";}else{print"$real_hourHours<br>n";}}unless($f_minuteeq'XX'){if($real_minuteeq'1'){print"$real_minuteMinute<br>n";}else{print"$real_minuteMinutes<br>n";}}unless($f_secondeq'XX'){if($real_secondeq'1'){print"$real_secondSecond<br>n";}else{print"$real_secondSeconds<br>n";}}}subhtml_header{print"Content-type:text/htmlnn";print"<html><head><title>Countdownto:$date_term</title></head>n";print"<body><center><h1>Countdownto:$date_term</h1>n";print"<hr>n";}subhtml_trailer{print"<hr>n";print"Itiscurrently$current_daten";print"</center>n";print"</body></html>n";}䢺÷Ѵ @from_date=(2002,3,15,0,0,0); @from_date=(,͹,ѹ,,ҷ,Թҷ); ҵͧè set Ѻѧҡ upload 仺 server Ẻ ASCII MODE chmod 755 Ѻ ҡͧ run ҹ URL ٤Ѻ

<- Back | Next ->

ThaiMisc.Com : Free Webboard | Free GuestBook | Free Poll | Free Ecard Server | Free Java Chat Room | Advertising | Contact Us
Copyright 1999-2006 Thailand Miscellaneous. Allrights reserved. webmaster@thaimisc.com