evententry.php
8.16 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?PHP
ob_start();
$home ="main_menu.php";
require('function/sortrog.inc');
require('function/operatezero.inc');
require('function/tblctl.inc');
require('function/tblmake.inc');
fun_backhome($hiduke);
if(isset($sousinn)){
require('function/readcsv.inc' );
$file_name = "data/usr/username.csv";
$tbl_cnt=0;
$found1=0;
$found2=0;
$usr_tbl=array();
$usr_tbl=fun_csvread($usr_tbl,$file_name);
$id = 0;
switch($found=userchk($usr_tbl,$usr_name,$usr_pword,$tbl_cnt))
{
case "1":
$dd = 2;
break;
case "2":
$errmsg="パスワードが違います";
fun_errprint($errmsg,$hiduke);
exit;
case "3":
$errmsg="ユーザー名・パスワードはguestで入力してください";
fun_errprint($errmsg,$hiduke);
exit;
case "4":
$dd = 1;
break;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Homepage Builder V6.0.1 for Windows">
<META http-equiv="Content-Type" content="text/html; charset=shift_jis">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>イベント登録</TITLE>
<SCRIPT type="text/javascript" src="function/checkdata.js"></SCRIPT>
<link href="css/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<br>
<?PHP fun_maketbl(1,"登録"); ?>
<FORM method="POST" name=event action="evententry.php" onsubmit="return datacheck();">
<?PHP fun_makeline(1,0,0);?>
<FONT size="-1">イベント名称:<BR></FONT>
<INPUT size="100" type="text" name="eventname"><FONT color="#ff0000">(必須)</FONT><BR>
<?PHP fun_makeline(2,0,0);?>
<BR>
<?PHP fun_makeline(1,0,0);?><BR>
<FONT size="-1">
期間1:<BR>
<SELECT name="fyear">
<?PHP //コンボボックスに変更
list($eventy,$eventm,$eventd)=split(",",$hiduke);
// for ($intCnt = $eventy-1 ; $intCnt <= $eventy+1 ; $intCnt++) {
$intCnt = $eventy;
echo "<option value=".$intCnt;
if ($fyear==$intCnt){
echo " selected";
}
echo ">".$intCnt."年</option>";
// }
?>
</SELECT>
<SELECT name="fmon">
<?PHP
for ($intCnt = 1 ; $intCnt <= 12 ; $intCnt++) {
if (strlen($intCnt)==1){
echo "<option value=0".$intCnt;
}else{
echo "<option value=".$intCnt;
}
if ($eventm == $intCnt){
echo " selected";
}
echo ">".$intCnt."月</option>";
}
?>
</SELECT>
<SELECT name="fday">
<?PHP
for ($intCnt = 1 ; $intCnt <= 31 ; $intCnt++) {
if (strlen($intCnt)==1){
echo "<option value=0".$intCnt;
}else{
echo "<option value=".$intCnt;
}
if ($eventd == $intCnt){
echo " selected";
}
echo ">".$intCnt."日</option>";
}
?>
</SELECT>
〜
<SELECT name="tyear">
<?PHP //コンボボックスに変更
for ($intCnt = $eventy ; $intCnt <= $eventy+1 ; $intCnt++) {
echo "<option value=".$intCnt;
if ($eventy==$intCnt){
echo " selected";
}
echo ">".$intCnt."年</option>";
}
?>
</SELECT>
<SELECT name="tmon">
<?PHP
for ($intCnt = 1 ; $intCnt <= 12 ; $intCnt++) {
if (strlen($intCnt)==1){
echo "<option value=0".$intCnt;
}else{
echo "<option value=".$intCnt;
}
if ($eventm == $intCnt){
echo " selected";
}
echo ">".$intCnt."月</option>";
}
?>
</SELECT>
<SELECT name="tday">
<?PHP
for ($intCnt = 1 ; $intCnt <= 31 ; $intCnt++) {
if (strlen($intCnt)==1){
echo "<option value=0".$intCnt;
}else{
echo "<option value=".$intCnt;
}
if ($eventd == $intCnt){
echo " selected";
}
echo ">".$intCnt."日</option>";
}
print("<input type=\"hidden\" name=\"hiduke\" value =$hiduke>");
?>
</SELECT>
<br>
<FONT size="-1">ホームページアドレス:<BR></FONT>
<INPUT size="100" type="text" name="hpadrs"><BR><BR>
<FONT size="-1">吹き出し文言:<FONT color="#ff0000" size="-1"></FONT><BR></FONT>
<TEXTAREA rows="9" cols="71" name="tipword"></TEXTAREA><BR></FONT>
<?PHP fun_makeline(2,0,0);?>
<BR>
<INPUT type="submit" name="submit" value=" 登録 "><INPUT type="reset" name="cancel" value="キャンセル"><INPUT type="hidden" name="dd" <?PHP print("value = $dd")?>></DIV><A href=<?PHP print($home); ?>><IMG src="image/return.gif" width="58" height="36" border="0" align="right" alt="イベントカレンダー"></A>
<INPUT type="hidden" name="pageName" value="<?PHP echo $pageName ?>">
</FORM>
<?PHP fun_maketbl(2,0);?>
<?PHP
// カレンダー画面から引き継いだ情報を展開する。
list($eventy,$eventm,$eventd)=split(",",$hiduke);
// Keyの日付を作成する。
if ($jun != "")
{
$from_date = $jyear.fun_addzero($jmon).$jun;
}
else
{
$from_date = $fyear.fun_addzero($fmon).fun_addzero($fday);
}
$to_date = $tyear.fun_addzero($tmon).fun_addzero($tday);
// 送信ボタンが押されたときは、フォームの内容をファイルに保存する
if ($submit != ""){
// タグ無効化等の処理をする
$eventname = convstr($eventname);
$hpadrs = convstr($hpadrs);
$place = convstr($place);
$tipword = convstr($tipword);
$eventymd = $from_date;
//変更後の日付を取得
$after_yy = substr($eventymd,0,4);
$after_mm = substr($eventymd,4,2);
$after_dd = substr($eventymd,6,2);
// ログファイル名###
$ddir = "data/event/";
//イベント登録
if (trim($to_date) ==""){
$int_E_date=date("z",mktime(0,0,0,$after_mm,$after_dd,$after_yy));
}else{
$after_to_yy = substr($to_date,0,4);
$after_to_mm = substr($to_date,4,2);
$after_to_dd = substr($to_date,6,2);
$int_E_date=date("z",mktime(0,0,0,$after_to_mm,$after_to_dd,$after_to_yy));
}
$int_S_date=date("z",mktime(0,0,0,$after_mm,$after_dd,$after_yy));
for($intdateCnt = 0; $intdateCnt < ($int_E_date -$int_S_date+1) ; $intdateCnt++){
//期間1、期間2の編集
$str_wk_dd = $after_dd + $intdateCnt;
$str_wk_dd = fun_addzero($str_wk_dd);
$str_edit_date=date("Ymd",mktime(0,0,0,$after_mm,$str_wk_dd,$after_yy));
//echo "日付".$str_edit_date."<BR>";
//変更後の日付を取得
$after_yy2 = substr($str_edit_date,0,4);
$after_mm2 = substr($str_edit_date,4,2);
$after_dd2 = substr($str_edit_date,6,2);
//入力日付が引き継ぎ情報から変更された場合
//if (fun_addzero($eventm) != $after_mm){
// $eventm = $after_mm;
//}
$logfile = "eventmst".$after_mm2.".csv";
//$logfile = "eventmst".fun_addzero($eventm).".csv";
$filename = $ddir.$logfile;
// ログファイルを開く
$fp = @fopen("$filename", "r+");
if ($fp == False)
{
echo $filename = $ddir.$logfile;
print("ファイルを開くのに失敗しました。<BR>\n");
exit;
}
/*
if ($from_date == $to_date){
$tyear = "";
$tmon = "";
$tday = "";
}
*/
// ファイルをロックする
set_file_buffer($fp, 0);
flock($fp, 2);
// ファイルポインタをファイルの先頭に戻す
rewind($fp);
// メッセージの読み込み数を数える変数を初期化する
$count = 0;
// ファイルの最後まで読み込む
while ($readbuf = fgetcsv($fp,4096))
{
$buf[$count] = $readbuf;
$buf[$count][0]=$buf[$count][0];
$buf[$count][1]=$buf[$count][1];
$buf[$count][2]='"'.$buf[$count][2].'"';
$buf[$count][3]=$buf[$count][3];
$buf[$count][4]=$buf[$count][4];
$buf[$count][5]=$buf[$count][5];
$buf[$count][6]=$buf[$count][6];
$buf[$count][7]=$buf[$count][7];
$buf[$count][8]=$buf[$count][8];
$buf[$count][9]=$buf[$count][9];
$buf[$count][10]='"'.$buf[$count][10].'"';
$buf[$count][11]='"'.$buf[$count][11].'"';
$count++;
}
// 配列の最後に、入力されたメッセージを追加する
//echo $str_edit_date."<BR>";
$buf[$count][0]=$str_edit_date;
$buf[$count][1]=fun_eveidx($buf,$count,$str_edit_date);
$buf[$count][2]='"'.$eventname.'"';
$buf[$count][3]=$fyear;
$buf[$count][4]=fun_addzero($after_mm);
$buf[$count][5]=fun_addzero($after_dd);
$buf[$count][6]=$tyear;
$buf[$count][7]=fun_addzero($tmon);
$buf[$count][8]=fun_addzero($tday);
$buf[$count][9]=$place;
$buf[$count][10]='"'.$hpadrs.'"';
$buf[$count][11]='"'.$tipword.'"';
usort($buf,idxsort);
usort($buf,mycmp);
// ファイルポインタを先頭に戻す
rewind($fp);
// メッセージをファイルに書き込む
for ($i = 0; $i <= $count; $i++){
$tbl_save = join(",",$buf[$i]);
//echo join(",",$buf[$i])."<BR>";
fputs($fp, $tbl_save . "\n");
}
unset($buf);
// ファイルのロックを解除して、ファイルを閉じる
flock($fp, 3);
fclose($fp);
}
/* ---------------------------------------------------------------------- */
print("<script>location.replace('main_menu.php');</script></BODY></HTML>");
}
?>
</BODY>
</HTML>