PHP 프로그래밍

본문 바로가기
사이트 내 전체검색


Web Programming >> PHP Programming
[목차]
제27장 일정관리 프로그램(MySQL)

    1. 주간 및 일간 일정관리 프로그램

 

여기서는 주간 및 일간 일정관리를 위한 프로그램 개발이 이루어진다.

먼저 테이블을 만들어야한다. 회원관리가 먼저 이루어져야한다. 16장 19장 7절에서 BBS용 회원 인증과 회원관리를 프로그래밍하였다. 혹시 아직 안했다면, 일정관리를 위해서 앞장의 회원인증과 회원관리를 먼저 하기 바란다.

 

1. 테이블 만들기

일정관리를 위해서는 아래의 테이블 들이 필요하다. 참고하여 만들기 바란다.

 

CREATE TABLE diary_lunar_holiday (

  num int(4) NOT NULL auto_increment,

  timestamp int(4),

  comment char(30) DEFAULT '' NOT NULL,

  relax char(1),

  PRIMARY KEY (num)

);

 

 

INSERT INTO diary_lunar_holiday VALUES (32,972226800,'상강','0');

INSERT INTO diary_lunar_holiday VALUES (31,970930800,'한로','0');

INSERT INTO diary_lunar_holiday VALUES (3,947084400,'소한','0');

INSERT INTO diary_lunar_holiday VALUES (4,948380400,'대한','0');

INSERT INTO diary_lunar_holiday VALUES (5,949590000,'입춘','0');

INSERT INTO diary_lunar_holiday VALUES (6,949676400,'설날','1');

INSERT INTO diary_lunar_holiday VALUES (7,949762800,'설날','1');

INSERT INTO diary_lunar_holiday VALUES (8,950886000,'우수','0');

INSERT INTO diary_lunar_holiday VALUES (9,952182000,'경칩','0');

INSERT INTO diary_lunar_holiday VALUES (10,953478000,'춘분','0');

INSERT INTO diary_lunar_holiday VALUES (11,954774000,'청명','0');

INSERT INTO diary_lunar_holiday VALUES (12,957452400,'입하','0');

INSERT INTO diary_lunar_holiday VALUES (13,957970800,'석가탄신일','1');

INSERT INTO diary_lunar_holiday VALUES (14,958834800,'소만','0');

INSERT INTO diary_lunar_holiday VALUES (15,960130800,'망종','0');

INSERT INTO diary_lunar_holiday VALUES (16,960217200,'단오','0');

INSERT INTO diary_lunar_holiday VALUES (17,961513200,'하지','0');

INSERT INTO diary_lunar_holiday VALUES (18,962895600,'소서','0');

INSERT INTO diary_lunar_holiday VALUES (19,963241200,'초복','0');

INSERT INTO diary_lunar_holiday VALUES (20,964105200,'중복','0');

INSERT INTO diary_lunar_holiday VALUES (21,964191600,'대서','0');

INSERT INTO diary_lunar_holiday VALUES (22,965487600,'칠석','0');

INSERT INTO diary_lunar_holiday VALUES (23,965574000,'입추','0');

INSERT INTO diary_lunar_holiday VALUES (24,965833200,'말복','0');

INSERT INTO diary_lunar_holiday VALUES (25,966956400,'처서','0');

INSERT INTO diary_lunar_holiday VALUES (26,968252400,'백로','0');

INSERT INTO diary_lunar_holiday VALUES (27,968598000,'추석','1');

INSERT INTO diary_lunar_holiday VALUES (28,968684400,'추석','1');

INSERT INTO diary_lunar_holiday VALUES (29,968770800,'추석','1');

INSERT INTO diary_lunar_holiday VALUES (30,969634800,'추분','0');

INSERT INTO diary_lunar_holiday VALUES (33,973522800,'입동','0');

INSERT INTO diary_lunar_holiday VALUES (34,974818800,'소설','0');

INSERT INTO diary_lunar_holiday VALUES (35,976114800,'대설','0');

INSERT INTO diary_lunar_holiday VALUES (36,956156400,'곡우','0');

INSERT INTO diary_lunar_holiday VALUES (37,954860400,'한식','0');

 

 

CREATE TABLE diary_solar_holiday (

  num int(4) NOT NULL auto_increment,

  month int(11) DEFAULT '0' NOT NULL,

  day int(11) DEFAULT '0' NOT NULL,

  comment char(30) DEFAULT '' NOT NULL,

  relax char(1),

  PRIMARY KEY (num)

);

 

 

INSERT INTO diary_solar_holiday VALUES (2,1,2,'신정','1');

INSERT INTO diary_solar_holiday VALUES (1,1,1,'신정','1');

