-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmins.php
407 lines (381 loc) · 15.7 KB
/
admins.php
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<?php
/*
@package xajax
@version $Id: helloworld.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Section: Standard xajax startup
- include <xajax.inc.php>
- instantiate main <xajax> object
*/
require ('./xajax_core/xajax.inc.php');
$xajax = new xajax();
/*
- enable deubgging if desired
- set the javascript uri (location of xajax js files)
*/
//$xajax->configure('debug', true);
$xajax->configure('javascript URI', './');
/*
Function: inquiry
inquiry
*/
function inquiry($start_date)
{
global $connect;
$objResponse = new xajaxResponse();
$setTime=$start_date;
if(session_is_registered('reg_date')){
$_SESSION['session_reg_date']=str_replace("-","",$start_date);//세션에 저장
}
$start_date=str_replace("-","",$start_date);// '-' 제거
$selSql="SELECT * FROM `toto_log` where `reg_date` = '".$start_date."' ORDER BY `reg_time` ASC";
$result = mysql_query($selSql, $connect);
$total = mysql_num_rows($result); // 총 레코드 수
$num=0;
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td>순번</td>
<td>접속 아이디</td>
<td>접속 ip</td>
<td>열람 페이지</td>
<td>접속시간</td>
</tr>';
if($total){
while($total--){
$num++;
$rows = mysql_fetch_row($result);
$updated=$updated.'<tr>
<td>'.$num.'</td>
<td>'.$rows[1].'</td>
<td>'.$rows[2].'</td>
<td>'.$rows[3].'</td>
<td>'.date("H:i:s",$rows[4]).'</td>
</tr>';
}
}else{
$updated=$updated.'<tr><td colspan="5">자료가 없습니다.</td></tr>';
}
$updated=$table.$thead.$updated.'</table>';
$msg=$_SESSION['sunap']."님은 ".$setTime."일자 자료입력 중입니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->assign('content', 'innerHTML', $updated);
return $objResponse;
}
function itemView($table_name){
global $connect;
$objResponse = new xajaxResponse();
$selSql="SELECT * FROM `".$table_name."`";
$result = mysql_query($selSql, $connect);
$total = mysql_num_rows($result); // 총 레코드 수
$num=0;
$colSql="SHOW COLUMNS FROM `".$table_name."`";
$colRes = mysql_query($colSql, $connect);
$colTot = mysql_num_rows($colRes); // 총 레코드 수
if($colTot!=5) // 다른 table을 열람할 수 없게 함(카테고리, 진료실 관련 테이블의 column 수는 5개로 동일 함.
exit;
while($colTot--){
$colRows = mysql_fetch_row($colRes);
$colName[] = $colRows[0];
}
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td height="30px;">'.$colName[0].'</td>
<td>'.$colName[1].'</td>
<td>'.$colName[2].'</td>
<td>'.$colName[3].'</td>
<td>'.$colName[4].'</td>
<td></td>
</tr>';
if($total){
while($total--){
$num++;
$rows = mysql_fetch_row($result);
$updated=$updated.'<tr>
<td height="30px;">'.$num.'</td>
<td><input type="text" id="two_'.$num.'" name="two_'.$num.'" value="'.$rows[1].'" style="text-align:center"></td>
<td><input type="text" id="three_'.$num.'" name="three_'.$num.'" value="'.$rows[2].'" style="text-align:center"></td>
<td><input type="text" id="four_'.$num.'" name="four_'.$num.'" value="'.$rows[3].'" style="text-align:center"></td>
<td><input type="text" id="five_'.$num.'" name="five_'.$num.'" value="'.$rows[4].'" style="text-align:center"></td>
<td><input type="button" value="수정" onclick="xajax_itemUpd(\''.$table_name.'\',\''.$colName[0].'\',\''.$colName[1].'\',\''.$colName[2].'\',\''.$colName[3].'\',\''.$colName[4].'\',\''.$rows[0].'\',xajax.$(\'two_'.$num.'\').value,xajax.$(\'three_'.$num.'\').value,xajax.$(\'four_'.$num.'\').value,xajax.$(\'five_'.$num.'\').value);"> <input type="button" value="삭제" onclick="xajax_itemDel(\''.$table_name.'\',\''.$rows[0].'\');"></td>
</tr>';
}
}else{
$updated=$updated.'<tr><td colspan="5">자료가 없습니다.</td></tr>';
}
//////////////// 추가 할 수 있는 기능 추가
$updated=$updated.'<tr>
<td height="30px;"></td>
<td><input type="text" id="two" name="two" style="text-align:center"></td>
<td><input type="text" id="three" name="three" style="text-align:center"></td>
<td><input type="text" id="four" name="four" style="text-align:center"></td>
<td><input type="text" id="five" name="five" style="text-align:center"></td>
<td><input type="button" onclick="xajax_itemUpd(\''.$table_name.'\',\''.$colName[0].'\',\''.$colName[1].'\',\''.$colName[2].'\',\''.$colName[3].'\',\''.$colName[4].'\',0,xajax.$(\'two\').value,xajax.$(\'three\').value,xajax.$(\'four\').value,xajax.$(\'five\').value);" value="추가"></td>
</tr>';
/////////////// 2011-03-31
$updated=$table.$thead.$updated.'</table>';
$msg="접속자 관리 화면입니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->assign('content', 'innerHTML', $updated);
return $objResponse;
}
function itemUpd($table_name,$first,$second,$third,$fourth,$fifth,$one,$two,$three,$four,$five){
global $connect;
$objResponse = new xajaxResponse();
if($one){
$updSql="UPDATE `".$table_name."` SET `".$second."` = '".$two."', `".$third."` = '".$three."', `".$fourth."` = '".$four."', `".$fifth."` = '".$five."' WHERE `".$first."` =".$one;
}else{
$reg_date=date("Ymd",time());
$updSql="INSERT INTO `".$table_name."` ( `".$first."` , `".$second."` , `".$third."` , `".$fourth."` , `".$fifth."`) VALUES ('', '".$two."', '".$three."', '".$four."', '".$five."');";
}
$saveQue = mysql_query($updSql, $connect);
if($saveQue){
$objResponse->call($table_name);
}else{
$msg=$updSql;
$objResponse->assign('msgDiv', 'innerHTML', $msg);
}
return $objResponse;
}
function itemDel($table_name,$no)
{
global $connect;
$objResponse = new xajaxResponse();
$query="delete from `".$table_name."` where `no`=".$no;
$execQue = mysql_query($query, $connect);
$objResponse->call($table_name);
return $objResponse;
}
function ckd($val){
if($val=="Y")
return "checked";
}
function acl(){
global $connect;
$objResponse = new xajaxResponse();
$selSql="SELECT * FROM `toto_acl` ORDER BY `reg_date` ASC";
$result = mysql_query($selSql, $connect);
$total = mysql_num_rows($result); // 총 레코드 수
$num=0;
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td height="30px;">순번</td>
<td>접속 아이디</td>
<td>비밀번호</td>
<td>열람 페이지</td>
<td>등록일</td>
<td>허용 ip</td>
<td>피부과</td>
<td>코스메틱</td>
<td>전체열람권한</td>
<td></td>
</tr>';
if($total){
while($total--){
$num++;
$rows = mysql_fetch_row($result);
// 열람 페이지 2011-04-16
$pgOut="";
$aclPgl=explode("|",$rows[3]);
for($aclFor=0;$aclFor<count($aclPgl);$aclFor++){
$pgSql="SELECT `name` FROM `toto_page` WHERE `file` = '".$aclPgl[$aclFor]."'";
$pgRes = mysql_query($pgSql, $connect);
$pgRow = mysql_fetch_row($pgRes);
$pgOut=$pgOut." ".$pgRow[0];
}
// 열람 페이지
$updated=$updated.'<tr>
<td><a href="#" onclick="xajax_aclMod('.$rows[0].');">'.$num.'</a></td>
<td>'.$rows[1].'</td>
<td>'.$rows[2].'</td>
<td>'.$pgOut.'</td>
<td>'.$rows[4].'</td>
<td>'.$rows[5].'</td>
<td><input type="checkbox" '.ckd($rows[6]).' style="width:20px;" disabled></td>
<td><input type="checkbox" '.ckd($rows[7]).' style="width:20px;" disabled></td>
<td><input type="checkbox" '.ckd($rows[8]).' style="width:20px;" disabled></td>
<td><input type="button" onclick="xajax_aclDel('.$rows[0].');" value="삭제"></td>
</tr>';
}
}else{
$updated=$updated.'<tr><td colspan="5">자료가 없습니다.</td></tr>';
}
$updated=$table.$thead.$updated.'</table>';
$updated=$updated.'<input type="button" onclick="xajax_aclMod(0);" value="추가">';
$msg="접속자 관리 화면입니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->assign('content', 'innerHTML', $updated);
return $objResponse;
}
function logo(){
global $connect;
$objResponse = new xajaxResponse();
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td>파비콘</td>
<td>아이콘</td>
<td>접속로고</td>
</tr>';
$updated=$updated.'<tr>
<td><img src="./logo/favicon.ico"></td>
<td><img src="./logo/logo.gif"></td>
<td><img src="./logo/logins.gif"></td>
</tr>';
$updated=$table.$thead.$updated.'</table>';
$updated=$updated.'<form action="img_up.php" method="post" enctype="multipart/form-data" target="_blank">
<p>파비콘/아이콘/접속로고 순으로 지정해 주세요.<br />
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" />
</p>';
$updated=$updated.'<input type="submit" name="변경" value="변경" /></form>';
$msg="로고 관리 화면입니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->assign('content', 'innerHTML', $updated);
return $objResponse;
}
function aclMod($no){
global $connect;
$objResponse = new xajaxResponse();
$selSql="SELECT * FROM `toto_acl` where `no`=".$no;
$result = mysql_query($selSql, $connect);
$total = mysql_num_rows($result); // 총 레코드 수
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td></td>
<td>접속 아이디</td>
<td>비밀번호</td>
<td>열람 페이지</td>
<td>등록일</td>
<td>허용 ip</td>
<td>피부과</td>
<td>코스메틱</td>
<td>전체열람권한</td>
<td></td>
</tr>';
if($total){
$rows = mysql_fetch_row($result);
}
$aclPgl=explode("|",$rows[3]);
$pgSql="SELECT `name`,`file` FROM `toto_page`";
$pgRes = mysql_query($pgSql, $connect);
$pgOut="";
while($pgRow = mysql_fetch_row($pgRes)){
$file=explode(".",$pgRow[1]);
if(++$br%5==0)
$pgOut=$pgOut."<br />";
$isVal=0;
for($aclFor=0;$aclFor<count($aclPgl);$aclFor++){
if($pgRow[1]==$aclPgl[$aclFor])
$isVal++;
if($isVal)
$checked="checked";
else
$checked="";
}
$pgOut=$pgOut." ".$pgRow[0]."<input type='checkbox' id='".$file[0]."' name='".$file[0]."' value='".$pgRow[1]."' ".$checked.">";
}
$updated=$updated.'<tr><form name="f">
<td><input type="hidden" id="no" name="no" value="'.$rows[0].'">---</td>
<td><input type="text" id="user_id" name="user_id" value="'.$rows[1].'" style="width:50px;"></td>
<td><input type="text" id="user_pw" name="user_pw" value="'.$rows[2].'" style="width:50px;"></td>
<td>'.$pgOut.'</td>
<td><input type="text" id="reg_date" name="reg_date" value="'.$rows[4].'" style="width:100px;"></td>
<td><input type="text" id="user_ip" name="user_ip" value="'.$rows[5].'" style="width:250px;"></td>
<td><input type="checkbox" id="view_skin" name="view_skin" value="'.$rows[6].'" style="width:20px;" '.ckd($rows[6]).' ></td>
<td><input type="checkbox" id="view_cos" name="view_cos" value="'.$rows[7].'" style="width:20px;" '.ckd($rows[7]).' ></td>
<td><input type="checkbox" id="view_all" name="view_all" value="'.$rows[8].'" style="width:20px;" '.ckd($rows[8]).' ></td>
<td><input type="button" onclick="checkForm();" value="입력"></td></form>
</tr>';
$updated=$table.$thead.$updated.'</table>';
$msg="접속자 추가(수정) 화면입니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->assign('content', 'innerHTML', $updated);
return $objResponse;
}
function aclUpd($no,$user_id,$user_pw,$view_pg,$user_ip,$view_skin,$view_cos,$view_all){
global $connect;
$objResponse = new xajaxResponse();
if($no!=0){
$updSql="UPDATE `toto_acl` SET `user_id` = '".$user_id."', `user_pw` = '".$user_pw."', `view_pg` = '".$view_pg."', `user_ip` = '".$user_ip."', `view_skin` = '".$view_skin."', `view_cos` = '".$view_cos."', `view_all` = '".$view_all."' WHERE `no` =".$no;
}else{
$reg_date=date("Ymd",time());
$updSql="INSERT INTO `toto_acl` ( `no` , `user_id` , `user_pw` , `view_pg` , `reg_date` , `user_ip` , `view_skin` , `view_cos` , `view_all`) VALUES ('', '".$user_id."', '".$user_pw."', '".$view_pg."', '".$reg_date."', '".$user_ip."', '".$view_skin."', '".$view_cos."', '".$view_all."');";
}
$saveQue = mysql_query($updSql, $connect);
if($no){
$selSql="SELECT * FROM `toto_acl` where `no`=".$no;
$result = mysql_query($selSql, $connect);
$total = mysql_num_rows($result); // 총 레코드 수
$num=0;
$table='<center><table border="1" style="text-align:center;width:99%;background-color:#FFFFFF;border-color:#CA2F32;" cellspacing="0" cellpadding="0">';
$thead='<tr>
<td></td>
<td>접속 아이디</td>
<td>비밀번호</td>
<td>열람 페이지</td>
<td>등록일</td>
<td>허용 ip</td>
<td>피부과</td>
<td>코스메틱</td>
<td>열람권한</td>
<td></td>
</tr>';
if($total){
$rows = mysql_fetch_row($result);
}
$updated=$updated.'<tr><form name="f">
<td><input type="hidden" id="no" name="no" value="'.$rows[0].'">---</td>
<td><input type="text" id="user_id" name="user_id" value="'.$rows[1].'" style="width:50px;"></td>
<td><input type="text" id="user_pw" name="user_pw" value="'.$rows[2].'" style="width:50px;"></td>
<td><input type="text" id="view_pg" name="view_pg" value="'.$rows[3].'" style="width:450px;"></td>
<td><input type="text" id="reg_date" name="reg_date" value="'.$rows[4].'" style="width:100px;"></td>
<td><input type="text" id="user_ip" name="user_ip" value="'.$rows[5].'" style="width:250px;"></td>
<td><input type="text" id="view_skin" name="view_skin" value="'.$rows[6].'" style="width:20px;"></td>
<td><input type="text" id="view_cos" name="view_cos" value="'.$rows[7].'" style="width:20px;"></td>
<td><input type="text" id="view_all" name="view_all" value="'.$rows[8].'" style="width:20px;"></td>
<td><input type="button" onclick="checkForm();" value="수정"></td></form>
</tr>';
$updated=$table.$thead.$updated.'</table>';
if($saveQue){
$msg="추가(수정) 되었습니다.";
$objResponse->assign('msgDiv', 'innerHTML', $msg);
$objResponse->call('xajax_acl()');
}
}else{
$objResponse->call('xajax_acl()');
}
return $objResponse;
}
function aclDel($no)
{
global $connect;
$objResponse = new xajaxResponse();
$query="delete from `toto_acl` where `no`=".$no;
$execQue = mysql_query($query, $connect);
$objResponse->call('xajax_acl()');
return $objResponse;
}
$reqInquiry =& $xajax->registerFunction('inquiry');
$reqInquiry =& $xajax->registerFunction('itemView');
$reqInquiry =& $xajax->registerFunction('itemUpd');
$reqInquiry =& $xajax->registerFunction('itemDel');
$reqInquiry =& $xajax->registerFunction('acl');
$reqInquiry =& $xajax->registerFunction('logo');
$reqInquiry =& $xajax->registerFunction('aclMod');
$reqInquiry =& $xajax->registerFunction('aclUpd');
$reqInquiry =& $xajax->registerFunction('aclDel');
/*
Section: processRequest
This will detect an incoming xajax request, process it and exit. If this is
not a xajax request, then it is a request to load the initial contents of the page
(HTML).
Everything prior to this statement will be executed upon each request (whether it
is for the initial page load or a xajax request. Everything after this statement
will be executed only when the page is first loaded.
*/
$xajax->processRequest();
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>