So, I did something wrong here the even function was working but then it stopped after I added in a check for a new month and it now brings up the only accepts integers error.
Maybe too many date functions in on process (I have 4 date functions)? I'm using php4 also if that makes a difference.
I'm switching servers in the next few days anyone know if a small orange company is good or now of a good one to use? I have 3 domains I need to swap over. My current server IX webhosting has crashed my domains 3+ times today and denies it's happening (2 techs, 1 said he knew) so I can't stay with them.
It also did occur to me that I would need a way to get the php to write even when the page was not loaded so that at the new month point it would write regardless of if a visitor was on the page at 11:59:59 or not.
PHP Code:
$date2 = date('m.j.y');
function is_even($int) {
if ( !is_int($int) ) {
trigger_error('The is_even() function only accepts integers.', E_USER_WARNING);
return;
// Or get rid of trigger_error(xxx) and replace it with: return false;
// to accept any input. This will cause odd numbers and decimals
// to return false.
}
$result = $int % 2 == 0 ? true : false;
return $result;
}
$int = date('j');
if ( is_even($int) ) {
$first = '<tr class="even"><td>';
} else {
$first = '<tr class="odd"><td>';
}
$newmonth = date('m.d H:i:s');
if ($newmonth == "1/31 23:59:59" || $newmonth == "2.28 23:59:59" || $newmonth == "2.29 23:59:59" || $newmonth == "3.31 23:59:59" || $newmonth == "4.30 23:59:59" || $newmonth == "5/31 23:59:59" || $newmonth == "6/30 23:59:59" || $newmonth == "7/31 23:59:59" || $newmonth == "8/30 23:59:59" || $newmonth == "9/30 23:59:59" || $newmonth == "10/31 23:59:59" || $newmonth == "11/30 23:59:59" || $newmonth == "12/31 23:59:59") {
$who = "<tr><td class=\"row\" colspan=\"3\"> NEW MONTH</td></tr>" . $first . $entervalue . "</td><td>" . $date1 . "</td><td>" . $date2 . "</td><td>" . $user . "</td><td>" . $computer . "</td></tr>\n</table>\n";
} else {
$who = $first . $entervalue . "</td><td>" . $date1 . "</td><td>" . $date2 . "</td><td>" . $user . "</td><td>" . $computer . "</td></tr>\n</table>\n";
}
$where = str_replace("</table>", $who, $red);
$logger = fopen($info, "w+");
fwrite($logger, $where);
fclose($logger);
Thanks for any ideas and thoughts you can offer with these questions as well
.
Bookmarks