INSERT INTO diary_solar_holiday VALUES (3,3,1,'삼일절','1');

INSERT INTO diary_solar_holiday VALUES (4,3,3,'조세의날','0');

INSERT INTO diary_solar_holiday VALUES (5,3,15,'상공의날','0');

INSERT INTO diary_solar_holiday VALUES (6,4,1,'향토예비군의날','0');

INSERT INTO diary_solar_holiday VALUES (7,4,5,'식목일','1');

INSERT INTO diary_solar_holiday VALUES (8,4,7,'보건의날','0');

INSERT INTO diary_solar_holiday VALUES (9,4,13,'임시정부수립기념일','0');

INSERT INTO diary_solar_holiday VALUES (10,4,19,'4.19기념일','0');

INSERT INTO diary_solar_holiday VALUES (11,4,20,'장애인의날','0');

INSERT INTO diary_solar_holiday VALUES (12,4,21,'과학의날','0');

INSERT INTO diary_solar_holiday VALUES (13,4,22,'정보통신의날','0');

INSERT INTO diary_solar_holiday VALUES (14,4,28,'충무공탄신일','0');

INSERT INTO diary_solar_holiday VALUES (15,5,1,'법의날.근로자의','0');

INSERT INTO diary_solar_holiday VALUES (16,5,5,'어린이의날','1');

INSERT INTO diary_solar_holiday VALUES (17,5,8,'어버이의날.재향','0');

INSERT INTO diary_solar_holiday VALUES (18,5,15,'스승의날.성년의','0');

INSERT INTO diary_solar_holiday VALUES (19,5,18,'5.18민주화운동기념일','0');

INSERT INTO diary_solar_holiday VALUES (20,5,19,'발명의날','0');

INSERT INTO diary_solar_holiday VALUES (21,5,31,'바다의날','0');

INSERT INTO diary_solar_holiday VALUES (22,6,5,'환경의날','0');

INSERT INTO diary_solar_holiday VALUES (23,6,6,'현충일','1');

INSERT INTO diary_solar_holiday VALUES (24,6,25,'6.25사변일','0');

INSERT INTO diary_solar_holiday VALUES (25,7,17,'제헌절','1');

INSERT INTO diary_solar_holiday VALUES (26,8,15,'광복절','1');

INSERT INTO diary_solar_holiday VALUES (27,9,17,'철도의날','0');

INSERT INTO diary_solar_holiday VALUES (28,10,1,'국군의날','0');

INSERT INTO diary_solar_holiday VALUES (29,10,3,'개천절','1');

INSERT INTO diary_solar_holiday VALUES (30,10,9,'한글날','0');

INSERT INTO diary_solar_holiday VALUES (31,10,15,'체육의날','0');

INSERT INTO diary_solar_holiday VALUES (32,10,20,'문화의날','0');

INSERT INTO diary_solar_holiday VALUES (33,10,21,'경찰의날','0');

INSERT INTO diary_solar_holiday VALUES (34,10,24,'국제연합일','0');

INSERT INTO diary_solar_holiday VALUES (35,10,31,'저축의날','0');

INSERT INTO diary_solar_holiday VALUES (36,11,3,'학생의날','0');

INSERT INTO diary_solar_holiday VALUES (37,11,11,'농업인의날','0');

INSERT INTO diary_solar_holiday VALUES (38,11,17,'순국선열의날','0');

INSERT INTO diary_solar_holiday VALUES (39,11,30,'무역의날','0');

INSERT INTO diary_solar_holiday VALUES (40,12,3,'소비자보호의날','0');

INSERT INTO diary_solar_holiday VALUES (41,12,5,'국민교육헌장선포기념일','0');

INSERT INTO diary_solar_holiday VALUES (42,12,10,'세계인권선언기념일','0');

INSERT INTO diary_solar_holiday VALUES (43,12,25,'성탄절','1');

 

CREATE TABLE diary_address (

   num int(4) NOT NULL auto_increment,

   id char(15) NOT NULL,

   name char(12) NOT NULL,

   home char(13),

   mobile char(13),

   birth char(10),

   etc char(20),

   PRIMARY KEY (num)

);

 

CREATE TABLE diary_anniverse (

   num int(4) NOT NULL auto_increment,

   id char(15) NOT NULL,

   timestamp int(4) NOT NULL,

   comment char(255) NOT NULL,

   PRIMARY KEY (num)

);

 

CREATE TABLE diary_memo (

   page int(4) NOT NULL auto_increment,

   id char(15) NOT NULL,

   text text,

   PRIMARY KEY (page)

);

 

