mypage.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].'/common/aap_chk.php';
  4. $cd_dealerid = $_SESSION['s_cd_dealerid'];
  5. $sql = "SELECT * FROM aap_master where cd_dealerid = '$cd_dealerid' LIMIT 1";
  6. $col=mysql_fetch_array(mysql_query($sql));
  7. if (empty($col['cd_dealer'])){
  8. AlertRedirect("로그인되어 있지 않습니다.", "login.php");
  9. }
  10. // extract($col);
  11. // foreach($col as $column => $val) {
  12. // ${$column} = $val;
  13. // echo $column.'<br/>';
  14. // if($column == "nm_np") {
  15. // echo ${$column};
  16. // exit;
  17. // }
  18. // }
  19. $cd_dealer = $col['cd_dealer'];
  20. $cd_dealerid = $col['cd_dealerid'];
  21. $cd_dealer_p = $col['cd_dealer_p'];
  22. $nm_pass = $col['nm_pass'];
  23. $ds_type = $col['ds_type'];
  24. $ds_usertype = $col['ds_usertype'];
  25. $ds_level = $col['ds_level'];
  26. $nm_company = $col['nm_company'];
  27. $nm_name = $col['nm_name'];
  28. $nm_birth = $col['nm_birth'];
  29. $nm_tel_01 = $col['nm_tel_01'];
  30. $nm_tel_02 = $col['nm_tel_02'];
  31. $nm_tel_03 = $col['nm_tel_03'];
  32. $nm_hp = $col['nm_hp'];
  33. $nm_hp_01 = $col['nm_hp_01'];
  34. $nm_hp_02 = $col['nm_hp_02'];
  35. $nm_hp_03 = $col['nm_hp_03'];
  36. $nm_fax_01 = $col['nm_fax_01'];
  37. $nm_fax_02 = $col['nm_fax_02'];
  38. $nm_fax_03 = $col['nm_fax_03'];
  39. $nm_email = $col['nm_email'];
  40. $nm_zip = $col['nm_zip'];
  41. $nm_addr = $col['nm_addr'];
  42. $nm_addr_sub = $col['nm_addr_sub'];
  43. $nm_etc_01 = $col['nm_etc_01'];
  44. $nm_etc_02 = $col['nm_etc_02'];
  45. $nm_etc_03 = $col['nm_etc_03'];
  46. $ds_status = $col['ds_status'];
  47. $nm_company_biz = $col['nm_company_biz'];
  48. $nm_name_biz = $col['nm_name_biz'];
  49. $nm_no_biz = $col['nm_no_biz'];
  50. $nm_date_biz = $col['nm_date_biz'];
  51. $nm_type_biz = $col['nm_type_biz'];
  52. $nm_condition_biz = $col['nm_condition_biz'];
  53. $nm_tel_biz_01 = $col['nm_tel_biz_01'];
  54. $nm_tel_biz_02 = $col['nm_tel_biz_02'];
  55. $nm_tel_biz_03 = $col['nm_tel_biz_03'];
  56. $nm_hp_biz_01 = $col['nm_hp_biz_01'];
  57. $nm_hp_biz_02 = $col['nm_hp_biz_02'];
  58. $nm_hp_biz_03 = $col['nm_hp_biz_03'];
  59. $nm_fax_biz_01 = $col['nm_fax_biz_01'];
  60. $nm_fax_biz_02 = $col['nm_fax_biz_02'];
  61. $nm_fax_biz_03 = $col['nm_fax_biz_03'];
  62. $nm_email_biz = $col['nm_email_biz'];
  63. $nm_zip_biz = $col['nm_zip_biz'];
  64. $nm_addr_biz = $col['nm_addr_biz'];
  65. $nm_addr_sub_biz = $col['nm_addr_sub_biz'];
  66. $ds_company_bp1 = $col['ds_company_bp1'];
  67. $ds_branch1 = $col['ds_branch1'];
  68. $ds_company_bp2 = $col['ds_company_bp2'];
  69. $ds_branch2 = $col['ds_branch2'];
  70. $ds_company_bp3 = $col['ds_company_bp3'];
  71. $ds_branch3 = $col['ds_branch3'];
  72. $nm_area = $col['nm_area'];
  73. $nm_title = $col['nm_title'];
  74. $nm_file = $col['nm_file'];
  75. $nm_etc = $col['nm_etc'];
  76. $nm_deposit = $col['nm_deposit'];
  77. $dt_insert = $col['dt_insert'];
  78. $nm_insert = $col['nm_insert'];
  79. $dt_update = $col['dt_update'];
  80. $nm_update = $col['nm_update'];
  81. $dt_lastlogin = $col['dt_lastlogin'];
  82. $ds_delind = $col['ds_delind'];
  83. $ds_company_bp = $col['ds_company_bp'];
  84. $ds_branch = $col['ds_branch'];
  85. $enc_val = $col['enc_val'];
  86. $device_uuid = $col['device_uuid'];
  87. $device_os = $col['device_os'];
  88. list($nm_hp1, $nm_hp2, $nm_hp3) = explode("-", $nm_hp);
  89. ?>
  90. <?php include("include/header.php") ?>
  91. <style>
  92. .txt_red{color:#be0606;}
  93. </style>
  94. <main class="normal--wrap pb123">
  95. <section class="join--form--wrap">
  96. <h2 class="">이차조아 <span>AAP 직원</span> 정보수정</h2>
  97. <p></p>
  98. <div class="join--form--contents">
  99. <form id="frmMember" name="frmMember" method="post" action="mypage_proc.php" enctype="multipart/form-data">
  100. <input type="hidden" name="mode" id="mode" value="Update"/>
  101. <input type="hidden" name="nm_hp" id="nm_hp" value=""/>
  102. <input type="hidden" name="nm_email" id="nm_email" value=""/>
  103. <table>
  104. <tbody>
  105. <tr>
  106. <th>아이디</th>
  107. <td>
  108. <?=$cd_dealerid?>
  109. </td>
  110. </tr>
  111. <tr>
  112. <th>변경 패스워드</th>
  113. <td>
  114. <input type="password" class="form-control" name="nm_pass" id="nm_pass" maxlength="20">
  115. </td>
  116. </tr>
  117. <tr>
  118. <th>이름</th>
  119. <td>
  120. <input type="text" class="form-control" name="nm_name" id="nm_name" maxlength="20" value="<?=$nm_name?>">
  121. </td>
  122. </tr>
  123. <tr>
  124. <th>연락처</th>
  125. <td>
  126. <div class="d-flex align-items-center">
  127. <select id="nm_hp1" name="nm_hp1" class="form-select" style="max-width:90px;"></select>
  128. <label for="nm_hp2" class="ml10 mr10">-</label>
  129. <input type="text" class="form-control" name="nm_hp2" id="nm_hp2" style="max-width:105px;" maxlength="4" value="<?=$nm_hp2?>">
  130. <label for="nm_hp3" class="ml10 mr10">-</label>
  131. <input type="text" class="form-control" name="nm_hp3" id="nm_hp3" style="max-width:105px;" maxlength="4" value="<?=$nm_hp3?>">
  132. </div>
  133. </td>
  134. </tr>
  135. <tr>
  136. <th>관계사</th>
  137. <td>
  138. <div class="d-flex align-items-center">
  139. <select name="ds_company_bp" id="ds_company_bp" class="form-select ml10" style="max-width:170px;"></select>
  140. </div>
  141. </td>
  142. </tr>
  143. <tr>
  144. <th>지점</th>
  145. <td>
  146. <div class="d-flex align-items-center">
  147. <select name="ds_branch" id="ds_branch" class="form-select ml10" style="max-width:170px;"></select>
  148. </div>
  149. </td>
  150. </tr>
  151. </tbody>
  152. </table>
  153. <div class="col-12 d-flex justify-content-center join--btn--wrap mt90">
  154. <button type="button" class="btn btn-secondary" style="width:180px; height:55px;" id="btn_back">취소</button>
  155. <button type="button" class="btn btn-primary ml15" style="width:180px; height:55px;" id="btn_modify_proc">정보수정<i class="join--ic"></i></button>
  156. </div>
  157. </form>
  158. </div>
  159. </section>
  160. </main>
  161. <script>
  162. $(function() {
  163. setCodeSelect("listPhone","nm_hp1","","","<?=$nm_hp1?>","선택","");
  164. setCodeSelect("listEmail","nm_email3","","","","직접입력","");
  165. setCodeSelect("listcode","ds_company_bp", "aap_master","ds_company_bp","<?=$ds_company_bp?>","선택하세요","");
  166. setCodeSelect("listcode","ds_branch", "aap_master","ds_branch","<?=$ds_branch?>","선택하세요","<?=$ds_company_bp?>");
  167. $("#btn_back").on("click", function() {
  168. history.back(-1);
  169. });
  170. $("#ds_company_bp").change(function(){
  171. setCodeSelect("listcode","ds_branch", "aap_master","ds_branch","","선택하세요",$(this).val());
  172. });
  173. $("#nm_email3").on("change", function(){
  174. if($(this).val() == ""){
  175. $("#nm_email2").show();
  176. }else{
  177. $("#nm_email2").hide();
  178. }
  179. });
  180. $("#btn_modify_proc").on('click', function() {
  181. var custom_opts = {
  182. title : '',
  183. btn_close_show : false,
  184. }
  185. var fieldlist = [["nm_name","이름"],["nm_hp1","연락처"],["nm_hp2","연락처"],["nm_hp3","연락처"],["ds_company_bp","관계사"]]
  186. var nm_email3 = $("#nm_email3").val();
  187. if(nm_email3 == "") {
  188. fieldlist.push(["nm_email2"]);
  189. }
  190. //상사회원은 지점이 없음.
  191. var ds_company_bp = $("#ds_company_bp").val();
  192. if(ds_company_bp != "A0") {
  193. fieldlist.push(["ds_branch", "지점"]);
  194. }
  195. if (!fnCheckForm(fieldlist)){
  196. return false;
  197. }
  198. /*패스워드 처리*/
  199. if($("#nm_pass").val().length > 0){
  200. if(!fnCheckAlphaNumber($("#nm_pass").val())){
  201. custom_opts.title = '변경할 패스워드는 영문/숫자 조합으로 이루어져야 합니다.';
  202. custom_modal_alert(custom_opts);
  203. return false;
  204. }
  205. if($("#nm_pass").val().length <8){
  206. custom_opts.title = '8글자 이상 변경할 패스워드를 입력하세요.';
  207. custom_modal_alert(custom_opts);
  208. return false;
  209. }
  210. }
  211. /*연락처*/
  212. $("#nm_hp").val($("#nm_hp1").val()+"-"+$("#nm_hp2").val()+"-"+$("#nm_hp3").val());
  213. /*이메일 체크*/
  214. var nm_email3 = $("#nm_email3").val();
  215. if($.trim(nm_email3) == "") {
  216. $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email2").val());
  217. }else {
  218. $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email3").val());
  219. }
  220. if(!isValid($("#nm_email").val(),"regEmail")){
  221. custom_opts.title = '정확한 이메일을 입력하세요.';
  222. custom_modal_alert(custom_opts);
  223. return false;
  224. }
  225. custom_opts.title = '정보를 수정 하시겠습니까?\n정보 수정시 재로그인하셔야 합니다.';
  226. custom_modal_confirm(custom_opts, function(confirm) {
  227. if(confirm) {
  228. $("#btn_modify_proc").hide();
  229. var data = $("#frmMember").serialize();
  230. $.ajax({
  231. url : 'mypage_proc.php',
  232. type: 'POST',
  233. dataType : 'json',
  234. data: data,
  235. success: function(res) {
  236. custom_modal_confirm_close();
  237. $("#btn_modify_proc").show();
  238. //세션 종료시 로그인 페이지로 이동
  239. if(res.CODE != "0000") {
  240. custom_opts.title = res.MSG;
  241. if(res.CODE == "4444") {
  242. window.location.href = res.DATAS.URL;
  243. }
  244. custom_modal_alert(custom_opts);
  245. return false;
  246. }
  247. custom_opts.title = '정보수정이 완료되었습니다.\n재로그인을 위해 로그인 페이지로 이동합니다.';
  248. custom_opts.event_esc_key = false;
  249. custom_modal_alert(custom_opts, function() {
  250. link("login.php");
  251. });
  252. },
  253. error:function(request,status,error){
  254. $("#btn_modify_proc").show();
  255. custom_modal_confirm_close();
  256. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  257. }
  258. });
  259. }else {
  260. $("#btn_modify_proc").show();
  261. return false;
  262. }
  263. });
  264. });
  265. })
  266. </script>
  267. <?php include("include/footer.php") ?>