mypage.php 8.7 KB

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