CREATE TABLE dairy_schedule (

   num int(4) NOT NULL auto_increment,

   id char(15) NOT NULL,

   memo char(255) NOT NULL,

   level int(1) NOT NULL,

   timestamp int(4) NOT NULL,

   PRIMARY KEY (num)

);

 

2. 프로그램 구성

/ --  diary/-+

             |

             +-- index.html

             +-- weekly.html

             +-- date_func.html

             +-- daily.html

             +-- daily_write.html (등록폼)

             +-- daily_write_process.html (등록처리)

             +-- daily_change.html (수정 폼)

             +-- daily_change_process.html (수정 처리)

             +-- daily_delete.html (삭제 폼)

             +-- daily_delete_process.html (삭제 처리)

 

월간 및 년간 일정관리는 과제로 남긴다. 그리고 버그가 있을 수 있지만, 전체적인 알고리즘은 별문제 없을 것이다.

 

3. 메인화면(index.html)

<?

include "../user_function.html";

include "../dbconn.html";

 

include("admin.html");

 

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

?>

 

<HTML>

<HEAD>

<TITLE> 일정관리 </TITLE>

</HEAD>

 

<BODY BGCOLOR="#FFFFFF">

<?if(!$task) $task= "weekly";?>

<TABLE width=100%>

<TR>

        <TD align=center><FONT SIZE="4" COLOR=""><B>[ 일 정 관 리 ]</B></FONT></TD>

</TR>

<TR>

        <TD align=center><FONT SIZE="2" COLOR="black"> [ <A HREF="./?task=calendar&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"calendar"))echo("<b>Calendar</b>"); else echo("Calendar");?></A> ][ <A HREF="./?task=monthly&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"monthly"))echo("<b>Monthly</b>"); else echo("Monthly");?></A> ] [ <A HREF="./?task=weekly&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"weekly"))echo("<b>Weekly</b>"); else echo("Weekly");?></A> ] [ <A HREF="./?task=daily&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"daily"))echo("<b>Daily</b>"); else echo("Daily");?></A> ] [ <A HREF="./?task=memo&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"memo"))echo("<b>Memo</b>"); else echo("Memo");?></A> ] [ <A HREF="./?task=address&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"address"))echo("<b>Address</b>"); else echo("Address");?></A> ] [ <A HREF="./?task=search&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>"><?if(!strcmp($task,"search"))echo("<b>Search</b>"); else echo("Search");?></A> ]</FONT></TD>

</TR>

<TR>

        <TD>

<?

include("${task}.html");

?>

        </TD>

</TR>

</TABLE>

 

</BODY>

</HTML>

 

 

4. 주간 일정관리(weekly.html)

<?

include "../dbconn.html";

 

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

include "./date_func.html";

 

if ($sday && $syear && $smonth) {                       //날짜가 선택됐을때.

        $times=mktime(0,0,0,$smonth,$sday,$syear);

        $todate=date("w", $times);

 

}

else {

        $times=time();

        $todate=date("w", $times);

        $syear=date("Y", $times);

        $sday=date("d", $times);

 

        $smonth=date("m", $times);

        $times=mktime(0,0,0,$smonth,$sday,$syear);

 

}

$times1 = $times;

while (($todate=date("w", $times1))-1){ $times1 -=  86400; }                            //1 days (60*60*24)

$fmove=$times + 604800;                 //7 days (60*60*24*7)

$yy=date("Y", $fmove);

$mm=date("m", $fmove);

$dd=date("d", $fmove);

$bmove=$times - 518400;                 //6 days (60*60*24*6)

$yyy=date("Y", $bmove);

$mmm=date("m", $bmove);

$ddd=date("d", $bmove);

 

 

 

?>

<table width=100% border="0" cellspacing="0" cellpadding="0">

<tr valign="top">

<td bgcolor="#FFFFFF" valign="top" width=385>

<Table border="0" bgcolor="#ffffff" height='28'>

<tr><td align=left><font style='font-size:20pt;font-family:Arial Black;'color='lightblue'>

WEEKLY-----------------------

</td></tr>

</table>

<br>

<?

