'9999', 'MSG'=>''); try { if(!$_POST) { throw new Exception("정상적인 접근이 아닙니다.", "9999"); } if(empty($cd_userid)) { throw new Exception("아이디가 없습니다.", "9998"); } if(empty($nm_pass) || empty($nm_pass2)) { throw new Exception("비밀번호가 없습니다.", "9997"); } if($nm_pass != $nm_pass2) { throw new Exception("입력하신 비밀번호가 일치하지 않습니다.", "9996"); } if(empty($nm_name)) { throw new Exception("이름이 없습니다.", "9995"); } if(empty($nm_hp) || $nm_hp == "--") { throw new Exception("휴대번호가 없습니다.", "9993"); } if(empty($nm_email) || $nm_email == "@") { throw new Exception("이메일이 없습니다.", "9993"); } if(strlen($cd_userid)<3 || strlen($cd_userid)>20) { throw new Exception("아이디(3~20)의 자리수가 맞지 않습니다.", "9990"); } if($cd_userid=="userid" || $cd_userid=="member" || $cd_userid=="admin"){ throw new Exception("중복된 아이디입니다. 관리자에게 문의하십시요.", "9990"); } if(!preg_match("/^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{3,19}$/i", $cd_userid)) { // if(!preg_match("/^[a-zA-Z]+[a-zA-Z0-9]{3,19}$/i", $cd_dealerid)) { throw new Exception("아이디는 영문자로 시작하는 4~20자 영문자/숫자 조합이어야 합니다.", "9991"); } $check_id=@mysql_result(mysql_query("select count(*) from $table_name where cd_userid='$cd_userid'"),0,0); if($check_id>0) { throw new Exception("이미 사용중인 아이디입니다.다시 한번 확인하세요.", "9990"); } //소문자만 사용 $cd_userid = strtolower($cd_userid); $sql = "INSERT INTO $table_name SET cd_userid = '$cd_userid' , nm_name = '$nm_name' , ds_type = 'A0' , ds_level = '1' , nm_hp = '$nm_hp' , nm_email = '$nm_email' , ds_company_bp = '$ds_company_bp' , ds_branch = '$ds_branch' , ds_area = '$ds_area' , ds_area_sub = '$ds_area_sub' , ds_agree1 = '$ds_agree1' , ds_agree2 = '$ds_agree2' , ds_agree3 = '$ds_agree3' , ds_agree4 = '$ds_agree4' , nm_pass = password('".$nm_pass."') , dt_insert = now() , nm_insert = '$cd_userid' , dt_update = now() , nm_update = '$cd_userid' , ds_delind = 'N' "; // echo $sql; // exit; $result = mysql_query($sql,$connect); if(!$result) { throw new Exception("회원 등록처리에 실패 하였습니다.잠시후 다시 시도해 주세요.", "9990"); } $RES['CODE'] = "0000"; $RES['MSG'] = "회원 등록이 완료되었습니다."; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysql_close($connect); echo json_encode($RES); exit; // "nm_zip"=>$nm_zip, // "nm_addr"=>$nm_addr, // "nm_addr_sub"=>$nm_addr_sub, // "ds_status"=>$ds_status, // "nm_hp_01"=>$nm_hp_01, // "nm_hp_02"=>$nm_hp_02, // "nm_hp_03"=>$nm_hp_03, // "nm_company"=>$nm_company, // "nm_birth"=>$nm_birth, break; case "IdChk": $RES = array('CODE'=>'9999', 'MSG'=>''); try { //소문자만 사용 $cd_userid = strtolower($cd_userid); if(strlen($cd_userid)<4 || strlen($cd_userid)>20) { throw new Exception("아이디(4~20)의 자리수가 맞지 않습니다.", "9990"); } if($cd_userid=="userid" || $cd_userid=="member" || $cd_userid=="admin"){ throw new Exception("중복된 아이디입니다. 관리자에게 문의하십시요.", "9990"); } if(!preg_match("/^[a-zA-Z](?=.*[a-zA-Z])(?=.*[0-9]).{3,19}$/i", $cd_userid)) { // if(!preg_match("/^[a-zA-Z]+[a-zA-Z0-9]{3,19}$/i", $cd_dealerid)) { throw new Exception("아이디는 영문자로 시작하는 4~20자 영문자/숫자 조합이어야 합니다.", "9991"); } $check_id=@mysql_result(mysql_query("select count(*) from $table_name where cd_userid='$cd_userid'"),0,0); if($check_id>0) { throw new Exception("이미 사용중인 아이디입니다.다시 한번 확인하세요.", "9990"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상."; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysql_close($connect); echo json_encode($RES); exit; break; case "IdSearch": $RES = array('CODE'=>'9999', 'MSG'=>''); try { $nm_name = trim(avoid_crack($_POST["nm_name"])); $nm_hp = trim(avoid_crack($_POST["nm_hp"])); if(empty($nm_name)) { throw new Exception("이름을 입력하세요", "9990"); } if(empty($nm_hp)) { throw new Exception("휴대폰 번호를 입력하세요", "9990"); } $sql = "select * from $table_name where ds_delind='N' And nm_name = '". $nm_name . "' AND nm_hp = '". $nm_hp . "' "; // echo $sql; // exit; $res = mysql_query($sql); $col = mysql_fetch_array($res); if(empty($col['cd_user'])) { throw new Exception("입력하신 정보가 정확하지 않습니다.", "9990"); } # SMS 발송 # 1. 요청자에게 $aligo = new Aligo(); $aligo->getToken(); $ALIGO_DATA = array(); $ALIGO_DATA['id'] = $col['cd_userid']; $ALIGO_DATA['name'] = $col['nm_name']; $ALIGO_DATA['recv_phone'] = $col['nm_hp']; $response = $aligo->send_common_find_id($ALIGO_DATA); unset($ALIGO_DATA); if($response['code'] != "0") { throw new Exception($response['message'], "4449"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상."; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysql_close($connect); echo json_encode($RES); exit; break; case "PwdSearch": $RES = array('CODE'=>'9999', 'MSG'=>''); try { $cd_userid = trim(avoid_crack($_POST["cd_userid"])); $nm_hp = trim(avoid_crack($_POST["nm_hp"])); //소문자만 사용 $cd_userid = strtolower($cd_userid); if(empty($cd_userid)) { throw new Exception("아이디를 입력하세요", "9990"); } if(empty($nm_hp)) { throw new Exception("휴대폰 번호를 입력하세요", "9990"); } $sql = "select * from $table_name where ds_delind='N' And cd_userid = '". $cd_userid . "' AND nm_hp = '". $nm_hp . "' "; // echo $sql; // exit; $res = mysql_query($sql); $col = mysql_fetch_array($res); if(empty($col['cd_user'])) { throw new Exception("입력하신 정보가 정확하지 않습니다.", "9990"); } $new_passwd = generatePassword(8); $sql="UPDATE $table_name set nm_pass = password('".$new_passwd."') where cd_user = '{$col['cd_user']}'"; // echo $sql; // exit; $result = mysql_query($sql,$connect); if(!$result) { throw new Exception("임시 비밀번호 변경에 실패 하였습니다.잠시후 다시 시도해 주세요.", "9990"); } # SMS 발송 # 1. 요청자에게 $aligo = new Aligo(); $aligo->getToken(); $ALIGO_DATA = array(); $ALIGO_DATA['pwd'] = $new_passwd; $ALIGO_DATA['name'] = $col['nm_name']; $ALIGO_DATA['recv_phone'] = $col['nm_hp']; $response = $aligo->send_common_find_pwd($ALIGO_DATA); unset($ALIGO_DATA); if($response['code'] != "0") { throw new Exception($response['message'], "4449"); } $RES['CODE'] = "0000"; $RES['MSG'] = "정상."; }catch(Exception $e){ $RES['CODE'] = $e->getCode(); $RES['MSG'] = $e->getMessage(); } @mysql_close($connect); echo json_encode($RES); exit; break; default : AlertBack("지정되지않은 요청입니다"); break; } mysql_close($connect); ?>