I've spent all day on this and I'm baffled. I got the current time ($timestamp), made an array, and then used mktime to get the hours. Any thoughts. I'm primarily a Flash designer so this PHP is somewhat new to me.
// get the current timestamp into an array
$timestamp = gettime();
$date_time_array = getdate($timestamp);
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
// use mktime to recreate the unix timestamp
$hour = mktime($hours);
But when I set it up with the if/then statement I get nothing. I'm somewhat confused as to why this is happening. It appears all the variables are defined yet when I run the form nothing gets mailed. I know that the system is working because I do have an additional mailto statement which does function -- prior to the if then statement.
if ($hour > 8 AND $hour < 17) {
$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );
mail( "$MailFrom", "Thanks for your email", "$contents\n\n",
"From:The Librarians\n" );
}
else ($hour < 8 AND $hour <17) {
$filename2 = "answer2.txt";
$fd =fopen ( $filename2, "r");
$contents = fread ( $fd, filesize( $filename2 ) );
fclose( $fd);
mail ("$Mailfrom", "Thanks for your email", "$contents\n\n",
"From:The Librarian\n");
}
😕 😕