PHP 4.0 Bug #4096: mktime() & date() bug on Win32 Environment
| From: | chankor at netscape dot net | Date: | Tue, 11 Apr 2000 02:26:35 +0000 |
| Subject: | PHP 4.0 Bug #4096: mktime() & date() bug on Win32 Environment | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17788@lists.php.net to get a copy of this message | ||
From: chankor@netscape.net
Operating system: Windows98
PHP version: 4.0 Release Candidate 1
PHP Bug Type: Scripting Engine problem
Bug description: mktime() & date() bug on Win32 Environment
Please check date function bug
save this script as "birth.php" and
enter "19650331" my birthday.
On Linux, It's Okey but,
php4ts.dll error would be happen on Win98 with Apach Webserver. PWS does it also.
<?
echo("
<form action=birth.php method=post>
<tr>
<td align=right>Birth(YYYYMMDD): </td>
<td><input type=text name=\"birth\" size=8 maxlength=8></td>
</tr>
<tr>
<td align=center><input type=submit value=\"Check!\"></form></td>
</tr>");
// Birthday Checking
if (strlen($birth) == 8) {
for ($i = 0; $i < 8; $i++) {
$a[$i] = intval($birth[$i]);
}
// Birthday checking
$Y = $a[0]*1000 + $a[1]*100 + $a[2]*10 + $a[3];
$M = $a[4]*10 + $a[5];
if (($M == 0) || ($M >12)) error("Invalid Month");
$D = $a[6]*10 + $a[7];
if (($D == 0) || ($D >31)) error("Invalid Day");
$b_date = mktime(0, 0, 0, "$M", "$D", "$Y");
$b_date = date("Y-m-d", $b_date);
echo ( "Birth : $b_date");
} else {
echo("Invalid Input");
}
?>
<?php
phpinfo();
?>