W
warpman
I need some help. I'm new to perl and I have borrow the following
code. This sub keeps on given me the following date:
November 5, 103 at 10:16:33:
I don't understand why it keeps on given me the year as 1xx instead of
2 digits. Any help would be greatly appreciated. Thanks in advanced.
=====
sub get_variables {
if ($FORM{'followup'}) {
$followup = "1";
@followup_num = split(/,/,$FORM{'followup'});
$num_followups = @followups = @followup_num;
$last_message = pop(@followups);
$origdate = "$FORM{'origdate'}";
$origname = "$FORM{'origname'}";
$origsubject = "$FORM{'origsubject'}";
}
else {
$followup = "0";
}
if ($FORM{'name'}) {
$name = "$FORM{'name'}";
$name =~ s/"//g;
$name =~ s/<//g;
$name =~ s/>//g;
$name =~ s/\&//g;
}
else {
&error(no_name);
}
if ($FORM{'email'} =~ /.*\@.*\..*/) {
$email = "$FORM{'email'}";
}
if ($FORM{'subject'}) {
$subject = "$FORM{'subject'}";
$subject =~ s/\&/\&\;/g;
$subject =~ s/"/\"\;/g;
}
else {
&error(no_subject);
}
if ($FORM{'url'} =~ /.*\:.*\..*/ && $FORM{'url_title'}) {
$message_url = "$FORM{'url'}";
$message_url_title = "$FORM{'url_title'}";
}
if ($FORM{'img'} =~ /.*tp:\/\/.*\..*/) {
$message_img = "$FORM{'img'}";
}
if ($FORM{'body'}) {
$body = "$FORM{'body'}";
$body =~ s/\cM//g;
$body =~ s/\n\n/<p>/g;
$body =~ s/\n/<br>/g;
$body =~ s/</</g;
$body =~ s/>/>/g;
$body =~ s/"/"/g;
}
else {
&error(no_body);
}
if ($quote_text == 1) {
$hidden_body = "$body";
$hidden_body =~ s/</</g;
$hidden_body =~ s/>/>/g;
$hidden_body =~ s/"/"/g;
}
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
if ($sec < 10) {
$sec = "0$sec";
}
if ($min < 10) {
$min = "0$min";
}
if ($hour < 10) {
$hour = "0$hour";
}
if ($mon < 10) {
$mon = "0$mon";
}
if ($mday < 10) {
$mday = "0$mday";
}
$month = ($mon + 1);
@months = ("January","February","March","April","May","June","July","August","September","October","November","December");
if ($use_time == 1) {
$date = "$hour\:$min\:$sec $month/$mday/$year";
}
else {
$date = "$month/$mday/$year";
}
chop($date) if ($date =~ /\n$/);
$long_date = "$months[$mon] $mday, $year at $hour\:$min\:$sec";
# $long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
}
code. This sub keeps on given me the following date:
November 5, 103 at 10:16:33:
I don't understand why it keeps on given me the year as 1xx instead of
2 digits. Any help would be greatly appreciated. Thanks in advanced.
=====
sub get_variables {
if ($FORM{'followup'}) {
$followup = "1";
@followup_num = split(/,/,$FORM{'followup'});
$num_followups = @followups = @followup_num;
$last_message = pop(@followups);
$origdate = "$FORM{'origdate'}";
$origname = "$FORM{'origname'}";
$origsubject = "$FORM{'origsubject'}";
}
else {
$followup = "0";
}
if ($FORM{'name'}) {
$name = "$FORM{'name'}";
$name =~ s/"//g;
$name =~ s/<//g;
$name =~ s/>//g;
$name =~ s/\&//g;
}
else {
&error(no_name);
}
if ($FORM{'email'} =~ /.*\@.*\..*/) {
$email = "$FORM{'email'}";
}
if ($FORM{'subject'}) {
$subject = "$FORM{'subject'}";
$subject =~ s/\&/\&\;/g;
$subject =~ s/"/\"\;/g;
}
else {
&error(no_subject);
}
if ($FORM{'url'} =~ /.*\:.*\..*/ && $FORM{'url_title'}) {
$message_url = "$FORM{'url'}";
$message_url_title = "$FORM{'url_title'}";
}
if ($FORM{'img'} =~ /.*tp:\/\/.*\..*/) {
$message_img = "$FORM{'img'}";
}
if ($FORM{'body'}) {
$body = "$FORM{'body'}";
$body =~ s/\cM//g;
$body =~ s/\n\n/<p>/g;
$body =~ s/\n/<br>/g;
$body =~ s/</</g;
$body =~ s/>/>/g;
$body =~ s/"/"/g;
}
else {
&error(no_body);
}
if ($quote_text == 1) {
$hidden_body = "$body";
$hidden_body =~ s/</</g;
$hidden_body =~ s/>/>/g;
$hidden_body =~ s/"/"/g;
}
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
if ($sec < 10) {
$sec = "0$sec";
}
if ($min < 10) {
$min = "0$min";
}
if ($hour < 10) {
$hour = "0$hour";
}
if ($mon < 10) {
$mon = "0$mon";
}
if ($mday < 10) {
$mday = "0$mday";
}
$month = ($mon + 1);
@months = ("January","February","March","April","May","June","July","August","September","October","November","December");
if ($use_time == 1) {
$date = "$hour\:$min\:$sec $month/$mday/$year";
}
else {
$date = "$month/$mday/$year";
}
chop($date) if ($date =~ /\n$/);
$long_date = "$months[$mon] $mday, $year at $hour\:$min\:$sec";
# $long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
}