for($j=0; $j<=6; $j++) {

        $y=date("Y", $times1);

        $m=date("m", $times1);

        $d=date("d", $times1);

        if($j==4) {

?>

</td>

<td width=30>&nbsp;</td>

<td bgcolor="#FFFFFF" valign="top" width=385>

<Table width=100% border="0" bgcolor="#ffffff" height='28'>

<tr><td align=right><font style='font-size:20pt;font-family:Arial Black;'color='lightblue'>

&nbsp;-----------------------------</font><font style='font-size:12pt;font-family:Arial Black;' color='lightblue'><?echo("$y-$m");?></font>

</td></tr>

</table>

<br>

<?

        }

 

        $to=mktime(0,0,0,$m,$d,$y);

        $yo=date("D", $to);

        $yoo=date("w", $to);

 

        $holiday=get_holiday ($to);

        if ($temp=get_lunar ($to)) {

                $holiday.=" ".$temp;

        }

        $anniverse=get_anniverse ($user_id, $to);

        $dcolor="";

        if ($holiday && relax_holiday($to)) {   //공휴일

                $dcolor="pink";

        }

        else if ($anniverse) {

                $dcolor="skyblue";

        }

        else {

                if ($yoo == 0) {                //일요일

                        $dcolor="pink";

                }

                else {

                        $dcolor="skyblue";

                }

        }

?>

<table width="100%" height="100" border="0" cellpadding="1" cellspacing="0" bgcolor='white' align='center'>

<tr><td>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="white">

<tr><td>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="white">

<tr><td colspan='2' bgcolor="<?echo("$dcolor");?>" height="10"><b><?echo("$d");?></b> <?echo("$yo");?>&nbsp;[ <a href="./?task=daily&syear=<?echo "$y";?>&smonth=<?echo "$m";?>&sday=<?echo "$d";?>"><font color="blue">D</font></a> ]</td>

<td bgcolor="<?echo("$dcolor");?>" width="270" align='right'><?echo("$holiday $anniverse");?></td></tr>

<tr>

<?

$query= "select * from diary_schedule where timestamp=$to and id='$user_id'";

$result=mysql_query($query);

$resultnum=mysql_num_rows($result);

 

//다이어리 왼쪽 여백에 4일.. 오른쪽 여백에 3일을 표시하므로

//화면 오른쪽에 표시되는 날짜들에는 rows를 많이 준다.

$srow="6";      

if ($yoo==6 || $yoo==0) { //토요일과 일요일.. 다이어리 오른쪽..

        $srow="10";

}

 

if ($resultnum) {

        echo("<td colspan=\"3\" align='center'>

        <textarea cols='51' rows='$srow'class='textfield' readonly>");

                for($i=0; $i<$resultnum; $i++) {

                $level=mysql_result($result, $i, "level");

                $memo=mysql_result($result, $i, "memo");

                        if($level<3) {

                        //$memo=cut_string ($memo, 10);

                        echo("$memo\n");

                        }

                }

        echo("</textarea></td>\n");

}

else{

        echo("<td colspan=\"3\" align='center'><textarea cols='53' rows='$srow' readonly>&nbsp;</textarea></td>\n");

}

?>

</tr><tr><td align="left" colspan="3"></td>

</tr></table></td></tr></table></td></tr></table>

<?

        $y=date("Y", $times1+86400);

        $m=date("m", $times1+86400);

        $d=date("d", $times1=$times1+86400);    

}

?>

 

 

 

</td>

</tr>

<tr valign="top">

<td bgcolor="#FFFFFF" valign="top" align=center colspan="3"><br>

<A HREF="./?task=weekly&syear=<?echo "$yyy";?>&smonth=<?echo "$mmm";?>&sday=<?echo "$ddd";?>"><FONT SIZE="4" COLOR="black">◀</FONT></a>&nbsp;&nbsp;<A HREF="./?task=weekly&syear=<?echo "$yy";?>&smonth=<?echo "$mm";?>&sday=<?echo "$dd";?>"><FONT SIZE="4" COLOR="black">▶</FONT></a>

</td></tr>

 

</table>

 

5. 날짜 관련 사용자 함수(date_func.html)

<?

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

function get_holiday ($timestamp) { // 국경일을 구하는 함수 (입력:timestamp / 출력:국경일 이름)

        global $user_id;

        $month=date("m", $timestamp);

        $day=date("d", $timestamp);

 

        $result = mysql_query ("select * from diary_solar_holiday where month=$month and day=$day");

        if ($result && mysql_num_rows($result)) {

                $dummy = mysql_result ($result, 0, "comment");

        }

        

        return $dummy;

}

 

function relax_holiday ($timestamp) { // 국경일을 구하는 함수 (입력:timestamp / 출력:국경일 이름)

        global $user_id;

        $month=date("m", $timestamp);

        $day=date("d", $timestamp);

 

        $result = mysql_query ("select * from diary_solar_holiday where month=$month and day=$day");

        if ($result && mysql_num_rows($result)) {

                if (mysql_result($result, 0, "relax")) { $dummy="red"; }

        }

        

        $result = mysql_query ("select * from diary_lunar_holiday where timestamp=$timestamp");

        if ($result && mysql_num_rows($result)) {

                if (mysql_result($result, 0, "relax")) { $dummy="red"; }

        }

 

        return $dummy;

}

 

function get_lunar ($timestamp) { // 음력 국경일을 구하는 함수 (입력:timestamp / 출력:국경일 이름)

        global $user_id;

        $month=date("m", $timestamp);

        $day=date("d", $timestamp);

 

        $result = mysql_query ("select * from diary_lunar_holiday where timestamp=$timestamp");

        if ($result && mysql_num_rows($result)) {

                $dummy = mysql_result ($result, 0, "comment");

        }

        

        return $dummy;

}

 

function get_anniverse ($user, $timestamp) { // 개인적인 개념일을 구하는 함수 (입력:사용자아이디, timestamp / 출력:기념일 내용)

 

        $result = mysql_query ("select (comment) from diary_anniverse where timestamp=$timestamp and id='$user'");

        if ($result && mysql_num_rows($result)) { return mysql_result ($result, 0, "comment"); }

}

?>

 

6. 일간 일정관리 프로그램(daily.html)

<?

include "../dbconn.html";

 

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

include "./date_func.html";

 

//echo ("$syear $smonth $sday");

 

if ($sday && $syear && $smonth) {                       //날짜가 선택됐을때.

        $times=mktime(0,0,0,$smonth,$sday,$syear);

        $todate=date("w", $times);

 

}

else {

        $times=time();

        $todate=date("w", $times);

        $syear=date("Y", $times);

        $sday=date("d", $times);

 

        $smonth=date("m", $times);

 

        $times=mktime(0,0,0,$smonth,$sday,$syear);

 

}

 

?>

<script language="JavaScript">

        <!--

        function MM_swapImgRestore() { //v3.0

        var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

        }

        

        function MM_preloadImages() { //v3.0

        var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

        }

 

        function MM_findObj(n, d) { //v3.0

        var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

        if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

        for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;

        }

 

        function MM_swapImage() { //v3.0

        var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

        if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

        }

 

        function MM_openBrWindow(theURL,winName,features) { //v2.0

        window.open(theURL,winName,features);

        }

 

        function lsend(){

                document.dailywrite.submit();

        }

 

        //-->

</script>

<?

if (!$page) { $page=1; }

$max_content = 7;

 

$query = "select * from diary_schedule where timestamp=$times and id='$user_id' order by level";

$result = mysql_query($query);

 

if (mysql_error()) { echo ("질의어 : $query<br>에러 : ".mysql_error()."<br>"); }

 

$number = mysql_num_rows($result);

// echo "$number => $query";

$total=intval(($number+($max_content-1))/$max_content);

if ($page>$total) { $page=$total; }

if ($page <= 0 ) $page = 1;

 

$start = $page*$max_content - ($max_content-1) - 1;

$end = $start + $max_content -1;

 

$prevp="./?page=".($page-1)."&task=daily&syear=${syear}&smonth=${smonth}&sday=${sday}";

$nextp="./?page=".($page+1)."&task=daily&syear=${syear}&smonth=${smonth}&sday=${sday}";

 

?>

<table width=100% border="0" cellspacing="0" cellpadding="0">

<tr valign="top">

<td bgcolor="#FFFFFF" valign="top" width=385>

<!-- 왼쪽 페이지 시작 -->

<Table width=100% border="0" bgcolor="#ffffff" height='28'>

<tr><td align=left><font style='font-size:20pt;font-family:Arial Black;'color='#eeaa33'>

DAILY-----------------------

<font size='1'> </font><font size='2' color=black>[ <a href='#' onClick="MM_openBrWindow('./daily_write.html?task=<?echo("$task");?>&syear=<?echo "$syear";?>&smonth=<?echo "$smonth";?>&sday=<?echo "$sday";?>','write_daily','width=380,height=140')">등록</a> ]</font>

</td></tr></table>

<table width='100%' border='1' cellpadding='0' cellspacing='0'><tr><td>

<table width=100% border="0" cellspacing="0" cellpadding="0">

<tr><td valign='top' align='right'>

<table width='100%' height='90' border=0 bgcolor='#eeeeee' cellpadding='1'>

<tr><td ><b><?echo("$syear");?>년 <?echo("$smonth");?>일 <?echo("$sday");?>일&nbsp;</b></td></tr>

<?

        $query = "select * from diary_anniverse where timestamp=$times and id='$user_id'";

        $results = mysql_query($query);

        if(mysql_num_rows($results)!=0){

                $anniverse = mysql_result($results, 0,"comment");

        }

 

$holiday=get_holiday (mktime(0,0,0, $smonth, $sday,1970));

$lunar=get_lunar (mktime(0,0,0, $smonth, $sday,$syear));

$t_count=0;

if ($holiday) { echo("<tr><td >국경일 : ".$holiday."</td></tr>"); $t_count++; }

if ($anniverse) { echo("<tr><td >기념일 : ".$anniverse."</td></tr>"); $t_count++; }

if ($lunar) { echo("<tr><td >음력기념일 : ".$lunar."</td></tr>"); $t_count++; }

 

for ($loops=0; $loops<3-($t_count); $loops++) {

        echo("<tr><td >&nbsp;</td></tr>");      

}

 

?>

</table>

</td></tr></table>

<br>

<table border=0 width='100%' cellspacing='0' cellpadding='0'>

<tr height=335><td valign='top'>

<?

for( $i = $start ; $i <= $start+2; $i++)

{

        if ($i >= $number || $i<0)

        {       break; }

        else

        {

                

                $value = mysql_result($result, $i, "level");

?>

<center><textarea cols='50' rows='5' readonly

<?

                if ($value==1) {echo("style='color:darkred'>".mysql_result($result, $i, "memo"));}

                else if ($value==2) {echo("style='color:darkblue'>".mysql_result($result, $i, "memo"));}

                else { echo (">".mysql_result($result, $i, "memo")); }

?>

</textarea>

<br>

<table border=0 width=275 height=1>

<tr><td valign='middle' style='font-size:9pt'><p align='left'>중요도 :

<?

                if(mysql_result($result, $i, "level")==1)

                {echo("<font color=red>아주중요 ※</font>");}

                if(mysql_result($result, $i, "level")==2)

                {echo("중요");}

                if(mysql_result($result, $i, "level")==3)

                {echo("조금중요");}

                if(mysql_result($result, $i, "level")==4)

                {echo("보통");}

$num = mysql_result($result, $i,"num");

?>

</p></td>

<td valign='middle'width=110><p align='right'>[ <a href='#' onclick="MM_openBrWindow('./daily_change.html?num=<?echo $num;?>','change','width=380,height=140')">수정</a>&nbsp;|&nbsp;<a href='#' onclick="MM_openBrWindow('./daily_delete.html?num=<?echo $num;?>','delete','width=380,height=140')">삭제</a> ]</p>

</td></tr></table>

 

<?

        }

}

$pages = 2 * $page - 1;

?>

</td></tr>

<tr><td style='font-size:9pt' align='center'>

<?

echo("-$pages-");

?>

</td></tr>

</table>

</td></tr></table>

<!-- 왼쪽 페이지 끝 -->

</td>

<td width=30>&nbsp;</td>

<td bgcolor="#FFFFFF" valign="top" width=385>

<!-- 오른쪽 페이지 시작 -->

<br>

<table width='100%' border='0' cellpadding='0' cellspacing='0'>

<form action='./?task=<?echo("$task");?>' method='post' name='dailywrite'>

<tr ><td style='font-size:20pt;font-family:Arial Black; color=#eeaa33' colspan='2' valign='bottom' align='right'>

<table border='0' cellspacing='0' cellpadding='0' style='font-size:8pt; color=black'>

<tr><td height='28'><select name='syear'>

<?for ($loops=1999; $loops<=2005; $loops++) {

        echo("<option value='$loops'");

        if ($syear==$loops){echo('selected');}

        echo(">$loops</option>");

}

?></select></td>

<td>&nbsp;년&nbsp;&nbsp;</td><td><select name='smonth'>

<?for ($loops=1; $loops<=12; $loops++) {

        echo("<option value='$loops'");

        if ($smonth==$loops){echo('selected');}

        echo(">$loops</option>");

}

?></select></td>

<td>&nbsp;월&nbsp;&nbsp;</td><td><input type = 'text' name = 'sday' size = '3' value = '<?echo("$sday");?>'></td><td>&nbsp;일&nbsp;&nbsp;</td>

<td><input type='button' onclick='lsend();' value=" Go "  valign='middle'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td></tr></table>

</td></tr></form></table>

<table width='100%' border='1' cellpadding='0' cellspacing='0'><tr><td>

<table border=0 width='100%' cellspacing='0' cellpadding='0'>

<tr><td>&nbsp;</td></tr><tr height=425><td valign='top' align=center>

<?

for( $i = $start+3 ; $i <= $end ; $i++)

{

        

        if ($i >= $number || $i<0)

        {       break; }

        else

        {

                $value = mysql_result($result, $i, "level");

 

?>

<center><textarea cols='50' rows='5' readonly

<?

                if ($value==1) {echo("style='color:darkred'>".mysql_result($result, $i, "memo"));}

                else if ($value==2) {echo("style='color:darkblue'>".mysql_result($result, $i, "memo"));}

                else { echo (">".mysql_result($result, $i, "memo")); }

?>

</textarea>

<br>

<table border=0 width=275 height=1>

<tr><td valign='middle' style='font-size:9pt'><p align='left'>중요도 :

<?

                if(mysql_result($result, $i, "level")==1)

                {echo("<font color=red>아주중요 ※</font>");}

                if(mysql_result($result, $i, "level")==2)

                {echo("중요");}

                if(mysql_result($result, $i, "level")==3)

                {echo("조금중요");}

                if(mysql_result($result, $i, "level")==4)

                {echo("보통");}

$num = mysql_result($result, $i,"num");

?>

</p></td>

<td valign='middle'width=110><p align='right'>[ <a href='#' onclick="MM_openBrWindow('./daily_change.html?num=<?echo $num;?>','change','width=380,height=140')">수정</a>&nbsp;|&nbsp;<a href='./task=$task&task1=delete&page=1&num=<?echo $num;?>' onclick="return confirm('정말로 삭제하시겠습니까?');">삭제</a> ]</p>

</td></tr></table>

 

<?

        }

}

$pages = 2 * $page;

 

?>

 

</td></tr>

<tr><td style='font-size:9pt' align='center'>

<?

echo("-$pages-");

?>

</td></tr>

</table>

</td></tr></table>

</td></tr>

<tr valign="top">

<td bgcolor="#FFFFFF" align=center colspan="3"><br>

<?

if ($page==1) { echo"<FONT SIZE=\"4\" COLOR=\"black\">◀</FONT>"; }

else {

?>

<A HREF="<?echo "$prevp";?>"><FONT SIZE="4" COLOR="blue">◀</FONT></a>

<?}?>

&nbsp;&nbsp;

<?

if ($total <= $page) { echo"<FONT SIZE=\"4\" COLOR=\"black\">▶</FONT>"; }

else {

?>

<A HREF="<?echo "$nextp";?>"><FONT SIZE="4" COLOR="blue">▶</FONT></a>

<?}?>

</td></tr>

</table>

 

7. 일간 일정 등록(daily_write.html, daily_write_process.html)

파일명 : daily_write.html

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

?>

<html>

<head><title>내용 등록</title>

<script language='javascript'>

<!--

        function lsend(){

                document.dailywrite.submit();

        }

//-->

</script>

</head>

<body>

<center>

<table width='360 cellspacing='1' cellpadding='1' border='0' style='font-size:9pt; font-family:Tahoma' bgcolor='#FFFFFF'>

<? echo ("<form action='./daily_write_process.html?task=${task}&task1=write_process&syear=$syear&smonth=$smonth&sday=$sday' method='post'  name='dailywrite'>");?>

        <tr>

                <td bgcolor='#EEEEEE' width='100'><center>스케줄내용</td>

                <td colspan=2><textarea cols='40' rows='5' name='memo'></textarea></td>

        </tr>

        <tr>

                <td bgcolor='#EEEEEE' width='100'>중요도</td>

                <td><center><select name="level">

                                <option value="4" selected>보통</option>

                                <option value="3">조금중요</option>

                                <option value="2">중요</option>

                                <option value="1">아주중요</option>

                                </select>

                </td>

                <td valign='middle'><center>

                        <input type='button' onclick='lsend();' value="등록" >

                        <input type='button' onclick='window.close();' value="취소" >

                </td>

        </tr>

        </form>

</table>

</body>

</html>

 

 

파일명 : daily_write_process.html

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

include "./date_func.html";

 

if ($sday && $syear && $smonth) {                       //날짜가 선택됐을때.

        $times=mktime(0,0,0,$smonth,$sday,$syear);

        $todate=date("w", $times);

 

}

else {

        $times=time();

        $todate=date("w", $times);

        $syear=date("Y", $times);

        $sday=date("d", $times);

 

        $smonth=date("m", $times);

        $times=mktime(0,0,0,$smonth,$sday,$syear);

 

}

 

if(!strcmp($task1,"write_process"))

{

        

        $query = "insert into diary_schedule (memo,level,timestamp,id) values ('$memo',$level,$times,'$user_id')";

//      echo $query;

        $result = mysql_query($query);

        echo ("<body onload=\"opener.location.reload(); window.close();\"></body>");

        exit();

}

?>

 

8. 일간 일정 수정(daily_change.html, daily_change_process.html)

파일명 : daily_chage.html

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

?>

<html>

<head><title>내용 수정</title>

<script language='javascript'>

<!--

        function lsend(){

                document.dailywrite.submit();

        }

//-->

</script>

</head>

<body>

<center>

<table width='360' cellspacing='1' cellpadding='1' border='0' style='font-size:9pt; font-family:Tahoma' bgcolor='#FFFFFF'>

        <form action='./daily_change_process.html?task1=change_process&num=<?echo($num);?>' method='post' name='dailywrite'>

        <tr>

                <td bgcolor='#EEEEEE'

width='100'><center>스케줄<br>내용</td>

                <td colspan=2><textarea cols='40' rows='5' name='memo'><?

                $query = "select * from diary_schedule where num=$num and id='$user_id'";

                $result = mysql_query($query);

                echo(mysql_result($result, 0, "memo"));

                ?></textarea></td>

        </tr>

        <tr>

                <td bgcolor='#EEEEEE' width='100'><center>중요도</td>

                <td><center><select name="level"><?

                $query = "select * from diary_schedule where num=$num and id='$user_id'";

                $result = mysql_query($query);

                $check = mysql_result($result, 0, "level");

                ?>

                                <option value="1" <? if ($check==1) { echo("selected"); }?>>아주중요</option>

                                <option value="2" <? if ($check==2) { echo("selected"); }?>>중요</option>

                                <option value="3" <? if ($check==3) { echo("selected"); }?>>조금중요</option>

                                <option value="4" <? if ($check==4) { echo("selected"); }?>>보통</option></select>

                </td>

                <td valign='middle'><center>

                        <input type='button' onclick='lsend();' value="수정" >

                        <input type='button' onclick='window.close();' value="취소" >

                </td>

        </tr>

        </form>

</table>

</body>

</html>

 

 

파일명 : daily_chage_process.html

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

include "./date_func.html";

 

 

if(!strcmp($task1,"change_process"))

{

        

        $query="update diary_schedule set memo='$memo' where num=$num and id='$user_id'";

        mysql_query($query);

        $query="update diary_schedule set level='$level' where num=$num and id='$user_id'";

        mysql_query($query);

        

        echo ("<body onload=\"opener.location.reload(); window.close();\"></body>");

        exit();

}

?>

 

9. 일간 일정 삭제(daily_delete.html, daily_delete_process.html)

파일명 : daily_delete.html

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

?>

<html>

<head><title>내용 삭제</title>

<script language='javascript'>

<!--

        function lsend(){

                document.dailywrite.submit();

        }

//-->

</script>

</head>

<body>

<center>

<table width='360' cellspacing='1' cellpadding='1' border='0' style='font-size:9pt; font-family:Tahoma' bgcolor='#FFFFFF'>

        <form action='./daily_delete_process.html?task1=delete_process&num=<?echo($num);?>' method='post' name='dailywrite'>

        <tr>

                <td bgcolor='#EEEEEE' width='100'><center>스케줄<br>내용</td>

                <td colspan=2><table width='100%' cellspacing='0' cellpadding='0' border='1' style='font-size:9pt; font-family:Tahoma' bgcolor='#FFFFFF' height=80><tr><td><?

                $query = "select * from diary_schedule where num=$num and id='$user_id'";

                $result = mysql_query($query);

                echo(mysql_result($result, 0, "memo"));

                ?></td>

        </tr></table></td>

        </tr>

        <tr>

                <td bgcolor='#EEEEEE' width='100'><center>중요도</td>

                <td><center><?

                $query = "select * from diary_schedule where num=$num and id='$user_id'";

                $result = mysql_query($query);

                $check = mysql_result($result, 0, "level");

                ?>

                                <? if ($check==1) { echo("아주중요"); }?>

                                <? if ($check==2) { echo("중요"); }?>

                                <? if ($check==3) { echo("조금중요"); }?>

                                <? if ($check==4) { echo("보통"); }?>

                </td>

                <td valign='middle'><center>

                        <input type='button' onclick='lsend();' value="삭제" >

                        <input type='button' onclick='window.close();' value="취소" >

                </td>

        </tr>

        </form>

</table>

</body>

</html>

 

 

파일명 : daily_delete_process.html

 

<?

include "../user_function.html";

include "../dbconn.html";

 

include ("../admin.html");

if(!$user_id || strcmp($row->logindate,$user_logindate)) {

      echo ("<meta http-equiv='Refresh' content='0; URL=../'>");

      exit;

}

 

include "./date_func.html";

 

 

if(!strcmp($task1,"delete_process"))

{

        

        $query="delete from diary_schedule where num=$num and id='$user_id'";

        mysql_query($query);

        

        echo ("<body onload=\"opener.location.reload(); window.close();\"></body>");

        exit();

}

?>

 

 

[목차]

개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.