admin_view.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
  4. $mp = "00"; //set top nav
  5. ?>
  6. <? include("../inc/inc_top.php") ?>
  7. <? include("../inc/inc_header.php") ?>
  8. <?
  9. $sql ="SELECT
  10. cd_seq, cd_userid , nm_name ,nm_pass , ds_level , ds_open
  11. , nm_info1, nm_info2, nm_info3, ds_company_bp, ds_branch, dt_insert, nm_insert, dt_update, nm_update, ds_delind
  12. , auth1, auth2, auth3, auth4, auth5, auth6, auth7, auth8, auth9
  13. , ds_alimtalk
  14. FROM admin_info
  15. WHERE cd_userid='$cd_userid' AND ds_delind='N'";
  16. $mode = "Insert";
  17. $col=mysql_fetch_array(mysql_query($sql));
  18. if (!empty($col['cd_userid'])){
  19. $cd_seq = $col['cd_seq'];
  20. $cd_userid = $col['cd_userid'];
  21. $nm_name = $col['nm_name'];
  22. $nm_pass = $col['nm_pass'];
  23. $ds_level = $col['ds_level'];
  24. $ds_open = $col['ds_open'];
  25. $nm_info1 = $col['nm_info1'];
  26. $nm_info2 = $col['nm_info2'];
  27. $nm_info3 = $col['nm_info3'];
  28. $ds_company_bp = $col['ds_company_bp'];
  29. $ds_branch = $col['ds_branch'];
  30. $auth1 = $col['auth1'];
  31. $auth2 = $col['auth2'];
  32. $auth3 = $col['auth3'];
  33. $auth4 = $col['auth4'];
  34. $auth5 = $col['auth5'];
  35. $auth6 = $col['auth6'];
  36. $auth7 = $col['auth7'];
  37. $auth8 = $col['auth8'];
  38. $auth9 = $col['auth9'];
  39. $ds_alimtalk = $col['ds_alimtalk'];
  40. $arr_nm_info1 = explode("-",$nm_info1);
  41. if(count($arr_nm_info1) == 3){
  42. $nm_info11 = $arr_nm_info1[0];
  43. $nm_info12 = $arr_nm_info1[1];
  44. $nm_info13 = $arr_nm_info1[2];
  45. }else{
  46. $nm_info11 = "";
  47. $nm_info12 = "";
  48. $nm_info13 = "";
  49. }
  50. $arr_nm_info3 = explode("@",$nm_info3);
  51. if(count($arr_nm_info3) == 2){
  52. $nm_info31 = $arr_nm_info3[0];
  53. $nm_info32 = $arr_nm_info3[1];
  54. }else{
  55. $nm_info31 = "";
  56. $nm_info32 = "";
  57. }
  58. $nm_info3 = $col['nm_info3'];
  59. $mode = "Update";
  60. }else{
  61. $ds_level = "1";
  62. }
  63. $totalrows = @mysql_result(mysql_query("select count(*) from admin_info WHERE ds_delind='N'"),0,0);
  64. ?>
  65. <section id="contents">
  66. <h2>관리자 관리</h2>
  67. <h3><em>▶</em> 관리자 수정</h3>
  68. <form id="frmMember" name="frmMember" method="post" action="<?=ADMIN_PATH?>admin/admin_proc.php">
  69. <input type="hidden" name="mode" id="mode" value="Update"/>
  70. <input type="hidden" name="validate" id="validate" value=""/>
  71. <input type="hidden" name="ds_level" id="ds_level" value="1"/>
  72. <input type="hidden" name="ds_open" id="ds_open" value="Y"/>
  73. <input type="hidden" name="nm_info1" id="nm_info1" value=""/>
  74. <input type="hidden" name="nm_info3" id="nm_info3" value=""/>
  75. <div class="tbl_wrap">
  76. <table class="tbl_list2">
  77. <colgroup>
  78. <col width="13%">
  79. <col width="*">
  80. </colgroup>
  81. <tr>
  82. <th>아이디</th>
  83. <td><input type="text" class="inp_txt" style="width:40%;" name="cd_userid" id="cd_userid" maxlength="20" value="<?=$cd_userid?>"<? if($mode=="Update"){?> readonly<?}?>></td>
  84. </tr>
  85. <tr>
  86. <th>비밀번호</th>
  87. <td><input type="password" class="inp_txt" style="width:40%;" name="nm_pass" id="nm_pass" maxlength="20"></td>
  88. </tr>
  89. <tr>
  90. <th>이름</th>
  91. <td><input type="text" class="inp_txt" style="width:40%;" name="nm_name" id="nm_name" maxlength="20" value="<?=$nm_name?>"></td>
  92. </tr>
  93. <tr>
  94. <th>연락처</th>
  95. <td>
  96. <span class="select2" style="margin-right:5px;width:12%;">
  97. <select name="nm_info11" id="nm_info11"></select>
  98. </span>
  99. <input type="text" class="inp_txt" style="width:12%;" name="nm_info12" id="nm_info12" maxlength="4" value="<?=$nm_info12?>"> - <input type="text" class="inp_txt" style="width:12%;" name="nm_info13" id="nm_info13" maxlength="4" value="<?=$nm_info13?>">
  100. <span class="check_wrap" style='vertical-align: middle;'><input type="checkbox" name="ds_alimtalk" id="ds_alimtalk" value="Y" <?=($ds_alimtalk == "Y" ? "checked" : "" ) ?>><i></i><label for="ds_alimtalk">카톡알림</label></span>
  101. </td>
  102. </tr>
  103. <tr>
  104. <th>이메일</th>
  105. <td>
  106. <input type="text" class="inp_txt" style="margin-right:5px;width:25%;" name="nm_info31" id="nm_info31" value="<?=$nm_info31?>"> @
  107. <input type="text" class="inp_txt" style="margin-right:5px;width:25%;" name="nm_info32" id="nm_info32" value="<?=$nm_info32?>">
  108. <span class="select2" style="margin-left:5px;min-width:12%;">
  109. <select name="nm_info33" id="nm_info33" onChange="sel_1(this.value)"></select>
  110. </span>
  111. </td>
  112. </tr>
  113. <!-- <tr>
  114. <th>관계사</th>
  115. <td>
  116. <span class="select2" style="margin-right:5px;width:12%;">
  117. <select name="ds_company_bp" id="ds_company_bp" onchange="chg_ds_branch(this.value)"></select>
  118. </span>
  119. </td>
  120. </tr>
  121. <tr>
  122. <th>지점</th>
  123. <td>
  124. <span class="select2" style="margin-right:5px;width:12%;">
  125. <select name="ds_branch" id="ds_branch"></select>
  126. </span>
  127. </td>
  128. </tr> -->
  129. </table>
  130. </div>
  131. <h3><em>▶</em> 권한 설정</h3>
  132. <div class="box_check">
  133. <span class="check_wrap"><input type="checkbox" name="btn_authall" id="btn_authall"><i></i><label for="btn_authall">전체</label></span>
  134. <span class="check_wrap"><input type="checkbox" name="auth1" id="auth1" value="Y"<?= ($auth1 == "Y") ? " checked":"" ?>><i></i><label for="auth1">관리자 관리</label></span>
  135. <span class="check_wrap"><input type="checkbox" name="auth2" id="auth2" value="Y"<?= ($auth2 == "Y") ? " checked":"" ?>><i></i><label for="auth2">차량관리</label></span>
  136. <span class="check_wrap"><input type="checkbox" name="auth3" id="auth3" value="Y"<?= ($auth3 == "Y") ? " checked":"" ?>><i></i><label for="auth3">회원관리</label></span>
  137. <span class="check_wrap"><input type="checkbox" name="auth4" id="auth4" value="Y"<?= ($auth4 == "Y") ? " checked":"" ?>><i></i><label for="auth4">매입관리</label></span>
  138. <span class="check_wrap"><input type="checkbox" name="auth5" id="auth5" value="Y"<?= ($auth5 == "Y") ? " checked":"" ?>><i></i><label for="auth5">정산관리</label></span>
  139. <span class="check_wrap"><input type="checkbox" name="auth6" id="auth6" value="Y"<?= ($auth6 == "Y") ? " checked":"" ?>><i></i><label for="auth6">커뮤니티</label></span>
  140. <span class="check_wrap"><input type="checkbox" name="auth9" id="auth9" value="Y"<?= ($auth9 == "Y") ? " checked":"" ?>><i></i><label for="auth9">사고정보조회</label></span>
  141. </div>
  142. </form>
  143. <div class="btn_right">
  144. <a href="#" class="rnd_btn ty2 gray" onclick="location.replace('<?=ADMIN_PATH?>admin/admin_list.php?PageNo=<?=$PageNo?>');">목록</a>
  145. <a class="rnd_btn ty2 black" id="btn_update">저장</a>
  146. <?
  147. if($totalrows >1){
  148. ?>
  149. <a class="rnd_btn ty2 black" id="btn_delete">삭제</a>
  150. <?
  151. }
  152. ?>
  153. </div>
  154. </section>
  155. <!--tr>
  156. <td class="view01" height="30">계정사용여부</td>
  157. <td class="jcon">
  158. <select name="ds_open" id="ds_open" class="input">
  159. <option value="" <? if($ds_open ==""){?>selected<?}?>>선택하세요</option>
  160. <option value="Y" <? if($ds_open =="Y"){?>selected<?}?>>사용중</option>
  161. <option value="N" <? if($ds_open =="N"){?>selected<?}?>>사용중지</option>
  162. </select>
  163. </td>
  164. </tr-->
  165. <script language="javascript" type="text/javascript">
  166. $(document).ready(function() {
  167. setCodeSelectJqTransForm("listPhone","nm_info11","","","<?=$nm_info11?>","선택하세요","");
  168. setCodeSelectJqTransForm("listEmail","nm_info33","","","","직접입력","");
  169. // setCodeSelectJqTransForm("listcode","ds_company_bp", "member_master","ds_company_bp","<?=$ds_company_bp?>","선택하세요","");
  170. <? if (!empty($ds_branch)){ ?>
  171. // setCodeSelectJqTransForm("listcode","ds_branch", "member_master","ds_branch","<?=$ds_branch?>","선택하세요","<?=$ds_company_bp?>");
  172. <? } ?>
  173. $("#btn_delete").bind("click",function(){
  174. var custom_opts = {
  175. title : '정말로 삭제 하시겠습니까?',
  176. btn_close_show : false,
  177. }
  178. custom_modal_confirm(custom_opts, function(confirm) {
  179. if(confirm) {
  180. $("#mode").val("Delete");
  181. $("#btn_delete").hide();
  182. var data = $("#frmMember").serialize();
  183. $.ajax({
  184. url : 'admin_proc.php',
  185. type: 'POST',
  186. dataType : 'json',
  187. data: data,
  188. success: function(res) {
  189. custom_modal_confirm_close();
  190. $("#btn_delete").show();
  191. //세션 종료시 로그인 페이지로 이동
  192. if(res.CODE != "0000") {
  193. custom_opts.title = res.MSG;
  194. if(res.CODE == "4444") {
  195. window.location.href = res.DATAS.URL;
  196. }
  197. custom_modal_alert(custom_opts);
  198. return false;
  199. }
  200. custom_opts.title = '관리자가 삭제 되었습니다.';
  201. custom_opts.event_esc_key = false;
  202. custom_modal_alert(custom_opts, function() {
  203. link("<?=ADMIN_PATH?>/admin/admin_list.php");
  204. });
  205. },
  206. error:function(request,status,error){
  207. $("#btn_delete").show();
  208. custom_modal_confirm_close();
  209. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  210. }
  211. });
  212. }else {
  213. $("#btn_delete").show();
  214. return false;
  215. }
  216. });
  217. });
  218. $("#btn_update").bind("click",function(){
  219. var custom_opts = {
  220. title : '',
  221. btn_close_show : false,
  222. }
  223. var fieldlist = [["cd_userid","아이디"],["nm_name","이름"],["nm_info11","연락처"],["nm_info12","연락처"],["nm_info13","연락처"],["nm_info31","이메일"],["nm_info32","이메일"]]
  224. if (!fnCheckForm(fieldlist)){
  225. return false;
  226. }else{
  227. /*아이디 관련 처리*/
  228. // if(!fnCheckAlphaNumber($("#cd_userid").val())){
  229. // custom_opts.title = '아이디는 영문/숫자 조합으로 이루어져야 합니다.';
  230. //
  231. // custom_modal_alert(custom_opts);
  232. // return false;
  233. // }
  234. // if($("#cd_userid").val().length <4){
  235. // custom_opts.title = '4글자 이상 아이디를 입력하세요.';
  236. //
  237. // custom_modal_alert(custom_opts);
  238. // return false;
  239. // }
  240. /*이름 체크*/
  241. if(!isValid($("#nm_name").val(),"regKorean")){
  242. custom_opts.title = '이름은 한글만 가능합니다.';
  243. custom_modal_alert(custom_opts);
  244. return false;
  245. }
  246. /*패스워드 처리*/
  247. /*
  248. if($("#nm_pass").val().length > 0){
  249. if($("cd_userid").val()==$("#nm_pass").val()){
  250. alert("아이디와 변경할 패스워드를 다르게입력하세요");
  251. $("#nm_pass").focus();
  252. return false;
  253. }
  254. if($("#nm_pass").val()!=$("#nm_pass_2").val()){
  255. alert("입력하신 변경할 패스워드가 일치하지 않습니다.");
  256. $("#nm_pass").focus();
  257. return false;
  258. }
  259. if(!fnCheckAlphaNumber($("#nm_pass").val())){
  260. alert('변경할 패스워드는 영문/숫자 조합으로 이루어져야 합니다.');
  261. return false
  262. }
  263. if($("#nm_pass").val().length <6){
  264. alert("6글자 이상 변경할 패스워드를 입력하세요");
  265. $("#nm_pass").focus();
  266. return false;
  267. }
  268. }
  269. */
  270. /*연락처*/
  271. $("#nm_info1").val($("#nm_info11").val()+"-"+$("#nm_info12").val()+"-"+$("#nm_info13").val());
  272. /*이메일 체크*/
  273. $("#nm_info3").val($("#nm_info31").val()+"@"+$("#nm_info32").val());
  274. if(!isValid($("#nm_info3").val(),"regEmail")){
  275. custom_opts.title = '정확한 이메일을 입력하세요.';
  276. custom_modal_alert(custom_opts);
  277. return false;
  278. }
  279. custom_opts.title = '정보를 수정하시겠습니까?';
  280. custom_modal_confirm(custom_opts, function(confirm) {
  281. if(confirm) {
  282. $("#btn_update").hide();
  283. var data = $("#frmMember").serialize();
  284. $.ajax({
  285. url : 'admin_proc.php',
  286. type: 'POST',
  287. dataType : 'json',
  288. data: data,
  289. success: function(res) {
  290. custom_modal_confirm_close();
  291. $("#btn_update").show();
  292. //세션 종료시 로그인 페이지로 이동
  293. if(res.CODE != "0000") {
  294. custom_opts.title = res.MSG;
  295. if(res.CODE == "4444") {
  296. window.location.href = res.DATAS.URL;
  297. }
  298. custom_modal_alert(custom_opts);
  299. return false;
  300. }
  301. custom_opts.title = '관리자 수정이 완료되었습니다.';
  302. custom_opts.event_esc_key = false;
  303. custom_modal_alert(custom_opts, function() {
  304. reload();
  305. });
  306. },
  307. error:function(request,status,error){
  308. $("#btn_update").show();
  309. custom_modal_confirm_close();
  310. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  311. }
  312. });
  313. }else {
  314. $("#btn_update").show();
  315. return false;
  316. }
  317. });
  318. // var c=confirm("정보를 수정하시겠습니까?");
  319. // if(c){
  320. // $("#btn_update").hide();
  321. // $("#frmMember").submit();
  322. // }else{
  323. // $("#btn_update").show();
  324. // return false;
  325. // }
  326. }
  327. });
  328. $("#btn_authall").bind("click",function(){
  329. var checked = $(this).prop("checked");
  330. $("#auth1").prop('checked', checked);
  331. $("#auth2").prop('checked', checked);
  332. $("#auth3").prop('checked', checked);
  333. $("#auth4").prop('checked', checked);
  334. $("#auth5").prop('checked', checked);
  335. $("#auth6").prop('checked', checked);
  336. $("#auth9").prop('checked', checked);
  337. });
  338. });
  339. </script>
  340. <script language="javascript">
  341. <!--
  342. function chg_ds_branch(val) {
  343. if($.trim(val) == "") {
  344. val = "-1";
  345. }
  346. setCodeSelectJqTransForm("listcode","ds_branch", "member_master","ds_branch","<?=$ds_branch?>","선택하세요",val);
  347. }
  348. function sel_1(sltObj)
  349. {
  350. document.getElementById("nm_info32").value = sltObj;
  351. if (sltObj == "")
  352. {
  353. document.getElementById("nm_info32").readOnly = false;
  354. }else{
  355. document.getElementById("nm_info32").readOnly = true;
  356. }
  357. }
  358. //-->
  359. </script>
  360. <? include("../inc/inc_footer.php") ?>
  361. <? include("../inc/inc_bottom.php") ?>
  362. <?
  363. mysql_close($connect);
  364. ?>