id=$id; $this->pass=$pass; } //////////////////////////////////////////////////////////// // 로그인 //////////////////////////////////////////////////////////// function login() { global $MEMBER; global $auto; global $host , $db_name , $db_id, $db_pass ,$db_charset; mysqli_report(MYSQLI_REPORT_OFF); $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $query=" SELECT id FROM kport_mem_table "; $query.=" WHERE id='".$this->id."' "; $query.=" AND pass=OLD_PASSWORD('".$this->pass."') "; $res=mysqli_query($this->db_conn,$query); $cnt=mysqli_num_rows($res); if($cnt>0) { $query=" SELECT id,pass,name,email,homepage,grade,gid,approval FROM kport_mem_table "; $query.=" WHERE id='".$this->id."' "; $res=mysqli_query($this->db_conn,$query); $row=mysqli_fetch_array($res); $_SESSION['member']['id']=$row['id']; $_SESSION['member']['pass']=$row['pass']; $_SESSION['member']['email']=$row['email']; $_SESSION['member']['homepage']=$row['homepage']; $_SESSION['member']['grade']=$row['grade']; $_SESSION['member']['gid']=$row['gid']; if( $row['grade'] == '1' ) { if ( $row['approval'] == 2 ) // 관리자 { $_SESSION['member']['is_admin']=true; //최고관리자 $_SESSION['member']['super_admin']=true; $_SESSION['member']['name']=$row['name']; } else if( $row['approval'] == 1 ) { $_SESSION['member']['is_admin']=true; //관리자 $_SESSION['member']['normal_admin']=true; $_SESSION['member']['name']=$row['name']; } else { $_SESSION['member']['is_admin']=true; //서브관리자 $_SESSION['member']['sub_admin']=true; $_SESSION['member']['name']=$row['name']; } } else { if ( $row['approval'] == 1 ) // 회원 { $_SESSION['member']['is_user']=true; $_SESSION['member']['name']=$row['name']; } else { // 인증되지 않음 $FUNC->Alert_Error("관리자의 승인이 필요합니다."); exit; } } // 자동 로그인 $time = time() + 60*60*24*365; // 365 일 if ( $auto == 1 ) setcookie("user_id", $_SESSION['member']['id'] , $time , "/"); return true; }else{ return false; } } function sess_register() { global $FUNC; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $query=" SELECT id,pass,name,email,homepage,grade,gid,approval FROM kport_mem_table "; $query.=" WHERE id='".$this->id."' "; $res=mysqli_query($this->db_conn,$query); $row=mysqli_fetch_array($res); $_SESSION['member']['id']=$row['id']; $_SESSION['member']['pass']=$row['pass']; $_SESSION['member']['email']=$row['email']; $_SESSION['member']['homepage']=$row['homepage']; $_SESSION['member']['grade']=$row['grade']; $_SESSION['member']['gid']=$row['gid']; if( $row['grade'] == '1' ) { if ( $row['approval'] == 2 ) // 관리자 { $_SESSION['member']['is_admin']=true; //최고관리자 $_SESSION['member']['super_admin']=true; $_SESSION['member']['name']=$row['name']; } else if( $row['approval'] == 1 ) { $_SESSION['member']['is_admin']=true; //관리자 $_SESSION['member']['normal_admin']=true; $_SESSION['member']['name']=$row['name']; } else { $_SESSION['member']['is_admin']=true; //서브관리자 $_SESSION['member']['sub_admin']=true; $_SESSION['member']['name']=$row['name']; } } else { if ( $row['approval'] == 1 ) // 회원 { $_SESSION['member']['is_user']=true; $_SESSION['member']['name']=$row['name']; } else { // 인증되지 않음 $FUNC->Alert_Error("관리자의 승인이 필요합니다."); exit; } } // 세션등록 session_register("member"); } //////////////////////////////////////////////////////////// // 메뉴 리스트 //////////////////////////////////////////////////////////// function menu_list($level="") { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $Lwhere =""; if($level!=""){ $Lwhere =" WHERE menu_level='".$level."' "; } $query=" SELECT * FROM kport_menu_list "; $query.=$Lwhere ." ORDER BY menu_cate ASC ,menu_dep ASC"; //echo $query; $qry=mysqli_query($this->db_conn,$query); return $qry; } function menu_cate($cate="") { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $Lwhere =""; if($cate!=""){ $Lwhere =" WHERE menu_cate ='".$cate."' and menu_level!=1"; } $query=" SELECT * FROM kport_menu_list "; $query.=$Lwhere ." ORDER BY menu_cate ASC ,menu_dep ASC"; $qry=mysqli_query($this->db_conn,$query); return $qry; } //////////////////////////////////////////////////////////// // 메뉴 리스트 //////////////////////////////////////////////////////////// function myMenu_list($user) { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $Lwhere =""; if($user!=""){ $Lwhere =" WHERE mem_id='".$user."' "; } $query=" SELECT * FROM kport_mem_main "; $query.=$Lwhere ; $qry=mysqli_query($this->db_conn,$query); return $qry; } //////////////////////////////////////////////////////////// // 데이터 쿼리 (검색기능강화) //////////////////////////////////////////////////////////// function data($page) { global $MEMBER; global $gid, $mailing, $sex; global $period; global $sm, $sw; global $page_size, $page_scale; global $o_asc, $o_item; global $pos2, $pos; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); // 초기화 $this->p_size=$page_size; $this->p_scale=$page_scale; $this->page=$page; /////// 데이터 총수 / offset, page_size, page_scale // approval - 회원 : 1, 관리자 : 2 $query=" SELECT * FROM kport_mem_table "; $query.=" WHERE approval <= 1 and grade = 9 "; // 일반 계약자만 등록이 가능 if( $sm && $sw ) $query .= " AND ".$sm." like '%".$sw."%' "; if ( $gid != "all" ) $query .= " AND gid = '".$gid."' "; if ( $period != "" ) $query .= " AND reg_date >= ".$period; if ( $mailing != "" ) $query .= " AND mailing = ".$mailing; // 회원목록(★★ ) - info : 회원목록, install : 입주묘 관리 if ( $pos == 'info' OR $pos == 'install' ) { $query .= " AND LENGTH(add_frm10) = 5 AND LENGTH(id) > 0 AND LENGTH(pass) > 0 AND point = 'C2' "; } // 회원가입대기목록(★★ ) if ( $pos2 == 'standby' ) $query .= " AND LENGTH(add_frm10) = 11 AND id = '' AND add_frm7 ='' "; // 구매내역(★★ ) if ( $pos2 == 'view4_list' ) $query .= " AND no= ".$_GET['no']; $this->total = mysqli_num_rows(mysqli_query($this->db_conn,$query)); if ( $this->p_size and $this->p_scale ) { // page_size,page_scale $this->total_page=ceil($this->total/$this->p_size); $this->offset=($this->page-1)*$this->p_size; $this->block=floor(($this->page-1)/$this->p_scale); // 가상번호 $this->num=$this->total - (($this->page - 1) * $this->p_size); } /* /////// 데이터 쿼리 ( approval = 2 : 관리자 , approval = 1 : 회원 , approval = 0 : 비회원 ) $query=" SELECT * FROM kport_mem_table "; $query.=" WHERE approval <= 1 and grade = 9"; if( $sm && $sw ) $query .= " AND ".$sm." like '%".$sw."%' "; if ( $gid != "all" ) $query .= " AND gid = '".$gid."' "; if ( $period != 0 ) $query .= " AND reg_date >= ".$period; if ( $mailing != "" ) $query .= " AND mailing = ".$mailing; if ( $pos2 == 'standby' ) $query .= " AND LENGTH(add_frm10) = 11 AND id = '' "; // 회원가입대기목록(★★ ) */ if ( $sex != "" ) { if ($sex == 1 ) $sex2 = 3; else $sex2 = 4; $query .= " AND substring(reg_02,1,1) = ".$sex." OR substring(reg_02,1,1) = ".$sex2; } if ( $o_asc and $o_item ) $query.=" ORDER BY ".$o_item." ".$o_asc; else $query.=" ORDER BY reg_date DESC"; if ( $this->p_size and $this->p_scale ) { // page_size,page_scale $query.=" LIMIT ".$this->offset.", ".$this->p_size; } return $query; } //////////////////////////////////////////////////////////// // 맴버 정보 호출 //////////////////////////////////////////////////////////// function viewData() { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); if ( $_GET['id'] ) $where = " where id ='".$_GET['id']."'"; else if ( $_GET['no'] ) $where = " where no ='".$_GET['no']."'"; $query="SELECT * FROM kport_mem_table " . $where; return mysqli_query($this->db_conn,$query); } //////////////////////////////////////////////////////////// // 주민번호 체크 //////////////////////////////////////////////////////////// function reg($no1,$no2) { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); //$query="SELECT * FROM kport_mem_table WHERE reg_01='".$no1."' AND reg_02=OLD_PASSWORD('".$no2."') "; $query="SELECT * FROM kport_mem_table WHERE reg_01='".$no1."' AND reg_02='".$no2."' "; return mysqli_query($this->db_conn,$query); } //////////////////////////////////////////////////////////// // 전달된 비밀번호 암호화 //////////////////////////////////////////////////////////// function setPass($pass) { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $result = mysqli_query($this->db_conn,"SELECT OLD_PASSWORD('$pass')"); $res = mysqli_result($result,0,0); return $res; } //////////////////////////////////////////////////////////// // 데이터 배열 등록 //////////////////////////////////////////////////////////// function setArr($mem) { $this->id=$mem['id']; $this->pass=$mem['pass']; $this->name=$mem['name']; $this->email=$mem['email']; $this->homepage=$mem['homepage']; $this->reg_01=$mem['reg_01']; $this->reg_02=$mem['reg_02']; $this->tel_01=$mem['tel_01']; $this->tel_02=$mem['tel_02']; $this->tel_03=$mem['tel_03']; $this->code_01=$mem['code_01']; $this->code_02=$mem['code_02']; $this->addr_01=$mem['addr_01']; $this->addr_02=$mem['addr_02']; $this->reason_change = $mem['reason_change']; $this->zipcode = $mem['zipcode']; $this->post_code_01 = $mem['post_code_01']; $this->post_code_02 = $mem['post_code_02']; $this->post_addr_01 = $mem['post_addr_01']; $this->post_addr_02 = $mem['post_addr_02']; $this->message=$mem['message']; $this->mailing=$mem['mailing']; $this->point=$mem['point']; $this->gid=$mem['gid']; $this->approval = $mem['approval']; $this->reg_end_date = $mem['reg_end_date']; $this->ct_no =$mem['ct_no']; $this->cp_no =$mem['cp_no']; $this->ch_no =$mem['ch_no']; $this->cont_date = $mem['cont_date']; $this->succeed = $mem['succeed']; $this->cont_date = $mem['cont_date']; $this->succeed_jumin = $mem['succeed_jumin']; $this->succeed_addr1 = $mem['succeed_addr1']; $this->succeed_addr2 = $mem['succeed_addr2']; $this->succeed_zip = $mem['succeed_zip']; $this->succeed_tel = $mem['succeed_tel']; $this->succeed_hp = $mem['succeed_hp']; $this->succeed_manager = $mem['succeed_manager']; $this->rec_name = $mem['rec_name']; $this->rec_tel = $mem['rec_tel']; $this->rec_email = $mem['rec_email']; $this->rec_relation = $mem['rec_relation']; $this->c_c_price_date = $mem['c_c_price_date']; $this->c_r_price_date = $mem['c_r_price_date']; $this->c_block = $mem['c_block']; $this->wisu = $mem['wisu']; $this->cost = $mem['cost']; $this->add_frm1 = $mem['add_frm1']; $this->add_frm2 = $mem['add_frm2']; $this->rel_cemetery = $mem['rel_cemetery']; $this->care_money = $mem['care_money']; $this->care_year = $mem['care_year']; $this->new_zipcode = $mem['new_zipcode']; $this->succeed_new_zipcode = $mem['succeed_new_zipcode']; $this->post_new_zipcode = $mem['post_new_zipcode']; $this->type1 = $mem['type1']; $this->type2 = $mem['type2']; $this->type3 = $mem['type3']; for ( $i = 1 ; $i <= 10 ; $i++ ) { $this->{"add_frm".$i} = $mem["add_frm{$i}"]; } } //////////////////////////////////////////////////////////// // 회원 등록 //////////////////////////////////////////////////////////// function insertData() { global $mem_table; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); if ( !$mem_table ) $mem_table = 'kport_mem_table'; $this->reg_date=time(); // 현재시간 # ------------------------------------------ # 회원등급 ( admin, 사무관리, 작업관리, 영업담당 ) # ------------------------------------------ if ( $_POST['grade'] ) $this->grade = $_POST['grade']; // 관리자 else $this->grade = 9; // 기본등급 # ------------------------------------------ //$this->point=1000; // 기본포인트 # -----------> 청약및계약구분은 post 로 전달받음 /* // 회원등록 구분 ( ★★★ ) - 회원관리 if ( $_POST['old_pass'] and $_POST['update_pass'] == 0 ) { $this->pass = $_POST['update_pass']; } else { $this->pass = "OLD_PASSWORD('".$this->pass."')"; } */ $query=" INSERT INTO ".$mem_table." VALUES "; $query.=" ('','".$this->id."',OLD_PASSWORD('".$this->pass."'),'".$this->name."','".$this->email."', "; //$query.=" '".$this->homepage."','".$this->reg_01."',OLD_PASSWORD(".$this->reg_02."), "; $query.=" '".$this->homepage."','".$this->reg_01."','".$this->reg_02."', "; $query.=" '".$this->tel_01."','".$this->tel_02."','".$this->tel_03."','".$this->code_01."','".$this->code_02."', "; $query.=" '".$this->addr_01."','".$this->addr_02."','".$this->message."','".$this->file_name."',"; $query.="'".$this->mailing."','".$this->grade."','".$_POST['point']."',"; for ( $i = 1 ; $i <= 10; $i++ ) { $query .= " '".$this->{"add_frm".$i}."', "; } $query.=" '".$this->gid."','".$this->approval."','".$this->reg_date."','".$this->reg_end_date."', '', 0, '','".$this->ct_no."','".$this->cp_no."','".$this->ch_no."' ) "; // echo $query;exit; $res=mysqli_query($this->db_conn,$query); return $res; } function insertDataCemeteryReservation() { global $mem_table; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); if ( !$mem_table ) $mem_table = 'kport_mem_table'; $this->reg_date=time(); // 현재시간 # ------------------------------------------ # 회원등급 ( admin, 사무관리, 작업관리, 영업담당 ) # ------------------------------------------ if ( $_POST[grade] ) $this->grade = $_POST[grade]; // 관리자 else $this->grade = 9; // 기본등급 # ------------------------------------------ $query = " insert into ".$mem_table." set id = '".$this->id."', pass = OLD_PASSWORD('".$this->pass."'), name = '".$this->name."', email = '".$this->email."', homepage = '".$this->homepage."', reg_01 = '".$this->reg_01."', reg_02 = '".$this->reg_02."', tel_01 = '".$this->tel_01."', tel_02 = '".$this->tel_02."', tel_03 = '".$this->tel_03."', code_01 = '".$this->code_01."', code_02 = '".$this->code_02."', addr_01 = '".$this->addr_01."', addr_02 = '".$this->addr_02."', message = '".$this->message."', attach = '".$this->file_name."', mailing = '".$this->mailing."', grade = '".$this->grade."', point = 'A1', gid = '".$this->gid."', approval = '".$this->approval."', reg_date = '".$this->reg_date."', reg_end_date = '".$this->reg_end_date."', care_startdate = '', care_term = '0', direct = '', bunji = '".$this->c_block."', ct_no = '".$this->ct_no."', cp_no = '".$this->cp_no."', ch_no = '".$this->ch_no."', add_frm1 = '".$this->add_frm1."', wisu = '".$this->wisu."', cost = '".$this->cost."', type1 = '".$this->type1."', type2 = '".$this->type2."', type3 = '".$this->type3."', new_zipcode = '".$this->new_zipcode."', add_frm4 = '".$_SESSION['member']['name']."' "; $res = mysqli_query($this->db_conn,$query); return $res; } function insertDataCemeteryContract() { global $mem_table; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); if ( !$mem_table ) $mem_table = 'kport_mem_table'; $this->reg_date=time(); // 현재시간 # ------------------------------------------ # 회원등급 ( admin, 사무관리, 작업관리, 영업담당 ) # ------------------------------------------ if ( $_POST['grade'] ) $this->grade = $_POST['grade']; // 관리자 else $this->grade = 9; // 기본등급 # ------------------------------------------ $query = " insert into ".$mem_table." set id = '".$this->id."', pass = '".$this->pass."', name = '".$this->name."', email = '".$this->email."', homepage = '".$this->homepage."', reg_01 = '".$this->reg_01."', reg_02 = '".$this->reg_02."', tel_01 = '".$this->tel_01."', tel_02 = '".$this->tel_02."', tel_03 = '".$this->tel_03."', code_01 = '".$this->code_01."', code_02 = '".$this->code_02."', addr_01 = '".$this->addr_01."', addr_02 = '".$this->addr_02."', post_code_01 = '".$this->post_code_01."', post_code_02 = '".$this->post_code_02."', post_addr_01 = '".$this->post_addr_01."', post_addr_02 = '".$this->post_addr_02."', message = '".$this->message."', attach = '".$this->file_name."', mailing = '".$this->mailing."', grade = '".$this->grade."', point = '".$_POST['point']."', gid = '".$this->gid."', approval = '".$this->approval."', reg_date = '".$this->reg_date."', reg_end_date = '".$this->reg_end_date."', care_startdate = '', care_term = '0', direct = '', ct_no = '".$this->ct_no."', cp_no = '".$this->cp_no."', ch_no = '".$this->ch_no."', add_frm1 = '".$this->add_frm1."', add_frm2 = '".$this->add_frm2."', add_frm3 = '".$this->add_frm3."', add_frm4 = '".$_SESSION['member']['name']."', add_frm5 = '".$this->add_frm5."', add_frm6 = '".$this->add_frm6."', add_frm7 = '".$this->add_frm7."', add_frm8 = '".$this->add_frm8."', add_frm10 = '".$this->add_frm10."', succeed = '".$this->succeed."', succeed_jumin = '".$this->succeed_jumin."', succeed_addr1 = '".$this->succeed_addr1."', succeed_addr2 = '".$this->succeed_addr2."', succeed_zip = '".$this->succeed_zip."', succeed_tel = '".$this->succeed_tel."', succeed_hp = '".$this->succeed_hp."', cont_date = '".$this->cont_date."', rec_name = '".$this->rec_name."', rec_tel = '".$this->rec_tel."', rec_email = '".$this->rec_email."', rec_relation = '".$this->rec_relation."', bunji = '".$this->c_block."', c_c_price_date = '".$this->c_c_price_date."', c_r_price_date = '".$this->c_r_price_date."', rel_cemetery = '".$this->rel_cemetery."', wisu = '".$this->wisu."', care_money = '".$this->care_money."', care_year = '".$this->care_year."', manager = '".$this->succeed_manager."', type1 = '".$this->type1."', type2 = '".$this->type2."', type3 = '".$this->type3."', new_zipcode = '".$this->new_zipcode."', succeed_new_zipcode = '".$this->succeed_new_zipcode."', post_new_zipcode = '".$this->post_new_zipcode."', cost = '".$this->cost."' "; //echo $query;exit; $res = mysqli_query($this->db_conn,$query); return $res; } //////////////////////////////////////////////////////////// // 회원 등록 //////////////////////////////////////////////////////////// function updateData($no) { global $mem_table; global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); if ( !$mem_table ) $mem_table = 'kport_mem_table'; $this->reg_date=time(); // 현재시간 # ------------------------------------------ # 회원등급 ( admin, 사무관리, 작업관리, 영업담당 ) # ------------------------------------------ if ( $_POST['grade'] ) $this->grade = $_POST['grade']; // 관리자 else $this->grade = 9; // 기본등급 # ------------------------------------------ //$this->point=1000; // 기본포인트 # -----------> 청약및계약구분은 post 로 전달받음 /* // 회원등록 구분 ( ★★★ ) - 회원관리 if ( $_POST['old_pass'] and $_POST['update_pass'] == 0 ) { $this->pass = $_POST['update_pass']; } else { $this->pass = "OLD_PASSWORD('".$this->pass."')"; } */ $query="UPDATE kport_mem_table set name='".$this->name."', email='".$this->email."', homepage='".$this->homepage."', reg_01='".$this->reg_01."', reg_02='".$this->reg_02."', tel_01='".$this->tel_01."', tel_02='".$this->tel_02."', tel_03='".$this->tel_03."', tel_03='".$this->tel_03."', code_01='".$this->code_01."', code_02='".$this->code_02."', addr_01='".$this->addr_01."', addr_02='".$this->addr_02."', post_code_01='".$this->post_code_01."', post_code_02='".$this->post_code_02."', post_addr_01='".$this->post_addr_01."', post_addr_02='".$this->post_addr_02."', message='".$this->message."', attach='".$this->file_name."', mailing = '".$this->mailing."', grade = '".$this->grade."', cont_date = '".$this->cont_date."', reason_change = '".$this->reason_change."', c_c_price_date = '".$this->c_c_price_date."', c_r_price_date = '".$this->c_r_price_date."', succeed = '".$this->succeed."', succeed_jumin = '".$this->succeed_jumin."', succeed_addr1 = '".$this->succeed_addr1."', succeed_addr2 = '".$this->succeed_addr2."', succeed_zip = '".$this->succeed_zip."', succeed_tel = '".$this->succeed_tel."', succeed_hp = '".$this->succeed_hp."', rec_name = '".$this->rec_name."', rec_tel = '".$this->rec_tel."', rec_email = '".$this->rec_email."', rec_relation = '".$this->rec_relation."', add_frm1 = '".$this->add_frm1."', add_frm2 = '".$this->add_frm2."', add_frm3 = '".$this->add_frm3."', add_frm4 = '".$this->add_frm4."', add_frm5 = '".$this->add_frm5."', add_frm6 = '".$this->add_frm6."', add_frm7 = '".$this->add_frm7."', add_frm8 = '".$this->add_frm8."', cost = '".$this->cost."', wisu = '".$this->wisu."', rel_cemetery = '".$this->rel_cemetery."', type1 = '".$this->type1."', type2 = '".$this->type2."', type3 = '".$this->type3."', new_zipcode = '".$this->new_zipcode."', succeed_new_zipcode = '".$this->succeed_new_zipcode."', post_new_zipcode = '".$this->post_new_zipcode."', manager = '".$this->succeed_manager."', add_frm9 = '".$this->add_frm9."' where no = '".$no."' "; /* UPDATE kport_mem_table set name='이윤창', email='', homepage='', reg_01='780901', reg_02='1063322', tel_01='031-987-3448', tel_02='', tel_03='', tel_03='', code_01='', code_02='', addr_01='경기도 김포시 김포한강2로 69 (장기동, 초당마을 래미안 한강) ', addr_02='604동 502호 ', post_code_01='', post_code_02='', post_addr_01='경기도 김포시 김포한강2로 69 (장기동, 초당마을 래미안 한강) ', post_addr_02='604동 502호 ', message='', attach='', mailing = '', grade = '9', cont_date = '2009-10-18', reason_change = '', c_c_price_date = '', c_r_price_date = '', succeed = '', succeed_jumin = '-', succeed_addr1 = '충북 청주시 상당구 1순환로 1190 (방서동, (주)벽산미화종합건재철물)', succeed_addr2 = '3213213', succeed_zip = '-', succeed_tel = '--', succeed_hp = '--', rec_name = '이윤창', rec_tel = '', rec_email = '', rec_relation = '', add_frm1 = '010-6245-4474', add_frm2 = '--', add_frm3 = '', add_frm4 = '이성희', add_frm5 = '', add_frm6 = '', add_frm7 = '', add_frm8 = '', cost = '', wisu = '', rel_cemetery = '', new_zipcode = '', succeed_new_zipcode = '28787', post_new_zipcode = '415060', zipcode = '', succeed_manager = '', add_frm9 = '' where no = '2163' */ //echo $query;exit; $res = mysqli_query($this->db_conn,$query); return $res; } //////////////////////////////////////////////////////////// // 회원정보 삭제 //////////////////////////////////////////////////////////// function deleteData($no) { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $query=" DELETE FROM kport_mem_table "; $query.=" WHERE no=".$no; return mysqli_query($this->db_conn,$query); } //////////////////////////////////////////////////////////// // uploadData와 중복 내용 ;; //////////////////////////////////////////////////////////// function uploadData2($attach_name,$path,$old_attach='') { if (is_uploaded_file($attach_name)) { $file_name = $_FILES["attach"]["name"]; // 파일명 $file_size = $_FILES["attach"]["size"]; // 파일사이즈 $file_type = $_FILES["attach"]["type"]; // 파일 종류 $file_ext = substr($file_name,strrpos($file_name,".") + 1) ; // 확장자 $file_ext = strtolower($file_ext); // 확장자 소문자 // 디렉토리 유무 검사 (없으면 생성/퍼미션) if(is_dir($path) != 1) { @mkdir($path); @chmod($path, 0777); } // 중복체크 $i = 0 ; while (file_exists($path."/$file_name")) { $file_name = substr($file_name,0,strrpos($file_name,"._")).++$i .".$file_ext"; } // 파일이 존재할 경우 if ($file_size > 0) { if($file_name&&$old_attach) // 기존 첨부파일 삭제 및 데이터 수정 { $file_path=$path."/".$old_attach; $file_check = file_exists($file_path); if($file_check==1) $res=unlink($file_path); if(!$res) { $FUNC->Alert_Error("첨부파일이 삭제되지 않았습니다."); exit; } // 파일 업로드 $res=move_uploaded_file($attach_name,$path."/$file_name"); if(!$res) { $FUNC->Alert_Error("파일 업로드 중 오류가 발생했습니다."); exit; } }else{ // 신규 파일 등록 $res=move_uploaded_file($attach_name,$path."/$file_name"); if(!$res) { $FUNC->Alert_Error("파일 업로드 중 오류가 발생했습니다."); exit; } } } } else { // 클래스 맴버변수 정의 $file_name=$old_attach; } $this->file_name=$file_name; // 맴버 변수 정의 } } ?> db_host = $db_host; $this->db_name = $db_name; $this->db_user = $db_user; $this->db_pwd = $db_pwd; $this->charset = $db_charset; mysqli_report(MYSQLI_REPORT_OFF); $this->dbconn = @mysqli_connect($this->db_host, $this->db_user, $this->db_pwd, $this->db_name ); @mysqli_query($db_conn, "set names ".$this->charset, $this->dbconn); // 문자셋 설정 mysqli_select_db( $this->dbconn,$this->db_name); } function result ( $sql ) { global $host , $db_name , $db_id, $db_pass ,$db_charset; $this->db_conn = mysqli_connect($host, $db_name, $db_pass, $db_id); $sql = trim( $sql ); $result = @mysqli_query( $this->db_conn ,$sql); return $result; } function select ( $table, $where, $field = "*" ) { $sql = "Select $field from $table $where"; $result = $this->result( $sql ); return $result; } function object ( $table, $where, $field = "*" ) { $sql = "Select $field from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_object($result); return $row; } function row ( $table, $where, $field = "*" ) { $sql = "Select $field from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); return $row; } function sum ( $table, $where, $field = "*" ) { $sql = "Select sum($field) from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); if( $row[0] ) { return $row[0]; } else { return 0;} } function minRs ( $table, $where, $field = "*" ) { $sql = "Select min($field) from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); if( $row[0] ) { return $row[0]; } else { return 0;} } function maxRs ( $table, $where, $field = "*" ) { $sql = "Select max($field) from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); if( $row[0] ) { return $row[0]; } else { return 0;} } function cnt ( $table, $where) { $sql = "Select count(no) from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); if( $row[0] ) { return $row[0]; } else { return 0;} } function cnt2 ( $table, $where, $field = "*" ) { $sql = "Select count($field) from $table $where"; $result = $this->result( $sql ); $row = @mysqli_fetch_row($result); if( $row[0] ) { return $row[0]; } else { return 0;} } function insert ( $table, $data ) { $sql = "insert into $table set $data"; if($this->result( $sql )) { return true; } else { return false; } } function update ( $table, $data ) { $sql = "update $table set $data"; if($this->result( $sql )) { return true; } else { return false; } } function delete ( $table, $data ) { $sql = "delete from $table $data"; if($this->result( $sql )) { return true; } else { return false; } } function dropTable ( $data ) { $sql = "drop table $data"; if($this->result( $sql )) { return true; } else { return false; } } function createTable ( $data ) { $sql = "create table $data"; if($this->result( $sql )) { return true; } else { return false; } } function stripSlash ( $str ) { $str = trim( $str ); $str = stripslashes( $str ); return $str; } function addSlash ( $str ) { $str = trim( $str ); $str = addslashes( $str ); if(empty( $str )) { $str = "NULL"; } return $str; } } class tools { // 엔코드 function encode($data) { return base64_encode($data)."||"; } function check_bytes($num) { $btail = "bytes"; $ktail = "K"; if($num>=1024&&$num<1048576) { $this_num = $num/1024; $namuji = $num%1024; } else if($num>=1024&&$num>=1048576) { $this_num = $num/1048576; $namuji = $num%1048576; if($namuji>=1024) { $namuji = $namuji/1024; $btail = "K"; } $ktail="M"; } else $this_num=$num; echo $this->Nformat($this_num,0)." ".$ktail."  "; if($namuji>0) echo $this->Nformat($namuji,0)." ".$btail; } function Nformat($value,$sort) { echo number_format($value,$sort); return; } // 디코드 function decode($data){ $vars=explode("&",base64_decode(str_replace("||","",$data))); $vars_num=count($vars); for($i=0;$i<$vars_num;$i++) { $elements=explode("=",$vars[$i]); $var[$elements[0]]=$elements[1]; } return $var; } // 문자열 자르는 부분 function strCut($str, $len) { if ($len >= strlen($str)) return $str; $klen = $len - 1; while(ord($str[$klen]) & 0x80) $klen--; return substr($str, 0, $len - (($len + $klen + 1) % 2)) .".."; } // HTML 출력 function strHtml($str) { $str = trim($str); $str = stripslashes($str); return $str; } // 문자열 HTML BR 형태 출력 function strHtmlBr($str) { $str = trim($str); $str = stripslashes($str); $str = str_replace("\n","
", $str); return $str; } // 문자열 TEXT 형태 출력 function strHtmlNo($str) { $str = trim($str); $str = htmlspecialchars($str, ENT_COMPAT | ENT_HTML401); $str = stripslashes($str); $str = str_replace("\n","
", $str); return $str; } // 문자열 TEXT 형태 출력 function strHtmlNoBr($str) { $str = trim($str); $str = htmlspecialchars($str, ENT_COMPAT | ENT_HTML401); $str = stripslashes($str); return $str; } // 날자출력 형태 function strDateCut($str, $chk = 1) { if( $chk==1 ) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $str = $year."/".$mon."/".$day; } else if( $chk==2 ) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $time = substr($str,11,2); $minu = substr($str,14,2); $str = $year."/".$mon."/".$day." ".$time.":".$minu; } else if( $chk==3 ) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $str = $year."-".$mon."-".$day; } else if( $chk==4 ) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $time = substr($str,11,2); $minu = substr($str,14,2); $str = $year."-".$mon."-".$day." ".$time.":".$minu; } else if( $chk==5 ) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $str = $year."년 ".$mon."월 ".$day."일"; } else if( $chk==6) { $year = substr($str,0,4); $mon = substr($str,5,2); $day = substr($str,8,2); $time = substr($str,11,2); $minu = substr($str,14,2); $str = $year."년 ".$mon."월 ".$day."일 ".$time."시 ".$minu."분"; } return $str; } // 숫자로 된 값을 요일로 변환한다. (0:월요일, 1:화요일, 6:일요일) function strDateWeek($chk) { if( $chk==0 ) { $str="월요일"; } else if( $chk==1 ) { $str="화요일"; } else if( $chk==2 ) { $str="수요일"; } else if( $chk==3 ) { $str="목요일"; } else if( $chk==4 ) { $str="금요일"; } else if( $chk==5 ) { $str="토요일"; } else if( $chk==6) { $str="일요일"; } return $str; } # E-MAIL 주소가 정확한 것인지 검사하는 함수 # # eregi - 정규 표현식을 이용한 검사 (대소문자 무시) # http://www.php.net/manual/function.eregi.php # gethostbynamel - 호스트 이름으로 ip 를 얻어옴 # http://www.php.net/manual/function.gethostbynamel.php # checkdnsrr - 인터넷 호스트 네임이나 IP 어드레스에 대응되는 DNS 레코드를 체크함 # http://www.php.net/manual/function.checkdnsrr.php function chkMail($email,$hchk=0) { $url = trim($email); if($hchk) { $host = explode("@",$url); if(eregi("^[\xA1-\xFEa-z0-9_-]+@[\xA1-\xFEa-z0-9_-]+\.[a-z0-9._-]+$", $url)) { if(checkdnsrr($host[1],"MX") || gethostbynamel($host[1])) return $url; else return false; } } else { if(eregi("^[\xA1-\xFEa-z0-9_-]+@[\xA1-\xFEa-z0-9_-]+\.[a-z0-9._-]+$", $url)) return $url; else return false; } } // 주민등록번호진위여부 확인 함수 function chkJumin($resno1,$resno2) { $resno = $resno1.$resno2; $len = strlen($resno); if ($len <> 13) return false; if (!ereg('^[[:digit:]]{6}[1-4][[:digit:]]{6}$', $resno)) return false; $birthYear = ('2' >= $resno[6]) ? '19' : '20'; $birthYear += substr($resno, 0, 2); $birthMonth = substr($resno, 2, 2); $birthDate = substr($resno, 4, 2); if (!checkdate($birthMonth, $birthDate, $birthYear)) return false; for ($i = 0; $i < 13; $i++) $buf[$i] = (int) $resno[$i]; $multipliers = array(2,3,4,5,6,7,8,9,2,3,4,5); for ($i = $sum = 0; $i < 12; $i++) $sum += ($buf[$i] *= $multipliers[$i]); if ((11 - ($sum % 11)) % 10 != $buf[12]) return false; return true; } // 사업자등록번호 체크 함수 function chkCompany($reginum) { $weight = '137137135'; $len = strlen($reginum); $sum = 0; if ($len <> 10) return false; for ($i = 0; $i < 9; $i++) $sum = $sum + (substr($reginum,$i,1)*substr($weight,$i,1)); $sum = $sum + ((substr($reginum,8,1)*5)/10); $rst = $sum%10; if ($rst == 0) $result = 0; else $result = 10 - $rst; $saub = substr($reginum,9,1); if ($result <> $saub) return false; return true; } # 문자열에 한글이 포함되어 있는지 검사하는 함수 function chkHan($str) { # 특정 문자가 한글의 범위내(0xA1A1 - 0xFEFE)에 있는지 검사 $strCnt=0; while( strlen($str) >= $strCnt) { $char = ord($str[$strCnt]); if($char >= 0xa1 && $char <= 0xfe) return true; $strCnt++; } } // 문자열 체크(숫자) function chkDigit($str) { if(ereg("^[1-9]+[0-9]*$",$str)) return true; else return false; } // 문자열 체크(알파) function chkAlpha($str) { if(ereg("^[a-zA-Z]+[a-zA-Z]*$",$str)) return true; else return false; } // 문자열 체크(알파+숫자) function chkAlnum($str) { if(ereg("^[1-9a-zA-Z]+[0-9a-zA-Z]*$",$str)) return true; else return false; } // 문자열 체크(알파+숫자+특수문자) function chkAlnumAll($str) { if(ereg("^[1-9a-zA-Z_-]+[0-9a-zA-Z_-]*$",$str)) return true; else return false; } // 메세지 출력 function msg($msg) { echo ""; } // 메세지 출력후 BACK function errMsg($msg) { echo ""; exit(); } // 메세지 출력후 이동하는 자바스크립트 function alertJavaGo($msg,$url) { echo ""; exit(); } // 메세지 출력후 이동하는 메타테그 function alertMetaGo($msg,$url) { echo ""; echo ""; exit(); } // 메타태그로 바로 가기 function metaGo($url) { echo ""; exit(); } // 자바스크립트로 바로 가기 function javaGo($url) { echo ""; exit(); } // 창을 닫기 function winClose() { echo ""; exit(); } // 메세지 출력후 창을 닫기 function msgClose($msg) { echo ""; exit(); } // 창을 닫고 가는 함수 function javaGoClose($url) { echo ""; exit(); } // 프레임으로 된 경우 상위 프레임으로 가는 함수 function javaGoTop($msg,$url) { echo ""; exit(); } // 로그인 체크 function loginCheck(){ if(!$_SESSION[USERID]){ echo ""; }else{ return true; } } // 숫자콤마 function nf($val){ $nf =number_format($val); return $nf; } } ?>