join.php 13 KB

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