mypage.php 10 KB

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