join.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. $HEADER_LOC = 'main';
  4. ?>
  5. <?php include("include/header.php") ?>
  6. <style>
  7. .txt_red{color:#be0606;}
  8. </style>
  9. <main class="normal--wrap" style="padding-bottom:95px;">
  10. <section class="join--form--wrap">
  11. <div class="join--form--contents">
  12. <form id="frmMember" name="frmMember" method="post" action="join_proc.php" enctype="multipart/form-data">
  13. <input type="hidden" name="mode" id="mode" value="Add"/>
  14. <input type="hidden" name="idchkresult" id="idchkresult" value="N"/>
  15. <!-- <input type="hidden" name="nm_hp" id="nm_hp" value=""/>
  16. <input type="hidden" name="nm_email" id="nm_email" value=""/> -->
  17. <div class="join--form--inner" style="padding-top:25px;">
  18. <h2>개인 정보 입력</h2>
  19. <div>
  20. <input type="text" class="form-control" id="cd_dealerid" name="cd_dealerid" placeholder="아이디">
  21. <p id="id_chk_info" class="hide"></p>
  22. </div>
  23. <div>
  24. <input type="password" class="form-control" id="nm_pass" name="nm_pass" placeholder="패스워드">
  25. </div>
  26. <div>
  27. <input type="password" class="form-control" name="nm_pass2" id="nm_pass2" maxlength="20" placeholder="패스워드 확인">
  28. </div>
  29. <div>
  30. <input type="text" class="form-control" id="nm_name" name="nm_name" placeholder="이름">
  31. </div>
  32. <div>
  33. <input type="text" class="form-control" id="nm_hp" name="nm_hp" placeholder="핸드폰 번호">
  34. </div>
  35. <!-- <div>
  36. <input type="text" class="form-control" id="" placeholder="이메일">
  37. </div> -->
  38. <h2 class="mt45">지점 입력</h2>
  39. <div>
  40. <select name="ds_company_bp" id="ds_company_bp" class="form-select"></select>
  41. </div>
  42. <div>
  43. <select name="ds_branch" id="ds_branch" class="form-select"></select>
  44. </div>
  45. </div>
  46. <div class="agree--wrapper mt35 d-flex justify-content-end">
  47. <input type="checkbox" id="ds_agree1" class="ty2" hidden value="Y">
  48. <label for="ds_agree1">회원 이용약관 (필수)</label>
  49. <button type="button" class="info--btn btn" data-bs-toggle="modal" data-bs-target="#agreeModal1">약관보기</button>
  50. </div>
  51. <div class="agree--wrapper mt35 d-flex justify-content-end">
  52. <input type="checkbox" id="ds_agree2" class="ty2" hidden value="Y">
  53. <label for="ds_agree2">개인정보 수집 및 이용 동의 (필수)</label>
  54. <button type="button" class="info--btn btn" data-bs-toggle="modal" data-bs-target="#agreeModal2">약관보기</button>
  55. </div>
  56. <div class="col-12 d-flex justify-content-center join--btn--wrap floating--btn">
  57. <button type="button" class="btn btn-primary" id="btn_join_proc">회원가입</button>
  58. </div>
  59. </form>
  60. </div>
  61. </section>
  62. </main>
  63. <!-- 회원이용약관 -->
  64. <div class="modal fade type2" id="agreeModal1" tabindex="-1" aria-labelledby="agree_lable1" aria-hidden="true">
  65. <div class="modal-dialog modal-dialog-centered" style="max-width:calc(100vw - 40px);">
  66. <div class="modal-content">
  67. <div class="modal-header">
  68. <h1 class="modal-title" id="agree_lable1">회원 이용약관 동의</h1>
  69. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  70. </div>
  71. <div class="modal-body modal--body pt0">
  72. <div class="date--text" style="max-height:60vh; overflow-y: auto;">
  73. <?php include("../../include/clause_txt1.txt"); ?>
  74. </div>
  75. </div>
  76. <div class="modal-footer d-flex justify-content-center ty2 ty--2">
  77. <button type="button" class="btn btn-primary" data-bs-dismiss="modal" style="max-width:100px;">확인</button>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <!-- 개인정보 수집이용 -->
  83. <div class="modal fade type2" id="agreeModal2" tabindex="-1" aria-labelledby="agree_lable2" aria-hidden="true">
  84. <div class="modal-dialog modal-dialog-centered" style="max-width:calc(100vw - 40px);">
  85. <div class="modal-content">
  86. <div class="modal-header">
  87. <h1 class="modal-title" id="agree_lable2">개인정보 수집 및 이용 동의</h1>
  88. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  89. </div>
  90. <div class="modal-body modal--body pt0">
  91. <div class="date--text" style="max-height:60vh; overflow-y: auto;">
  92. <? include("../../include/clause_txt2.txt"); ?>
  93. </div>
  94. </div>
  95. <div class="modal-footer d-flex justify-content-center ty2 ty--2">
  96. <button type="button" class="btn btn-primary" data-bs-dismiss="modal" style="max-width:100px;">확인</button>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <script>
  102. function id_chk() {
  103. var cd_dealerid = $("#cd_dealerid").val();
  104. var custom_opts = {
  105. title : '',
  106. btn_close_show : false,
  107. }
  108. if($.trim(cd_dealerid) == ""){
  109. return false;
  110. }
  111. $("#id_chk_info").removeClass("txt_red").removeClass("hide");
  112. $.post("join_proc.php", { mode: "IdChk", cd_dealerid: cd_dealerid},function(res) {
  113. if(res.CODE != "0000"){
  114. $("#idchkresult").val("N");
  115. id_chk_info = "사용불가능한 아이디 입니다.";
  116. $("#id_chk_info").addClass("txt_red").text(id_chk_info);
  117. }else {
  118. $("#idchkresult").val("Y");
  119. id_chk_info = "사용할 수 있는 아이디입니다.";
  120. $("#id_chk_info").removeClass("txt_red").text(id_chk_info);
  121. }
  122. }, "json");
  123. return false;
  124. }
  125. $(function() {
  126. setCodeSelect("listPhone","nm_hp1","","","","선택","");
  127. setCodeSelect("listEmail","nm_email3","","","","직접입력","");
  128. setCodeSelect("listcode","ds_company_bp", "aap_master","ds_company_bp","","관계사를 선택하세요","");
  129. setCodeSelect("listcode","ds_branch", "aap_master","ds_branch","","지점을 선택하세요","-1");
  130. //아이디 체크
  131. $("#cd_dealerid").bind("focusout", id_chk);
  132. $("#btn_login_page").on("click", function() {
  133. link("login.php");
  134. });
  135. $("#ds_company_bp").change(function(){
  136. setCodeSelect("listcode","ds_branch", "aap_master","ds_branch","","선택하세요",$(this).val());
  137. });
  138. $("#cd_dealerid").bind("keyup",function(){
  139. $("#idchkresult").val("N");
  140. $("#id_chk_info").removeClass("txt_red").addClass("hide").text("");
  141. });
  142. $("#nm_email3").on("change", function(){
  143. if($(this).val() == ""){
  144. $("#nm_email2").show();
  145. }else{
  146. $("#nm_email2").hide();
  147. }
  148. });
  149. $("#btn_join_proc").on('click', function() {
  150. var custom_opts = {
  151. title : '',
  152. btn_close_show : false,
  153. }
  154. var fieldlist = [["cd_dealerid","아이디"],["nm_pass","비밀번호"],["nm_pass2","비밀번호 확인"],["nm_name","이름"]
  155. ,["nm_hp1","휴대번호"],["nm_hp2","휴대번호"],["nm_hp3","휴대번호"]
  156. ,["ds_company_bp","관계사"]]
  157. //상사회원은 지점이 없음.
  158. var ds_company_bp = $("#ds_company_bp").val();
  159. if(ds_company_bp != "A0") {
  160. fieldlist.push(["ds_branch", "지점"]);
  161. }
  162. var nm_email3 = $("#nm_email3").val();
  163. if(nm_email3 == "") {
  164. fieldlist.push(["nm_email2"]);
  165. }
  166. if (!fnCheckForm(fieldlist)){
  167. return false;
  168. }
  169. // var idReg1 = /[a-z]/g;
  170. // var idReg2 = /[0-9]/g;
  171. //
  172. // if( !(idReg1.test( $("#cd_dealerid").val() )) || !(idReg2.test( $("#cd_dealerid").val() )) ) {
  173. // custom_opts.title = '아이디는 영문/숫자 조합으로 이루어져야 합니다.';
  174. //
  175. // custom_modal_alert(custom_opts);
  176. // return false;
  177. // }
  178. // var idReg = /^[a-z]+[a-z0-9]{5,19}$/g;
  179. // if( !idReg.test( $("#cd_dealerid").val() ) ) {
  180. // custom_opts.title = '아이디는 영문자로 시작하는 6~20자 영문자 또는 숫자이어야 합니다.';
  181. //
  182. // custom_modal_alert(custom_opts);
  183. // return false;
  184. // }
  185. var idReg = /^[a-z]+[a-z0-9]{3,19}$/g;
  186. var idReg = /^[a-zA-Z]+[a-zA-Z0-9]{3,19}$/g;
  187. // var idReg = /^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{4,12}$/g;
  188. var idReg = /^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{3,19}$/g;
  189. if( !idReg.test( $("#cd_dealerid").val() ) ) {
  190. // custom_opts.title = '아이디는 영문자로 시작하는 4~20자 영문자 또는 숫자이어야 합니다.';
  191. custom_opts.title = '아이디는 영문자로 시작하는 4~20자 영문자/숫자 조합이어야 합니다';
  192. custom_modal_alert(custom_opts);
  193. return false;
  194. }
  195. // if(!fnCheckAlphaNumber($("#cd_dealerid").val())){
  196. // custom_opts.title = '아이디는 영문/숫자 조합으로 이루어져야 합니다.';
  197. //
  198. // custom_modal_alert(custom_opts);
  199. // return false;
  200. //
  201. // }
  202. // if($("#cd_dealerid").val().length <6){
  203. // custom_opts.title = '아이디는6글자 이상 아이디를 입력하세요.';
  204. //
  205. // custom_modal_alert(custom_opts);
  206. // return false;
  207. // }
  208. if($("#cd_dealerid").val().length <4){
  209. custom_opts.title = '아이디는4글자 이상 아이디를 입력하세요.';
  210. custom_modal_alert(custom_opts);
  211. return false;
  212. }
  213. if($("#idchkresult").val() != "Y"){
  214. custom_opts.title = '아이디 중복확인을 해 주세요.';
  215. custom_modal_alert(custom_opts);
  216. return false;
  217. }
  218. /*패스워드 처리*/
  219. if($("#nm_pass").val().length == 0 || $("#nm_pass2").val().length == 0){
  220. custom_opts.title = '패스워드를 입력하세요.';
  221. custom_modal_alert(custom_opts);
  222. return false;
  223. }
  224. if($("#nm_pass").val().length > 0){
  225. // if($("#nm_email1").val()==$("#nm_pass").val()){
  226. // custom_opts.title = '아이디와 패스워드는 다르게입력하세요.';
  227. //
  228. // custom_modal_alert(custom_opts);
  229. // return false;
  230. // }
  231. if($("#nm_pass").val()!=$("#nm_pass2").val()){
  232. custom_opts.title = '패스워드가 일치하지 않습니다.';
  233. custom_modal_alert(custom_opts);
  234. return false;
  235. }
  236. if(!fnCheckAlphaNumber($("#nm_pass").val())){
  237. custom_opts.title = '패스워드는 영문/숫자 조합으로 이루어져야 합니다.';
  238. custom_modal_alert(custom_opts);
  239. return false;
  240. }
  241. if($("#nm_pass").val().length <8){
  242. custom_opts.title = '8글자 이상 패스워드를 입력하세요.';
  243. custom_modal_alert(custom_opts);
  244. return false;
  245. }
  246. }
  247. /*연락처*/
  248. // $("#nm_hp").val($("#nm_hp1").val()+"-"+$("#nm_hp2").val()+"-"+$("#nm_hp3").val());
  249. /*이메일 체크*/
  250. // var nm_email3 = $("#nm_email3").val();
  251. // if($.trim(nm_email3) == "") {
  252. // $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email2").val());
  253. // }else {
  254. // $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email3").val());
  255. // }
  256. //
  257. // if(!isValid($("#nm_email").val(),"regEmail")){
  258. // custom_opts.title = '정확한 이메일을 입력하세요.';
  259. //
  260. // custom_modal_alert(custom_opts);
  261. // return false;
  262. // }
  263. if(!document.getElementById("ds_agree1").checked){
  264. custom_opts.title = "[필수] 회원 이용약관에 동의해 주세요.";
  265. custom_modal_alert(custom_opts);
  266. return false;
  267. }
  268. if(!document.getElementById("ds_agree2").checked){
  269. custom_opts.title = "[필수] 개인정보 수집이용 에 동의해 주세요.";
  270. custom_modal_alert(custom_opts);
  271. return false;
  272. }
  273. custom_opts.title = '회원가입 하시겠습니까?';
  274. custom_modal_confirm(custom_opts, function(confirm) {
  275. if(confirm) {
  276. $("#btn_join_proc").hide();
  277. var data = $("#frmMember").serialize();
  278. $.ajax({
  279. url : 'join_proc.php',
  280. type: 'POST',
  281. dataType : 'json',
  282. data: data,
  283. success: function(res) {
  284. custom_modal_confirm_close();
  285. $("#btn_join_proc").show();
  286. //세션 종료시 로그인 페이지로 이동
  287. if(res.CODE != "0000") {
  288. custom_opts.title = res.MSG;
  289. if(res.CODE == "4444") {
  290. window.location.href = res.DATAS.URL;
  291. }
  292. custom_modal_alert(custom_opts);
  293. return false;
  294. }
  295. custom_opts.title = '회원 등록이 완료되었습니다.';
  296. custom_opts.event_esc_key = false;
  297. custom_modal_alert(custom_opts, function() {
  298. link("login.php");
  299. });
  300. },
  301. error:function(request,status,error){
  302. $("#btn_join_proc").show();
  303. custom_modal_confirm_close();
  304. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  305. }
  306. });
  307. }else {
  308. $("#btn_join_proc").show();
  309. return false;
  310. }
  311. });
  312. });
  313. })
  314. </script>
  315. <?php include("include/bottom.php") ?>