join.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. $nav_title = "회원가입";
  4. ?>
  5. <!-- s : header -->
  6. <? include("../inc/inc_header.php"); ?>
  7. <!-- // e : header -->
  8. <style>
  9. .txt_red{color:#be0606;}
  10. </style>
  11. <form id="frmMember" name="frmMember" method="post" action="join_proc.php" enctype="multipart/form-data">
  12. <input type="hidden" name="validate" id="validate" value=""/>
  13. <input type="hidden" name="ds_type" id="ds_type" value="A0"/>
  14. <input type="hidden" name="ds_level" id="ds_level" value="<?=$ds_level?>"/>
  15. <input type="hidden" name="cd_user" id="cd_user" value="<?=$cd_user?>"/>
  16. <input type="hidden" name="mode" id="mode" value="Add"/>
  17. <!--input type="hidden" name="PageNo" id="PageNo" value="<?=$PageNo?>"/-->
  18. <input type="hidden" name="idchkresult" id="idchkresult" value="N"/>
  19. <!-- <input type="hidden" name="nm_email" id="nm_email" value=""/>
  20. <input type="hidden" name="nm_hp" id="nm_hp" value=""/> -->
  21. <main class="normal--wrap">
  22. <section class="join--form--wrap">
  23. <div class="join--form--contents">
  24. <div class="join--form--inner">
  25. <h2>개인 정보 입력</h2>
  26. <div>
  27. <input type="text" class="form-control" name="nm_email" id="nm_email" maxlength="40" placeholder="아이디 (ex:이메일 형식으로 입력) ">
  28. <p id="id_chk_info" class="hide"></p>
  29. </div>
  30. <div>
  31. <input type="password" class="form-control" name="nm_pass" id="nm_pass" maxlength="20" placeholder="패스워드">
  32. </div>
  33. <div>
  34. <input type="password" class="form-control" name="nm_pass2" id="nm_pass2" maxlength="20" placeholder="패스워드 확인">
  35. </div>
  36. <div>
  37. <input type="text" class="form-control" name="nm_name" id="nm_name" maxlength="20" placeholder="이름">
  38. </div>
  39. <div>
  40. <input type="text" class="form-control" id="nm_hp" name="nm_hp" placeholder="핸드폰 번호">
  41. </div>
  42. <!-- <div>
  43. <input type="text" class="form-control" id="" placeholder="이메일">
  44. </div> -->
  45. <h2 class="mt45">지역</h2>
  46. <div>
  47. <select name="ds_area" id="ds_area" class="form-control"></select>
  48. </div>
  49. </div>
  50. <div class="agree--wrapper mt35 d-flex justify-content-end">
  51. <input type="checkbox" id="ds_agree1" class="ty2" hidden value="Y">
  52. <label for="ds_agree1">회원 이용약관 (필수)</label>
  53. <button type="button" class="info--btn btn" data-bs-toggle="modal" data-bs-target="#agreeModal1">약관보기</button>
  54. </div>
  55. <div class="agree--wrapper mt35 d-flex justify-content-end">
  56. <input type="checkbox" id="ds_agree2" class="ty2" hidden value="Y">
  57. <label for="ds_agree2">개인정보 수집 및 이용 동의 (필수)</label>
  58. <button type="button" class="info--btn btn" data-bs-toggle="modal" data-bs-target="#agreeModal2">약관보기</button>
  59. </div>
  60. <div class="col-12 d-flex justify-content-center join--btn--wrap floating--btn">
  61. <button type="button" class="btn btn-primary" id="btn_write">회원가입</button>
  62. </div>
  63. </div>
  64. </section>
  65. </main>
  66. </form>
  67. <!-- 회원이용약관 -->
  68. <div class="modal fade type2" id="agreeModal1" tabindex="-1" aria-labelledby="agree_lable1" aria-hidden="true">
  69. <div class="modal-dialog modal-dialog-centered" style="max-width:calc(100vw - 40px);">
  70. <div class="modal-content">
  71. <div class="modal-header">
  72. <h1 class="modal-title" id="agree_lable1">회원 이용약관 동의</h1>
  73. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  74. </div>
  75. <div class="modal-body modal--body pt0">
  76. <div class="date--text" style="max-height:60vh; overflow-y: auto;">
  77. <?php include("../../include/clause_txt1.txt"); ?>
  78. </div>
  79. </div>
  80. <div class="modal-footer d-flex justify-content-center ty2 ty--2">
  81. <button type="button" class="btn btn-primary" data-bs-dismiss="modal" style="max-width:100px;">확인</button>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- 개인정보 수집이용 -->
  87. <div class="modal fade type2" id="agreeModal2" tabindex="-1" aria-labelledby="agree_lable2" aria-hidden="true">
  88. <div class="modal-dialog modal-dialog-centered" style="max-width:calc(100vw - 40px);">
  89. <div class="modal-content">
  90. <div class="modal-header">
  91. <h1 class="modal-title" id="agree_lable2">개인정보 수집 및 이용 동의</h1>
  92. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  93. </div>
  94. <div class="modal-body modal--body pt0">
  95. <div class="date--text" style="max-height:60vh; overflow-y: auto;">
  96. <? include("../../include/clause_txt2.txt"); ?>
  97. </div>
  98. </div>
  99. <div class="modal-footer d-flex justify-content-center ty2 ty--2">
  100. <button type="button" class="btn btn-primary" data-bs-dismiss="modal" style="max-width:100px;">확인</button>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <script laguage="javascript" type="text/javascript">
  106. function id_chk() {
  107. var nm_email = $("#nm_email").val();
  108. var custom_opts = {
  109. title : '',
  110. btn_close_show : false,
  111. }
  112. if($.trim(nm_email) == ""){
  113. return false;
  114. }
  115. $("#id_chk_info").removeClass("txt_red").removeClass("hide");
  116. $.post("join_proc.php", { mode: "IdChk", nm_email: nm_email},function(res) {
  117. if(res.CODE != "0000"){
  118. $("#idchkresult").val("N");
  119. id_chk_info = "사용불가능한 아이디 입니다.";
  120. $("#id_chk_info").addClass("txt_red").text(id_chk_info);
  121. }else {
  122. $("#idchkresult").val("Y");
  123. id_chk_info = "사용할 수 있는 아이디입니다.";
  124. $("#id_chk_info").removeClass("txt_red").text(id_chk_info);
  125. }
  126. }, "json");
  127. return false;
  128. }
  129. // function id_chk() {
  130. // var nm_email = "";
  131. // var fieldlist = [];
  132. // var custom_opts = {
  133. // title : '',
  134. // btn_close_show : false,
  135. // }
  136. // //
  137. // // if($("#nm_email3").val() == "") {
  138. // // fieldlist = [["nm_email1","아이디"], ["nm_email2","아이디"]];
  139. // // }else {
  140. // // fieldlist = [["nm_email1","아이디"], ["nm_email3","아이디"]];
  141. // // }
  142. //
  143. // if (!fnCheckForm(fieldlist)){
  144. // return false;
  145. // }
  146. //
  147. // var nm_email1 = $("#nm_email1").val();
  148. // var nm_email2 = $("#nm_email2").val();
  149. // var nm_email3 = $("#nm_email3").val();
  150. // nm_email = nm_email1+"@"+($.trim(nm_email3) ? nm_email3 : nm_email2);
  151. //
  152. //
  153. // $.post("join_proc.php", { mode: "IdChk", nm_email: nm_email},function(res) {
  154. // if(res.CODE != "0000") {
  155. // $("#idchkresult").val("N");
  156. // alert(res.MSG);
  157. // return false;
  158. // }
  159. //
  160. // custom_opts.title = '이용가능합니다. 아이디를 사용하시겠습니까?';
  161. // custom_modal_confirm(custom_opts, function(confirm) {
  162. // if(confirm) {
  163. // $("#idchkresult").val("Y");
  164. //
  165. // custom_modal_confirm_close();
  166. //
  167. // }
  168. // });
  169. //
  170. // // if(confirm("이용가능합니다. 아이디를 사용하시겠습니까?")){
  171. // // // $("#cd_userid").attr("readonly",true).css("background","#d2d3d5");
  172. // // $("#idchkresult").val("Y");
  173. // // }
  174. //
  175. // // if(data=="Y"){
  176. // // if(confirm("이용가능합니다. 아이디를 사용하시겠습니까?")){
  177. // // $("#cd_userid").attr("readonly",true).css("background","#d2d3d5");
  178. // // $("#idchkresult").val("Y");
  179. // // return;
  180. // // }
  181. // // }else{
  182. // // alert("사용불가능한 아이디 입니다.");
  183. // // $("#idchkresult").val("N");
  184. // // return;
  185. // // }
  186. // }, "json");
  187. // return false;
  188. // }
  189. $(document).ready(function() {
  190. // setCodeSelect("listPhone","nm_hp1","","","","선택","");
  191. // setCodeSelect("listEmail","nm_email3","","","","직접입력","");
  192. setCodeSelect("listcode","ds_area", "member_master","ds_area","","선택하세요","");
  193. $("#btn_back").on("click", function() {
  194. history.back(-1);
  195. });
  196. $("#nm_email").bind("keyup",function(){
  197. $("#idchkresult").val("N");
  198. $("#id_chk_info").removeClass("txt_red").addClass("hide").text("");
  199. });
  200. $("#nm_email3").on("change", function(){
  201. $("#idchkresult").val("N");
  202. if($(this).val() == ""){
  203. $("#nm_email2").show();
  204. }else{
  205. $("#nm_email2").hide();
  206. }
  207. });
  208. //아이디 체크
  209. $("#nm_email").bind("focusout", id_chk);
  210. //아이디 체크
  211. // $("#btn_idchk").on("click",function(){
  212. // id_chk();
  213. // });
  214. // $("#agree_all").bind("click",function(){
  215. // agreeChkAll();
  216. // });
  217. //
  218. // $("#agree_all").bind("keyup",function(){
  219. // agreeChkAll();
  220. // });
  221. $("#btn_write").bind("click",function(){
  222. var custom_opts = {
  223. title : '',
  224. btn_close_show : false,
  225. }
  226. var fieldlist = [["nm_email","아이디"],["nm_pass","패스워드"],["nm_pass2","패스워드"],["nm_name","이름"],["nm_hp","휴대번호"]
  227. ,["ds_area","지역"]]
  228. // var nm_email3 = $("#nm_email3").val();
  229. // if(nm_email3 == "") {
  230. // fieldlist.push(["nm_email2"]);
  231. // }
  232. if (!fnCheckForm(fieldlist)){
  233. return false;
  234. }
  235. /*아이디 관련 처리*/
  236. // var idReg1 = /[a-z]/g;
  237. // var idReg2 = /[0-9]/g;
  238. //
  239. // if( !(idReg1.test( $("#cd_userid").val() )) || !(idReg2.test( $("#cd_userid").val() )) ) {
  240. // // custom_opts.title = '아이디는 영문/숫자 조합으로 이루어져야 합니다.';
  241. // custom_opts.title = '아이디는 4글자 이상 영문/숫자 조합으로 이메일 형식으로 이루어져야 합니다.';
  242. //
  243. // custom_modal_alert(custom_opts);
  244. // return false;
  245. // }
  246. // var idReg = /^[a-z]+[a-z0-9]{3,19}$/g;
  247. // if( !idReg.test( $("#cd_userid").val() ) ) {
  248. // // custom_opts.title = '아이디는 영문자로 시작하는 4~20자 영문자 또는 숫자이어야 합니다.';
  249. // custom_opts.title = '아이디는 4글자 이상 영문/숫자 조합으로 이메일 형식으로 이루어져야 합니다.';
  250. //
  251. // custom_modal_alert(custom_opts);
  252. // return false;
  253. // }
  254. //
  255. // if(!fnCheckAlphaNumber($("#cd_userid").val())){
  256. // custom_opts.title = '아이디는 4글자 이상 영문/숫자 조합으로 이메일 형식으로 이루어져야 합니다.';
  257. //
  258. // custom_modal_alert(custom_opts);
  259. // return false;
  260. //
  261. // }
  262. /*
  263. if( !(idReg1.test( $("#cd_userid").val() )) || !(idReg2.test( $("#cd_userid").val() )) ) {
  264. alert("아이디는 영문/숫자 조합으로 이루어져야 합니다.");
  265. $("#cd_userid").focus();
  266. return false;
  267. }
  268. var idReg = /^[a-z]+[a-z0-9]{5,19}$/g;
  269. if( !idReg.test( $("#cd_userid").val() ) ) {
  270. alert("아이디는 영문자로 시작하는 6~20자 영문자 또는 숫자이어야 합니다.");
  271. $("#cd_userid").focus();
  272. return false;
  273. }
  274. if(!fnCheckAlphaNumber($("#cd_userid").val())){
  275. alert('아이디는 영문/숫자 조합으로 이루어져야 합니다.');
  276. return false;
  277. }
  278. if($("#cd_userid").val().length <6){
  279. alert("6글자 이상 아이디를 입력하세요");
  280. $("#cd_userid").focus();
  281. return false;
  282. }
  283. */
  284. if($("#nm_email").val().length <4){
  285. // custom_opts.title = '아이디는4글자 이상 아이디를 입력하세요.';
  286. custom_opts.title = '아이디는 4글자 이상 영문/숫자 조합으로 이메일 형식으로 이루어져야 합니다.';
  287. custom_modal_alert(custom_opts);
  288. return false;
  289. }
  290. if($("#idchkresult").val() != "Y"){
  291. custom_opts.title = "아이디 중복확인을 해 주세요.";
  292. custom_modal_alert(custom_opts);
  293. return false;
  294. }
  295. /*패스워드 처리*/
  296. // if($("#nm_pass").val().length == 0 || $("#nm_pass2").val().length == 0){
  297. // alert("패스워드를 입력하세요");
  298. // $("#nm_pass").focus();
  299. // return false;
  300. // }
  301. if($("#nm_pass").val().length == 0 || $("#nm_pass2").val().length == 0){
  302. custom_opts.title = '패스워드를 입력하세요.';
  303. custom_modal_alert(custom_opts);
  304. return false;
  305. }
  306. if($("#nm_pass").val().length > 0){
  307. if($("#nm_email1").val()==$("#nm_pass").val()){
  308. custom_opts.title = '아이디와 패스워드는 다르게입력하세요.';
  309. custom_modal_alert(custom_opts);
  310. return false;
  311. }
  312. if($("#nm_pass").val()!=$("#nm_pass2").val()){
  313. custom_opts.title = '패스워드가 일치하지 않습니다.';
  314. custom_modal_alert(custom_opts);
  315. return false;
  316. }
  317. if(!fnCheckAlphaNumber($("#nm_pass").val())){
  318. custom_opts.title = '패스워드는 영문/숫자 조합으로 이루어져야 합니다.';
  319. custom_modal_alert(custom_opts);
  320. return false;
  321. }
  322. if($("#nm_pass").val().length <8){
  323. custom_opts.title = '8글자 이상 패스워드를 입력하세요.';
  324. custom_modal_alert(custom_opts);
  325. return false;
  326. }
  327. }
  328. var nm_email = $("#nm_email").val();
  329. if($.trim(nm_email) != "") {
  330. if(!isValid(nm_email,"regEmail")){
  331. custom_opts.title = '정확한 이메일을 입력하세요.';
  332. custom_modal_alert(custom_opts);
  333. return false;
  334. }
  335. }
  336. // var idReg = /^[a-z]+[a-z0-9]{3,19}$/g;
  337. // var idReg = /^[a-zA-Z]+[a-zA-Z0-9]{3,19}$/g;
  338. // // var idReg = /^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{4,12}$/g;
  339. // var idReg = /^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{3,19}$/g;
  340. // if( !idReg.test( $("#nm_email").val() ) ) {
  341. // // custom_opts.title = '아이디는 영문자로 시작하는 4~20자 영문자 또는 숫자이어야 합니다.';
  342. // custom_opts.title = '아이디는 영문자로 시작하는 4~20자 영문자/숫자 조합이어야 합니다';
  343. //
  344. // custom_modal_alert(custom_opts);
  345. // return false;
  346. // }
  347. // var nm_hp1 = $("#nm_hp1").val();
  348. // var nm_hp2 = $("#nm_hp2").val();
  349. // var nm_hp3 = $("#nm_hp3").val();
  350. // var nm_hp_test = nm_hp1+nm_hp2+nm_hp3;
  351. // var nm_hp = nm_hp1+"-"+nm_hp2+"-"+nm_hp3;
  352. // if(!ChkNum(nm_hp_test)){
  353. // custom_opts.title = "휴대폰 번호는 숫자만 입력하세요.";
  354. // custom_modal_alert(custom_opts);
  355. // return false;
  356. // // alert("휴대폰 번호는 숫자만 입력하세요.");
  357. // // $("#nm_hp").focus();
  358. // // return false;
  359. // }
  360. /*
  361. if($("#nm_hp_01").val() == ""){
  362. alert("휴대폰 번호를 입력하세요.");
  363. $("#nm_hp_01").focus();
  364. return false;
  365. }
  366. if($("#nm_hp_02").val() == ""){
  367. alert("휴대폰 번호를 입력하세요.");
  368. $("#nm_hp_02").focus();
  369. return false;
  370. }
  371. if($("#nm_hp_03").val() == ""){
  372. alert("휴대폰 번호를 입력하세요.");
  373. $("#nm_hp_03").focus();
  374. return false;
  375. }
  376. $("#nm_hp").val($("#nm_hp_01").val()+"-"+$("#nm_hp_02").val()+"-"+$("#nm_hp_03").val());
  377. if($("#nm_email1").val() == ""){
  378. alert("이메일을 입력하세요.");
  379. $("#nm_email1").focus();
  380. return false;
  381. }
  382. if($("#nm_email3").val() == ""){
  383. if($("#nm_email2").val() == ""){
  384. alert("이메일을 입력하세요.");
  385. $("#nm_email2").focus();
  386. return false;
  387. }
  388. $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email2").val());
  389. }else{
  390. $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email3").val());
  391. }
  392. */
  393. // var nm_email1 = $("#nm_email1").val();
  394. // var nm_email2 = $("#nm_email2").val();
  395. // var nm_email3 = $("#nm_email3").val();
  396. // var nm_email = nm_email1+"@"+($.trim(nm_email3) ? nm_email3 : nm_email2);
  397. // $("#nm_email").val(nm_email);
  398. // $("#nm_hp").val(nm_hp);
  399. /*
  400. if($("#nm_addr").val() == ""){
  401. alert("주소를 입력하세요.");
  402. $("#nm_addr").focus();
  403. return false;
  404. }
  405. if($("#nm_addr_sub").val() == ""){
  406. alert("주소를 입력하세요.");
  407. $("#nm_addr_sub").focus();
  408. return false;
  409. }
  410. */
  411. if(!document.getElementById("ds_agree1").checked){
  412. custom_opts.title = "[필수] 회원 이용약관에 동의해 주세요.";
  413. custom_modal_alert(custom_opts);
  414. return false;
  415. }
  416. if(!document.getElementById("ds_agree2").checked){
  417. custom_opts.title = "[필수] 개인정보 수집이용 에 동의해 주세요.";
  418. custom_modal_alert(custom_opts);
  419. return false;
  420. }
  421. custom_opts.title = '회원가입 하시겠습니까?';
  422. custom_modal_confirm(custom_opts, function(confirm) {
  423. if(confirm) {
  424. $("#btn_join_proc").hide();
  425. var data = $("#frmMember").serialize();
  426. $.ajax({
  427. url : 'join_proc.php',
  428. type: 'POST',
  429. dataType : 'json',
  430. data: data,
  431. success: function(res) {
  432. custom_modal_confirm_close();
  433. $("#btn_join_proc").show();
  434. //세션 종료시 로그인 페이지로 이동
  435. if(res.CODE != "0000") {
  436. custom_opts.title = res.MSG;
  437. if(res.CODE == "4444") {
  438. window.location.href = res.DATAS.URL;
  439. }
  440. custom_modal_alert(custom_opts);
  441. return false;
  442. }
  443. custom_opts.title = '회원 등록이 완료되었습니다.';
  444. custom_opts.event_esc_key = false;
  445. custom_modal_alert(custom_opts, function() {
  446. link("login.php");
  447. });
  448. },
  449. error:function(request,status,error){
  450. $("#btn_join_proc").show();
  451. custom_modal_confirm_close();
  452. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  453. }
  454. });
  455. }else {
  456. $("#btn_join_proc").show();
  457. return false;
  458. }
  459. });
  460. // var c=confirm("정보를 등록하시겠습니까?");
  461. // if(c){
  462. // $("#btn_write").hide();
  463. // $("#frmMember").submit();
  464. // }else{
  465. // $("#btn_write").show();
  466. // return false;
  467. // }
  468. });
  469. });
  470. function agreeChkAll(){
  471. if(document.getElementById("agree_all").checked){
  472. document.getElementById("ds_agree1").checked = true;
  473. document.getElementById("ds_agree2").checked = true;
  474. }else{
  475. document.getElementById("ds_agree1").checked = false;
  476. document.getElementById("ds_agree2").checked = false;
  477. }
  478. }
  479. </script>
  480. <script language="javascript">
  481. <!--
  482. function sel_1(sltObj)
  483. {
  484. document.getElementById("nm_email2").value = sltObj;
  485. if (sltObj == "")
  486. {
  487. document.getElementById("nm_email2").readOnly = false;
  488. }else{
  489. document.getElementById("nm_email2").readOnly = true;
  490. }
  491. }
  492. //-->
  493. </script>
  494. <!-- s : footer -->
  495. <? include("../inc/inc_bottom.php"); ?>
  496. <!-- // e : footer -->
  497. <?
  498. mysql_close($connect);
  499. ?>