넉두리

기념일 프로그램

신나는 삶 2008. 1. 28. 16:07

<style type='text/css'>
BODY
{scrollbar-face-color: #ffffff; scrollbar-shadow-color: #849CBD;
scrollbar-highlight-color: #849CBD; scrollbar-3dlight-color: #ffffff;
scrollbar-darkshadow-color: #ffffff; scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #849CBD}
<!--
A:link {color:black;text-decoration:none;}
A:visited {color:black;text-decoration:none;}
A:active {color:red;text-decoration:none;}
A:hover {color:blue;text-decoration:none;}
.ver8 {font-family:Verdana,Arial,돋움;font-size:8pt}
p,br,body,td,select,input,form,textarea,option {font-size:9pt;}
.ad{border:1 solid black}
.cont{line-height:140%}
.editbox {border:1 solid black; background-color:white;}
-->
</style>
<html>
<head>
<title>곰팅의 홈페이지</title>
</head>
<body bgcolor=#f7f7f7>
<center>
<?

function theday($s_year, $s_month, $s_day, $e_year, $e_month, $e_day) {
    $start = mktime(0, 0, 0, $s_month, $s_day, $s_year);
    $end = mktime(0, 0, 0, $e_month, $e_day, $e_year);

    $whole = $end - $start;

    $days_whole = $whole/(60*60*24);

    return $days_whole;
}

$theweek = array("일", "월", "화", "수", "목", "금", "토");

echo("<b>기념일 계산 도우미</b><br><br>n");
echo("<table bordercolor=white bordercolorlight=silver border cellpadding=3 cellspacing=0 bgcolor=#e0e0e0>n");

$temp = theday(2000, 5, 5, date("Y", mktime()), date("m", mktime()), date("j", mktime()));

echo("<tr><td><b>오늘날짜</b></td><td>".date("Y", mktime())."년 ".date("m", mktime())."월 ".date("d", mktime())."일 입니다.</td></tr>n");
echo("<tr><td colspan=2 align=center>홈페이지가 문을 연지 ".$temp."일 지났습니다.</td></tr>n");

echo("<tr><td><b>기념일</b></td><td><form name=adate><select name=a_year size=1>");
for($i=1990;$i<2011;++$i) {
    echo("<option value=$i");
    if($a_year == "") {
        $a_year = 2000;
    }
    if($i == $a_year) {
        echo(" selected");
    }
    echo(">$in");
}
echo("</select>년 ");

echo("<select name=a_month size=1>");
for($i=1;$i<13;++$i) {
    echo("<option value=$i");
    if($a_month == "") {
        $a_month = 1;
    }
    if($i == $a_month) {
        echo(" selected");
    }
    echo(">$in");
}
echo("</select>월 ");

echo("<select name=a_day size=1>");
for($i=1;$i<32;++$i) {
    echo("<option value=$i");
    if($a_day == "") {
        $a_day = 1;
    }
    if($i == $a_day) {
        echo(" selected");
    }
    echo(">$in");
}
echo("</select>일</td></tr>n");

echo("<tr><td colspan=2 align=center><input type=submit value="오늘은 며칠째?"</form></td></tr>n");

$temp = theday($a_year, $a_month, $a_day, date("Y", mktime()), date("m", mktime()), date("j", mktime()));

echo("<tr><td><b>계산결과</b></td><td>".$a_year."년 ".$a_month."월 ".$a_day."일로부터 ".$temp."일째 날입니다.</td></tr>n");
echo("<tr><td colspan=2 align=center><b>기념일로부터 며칠째 날을 알고 싶으세요?</b></td></tr>n");

if($count == "") {
    $count = 100;
}
echo("<tr><td><form name=daycount><input type=text name=count size=2 maxlength=5 value=$count>일째 되는날은</td>");

$temp = mktime(0, 0, 0, $a_month, $a_day, $a_year) + 86400*$count;

echo("<td>".date("Y", $temp)."년 ".date("m", $temp)."월 ".date("d", $temp)."일 ".$theweek[date("w", $temp)]."요일입니다.</td></tr>n");
echo("<tr><td colspan=2 align=center><input type=submit value="그날은 언젤까?"</form></td></tr></table>n<br>n");

?>
</body>
</html>