DUT004.php
3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
//*****************************************************************************
//*
//* プログラム名:当番表
//* プログラムID:DUT004.php
//* 機能 :更新.挿入.削除
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
//***************************
//* インクルードファイル
//***************************
include("./include/session_start.inc");
include("./include/SessionChk.inc");
include('./include/smarty.conf');
//20081007 POST処理へ変更
//include("inc/subRepURI.inc");
//**** DB接続 ****//
include("./include/dbcon.inc");
$strSQL="";
$objRecSet="null";
//20081007 POST処理へ変更
//$contents = mb_convert_encoding(subRepURI($contents), "EUC-JP", "auto");
$contents = mb_convert_encoding($contents, "eucJP-win", "auto");
//予約日
$touban_st_date=$st_year."/".$st_mon."/".$st_day;
$touban_ed_date=$ed_year."/".$ed_mon."/".$ed_day;
//予約時間
if ($st_hour != ""){
if ($st_minute==""){
$st_minute="00";
}
$touban_st_time=$st_hour.":".$st_minute.":00";
}
if ($ed_hour != ""){
if ($ed_minute==""){
$ed_minute="00";
}
$touban_ed_time=$ed_hour.":".$ed_minute.":00";
}
$reg_date =date("Y/m/d");
$reg_time=date("H:i:s");
//スケジュールリンクの場合
echo "intlink = ".$intlink."\n";
if ($intlink==1){
//SeqNo取得
$strSQL = "Select seq FROM touban_tbl Order By seq desc";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(seq取得)");
exit;
}
$intCnt=pg_numrows($objRecSet);
if ($intCnt == 0){
$intCnt=$intCnt+1;
}
else{
$objRevData = pg_fetch_object($objRecSet, 0);
$intCnt=$objRevData->seq+1;
}
$strSQL="";
$objData="null";
if ($strsel==""){
$strsel="/".$PHP_SYAIN_CD ."/";
}else{
$strsel="/".$PHP_SYAIN_CD .$strsel;
}
$strSQL = "Insert Into touban_tbl (seq,toban_no,syain_cd,touban_st_date,touban_ed_date,".
"touban_st_time,touban_ed_time,touban_contents,link_cd)".
" VALUES ($intCnt,$intTantou,'$strsel','$touban_st_date','$touban_ed_date',".
"'$touban_st_time','$touban_ed_time','".addslashes($contents)."',1)";
echo "strSQL = ".$strSQL."\n";
$objData = pg_exec($strSQL);
if($objData==false){
echo("SQL実行に失敗しました(Insert)");
exit;
}
header("Location:TOP000.php");
}
//更新処理
if ($intsyorists==1){
//データ更新
if ($intsts != 0){
$strSQL="";
$objData="null";
$strSQL = "Update touban_tbl Set toban_no=$intTouban,syain_cd='/$strsel',".
"touban_st_date='$touban_st_date',touban_ed_date='$touban_ed_date',".
"touban_st_time='$touban_st_time',touban_ed_time='$touban_ed_time',".
"touban_contents='".addslashes($contents)."'".
"Where seq=$intsts";
$objData = pg_exec($strSQL);
if($objData==false){
echo("SQL実行に失敗しました(Update)");
exit;
}
}else {
//SeqNo取得
$strSQL = "Select seq FROM touban_tbl Order By seq desc";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(seq取得)");
exit;
}
$intCnt=pg_numrows($objRecSet);
if ($intCnt == 0){
$intCnt=$intCnt+1;
}
else{
$objRevData = pg_fetch_object($objRecSet, 0);
$intCnt=$objRevData->seq+1;
}
//データ挿入(リンクなし)
//$intTouban="3";
$strSQL="";
$objData="null";
echo "intTouban = ".$intTouban;
$strSQL = "Insert Into touban_tbl (seq,toban_no,syain_cd,touban_st_date,touban_ed_date,".
"touban_st_time,touban_ed_time,touban_contents,link_cd)".
" VALUES ($intCnt,$intTouban,'/$strsel','$touban_st_date','$touban_ed_date',".
"'$touban_st_time','$touban_ed_time','".addslashes($contents)."',0)";
$objData = pg_exec($strSQL);
if($objData==false){
echo("SQL実行に失敗しました(Insert)");
exit;
}
}
}else{
//削除
$strSQL = "Delete FROM touban_tbl WHERE seq = $intsts";
$objRec = pg_exec($strSQL);
if($objRec==false){
echo("SQL実行に失敗しました(Delete)");
exit;
}
}
?>