완료시 특정필드 가리기

완료시 특정필드 가리기

QA

완료시 특정필드 가리기

본문

상담완료시엔 전화번호가 모두 오픈되고

상담신청중,상담중일땐 레벨 5이상부터만 뒷자리를 보이게하고싶습니다.

방법좀 알려주세요 ㅠㅠㅠㅠ

 

 

 

list.php의 전화번호칸

            
        <?php
        for ($i=0; $i<count($list); $i++) {
            
        if ($list[$i]['wr_6']) { // 전화번호 필드에 값이 있으면
    if ($member['mb_level'] >= 5) // 회원 레벨이 5 이면
        $hp = $list[$i]['wr_6'];
    else // 회원 레벨 5가 아니거나, 비회원이라면
        $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
            
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리 

}

 

 

write.skin.php의 상담신청 체크버튼 부분 소스

 

 <? if($w == 'u') { ?>
        <tr>
        <th><label for="wr_4" > 상담신청</label></th>
            <td colspan="3">
              <select name="wr_5" style="width:100%; padding-left: 11px;">
              <option value="<span class='wr_5_btn wr_5_1'>상담신청</span>" <?php if($wr_5 =="상담신청") echo "selected=\"selected\""; ?>>상담신청</option>
              
              <option value="<span class='wr_5_btn wr_5_2'>상담  중  </span>" <?php if($wr_5 == "상담  중  ") echo "selected=\"selected\""; ?>>상담  중  </option>
              <option value="<span class='wr_5_btn wr_5_3'>상담완료</span>" <?php if($wr_5 == "상담완료") echo "selected=\"selected\""; ?>>상담완료</option>
            </select></td>
          </tr>
          <?php } ?>

이 질문에 댓글 쓰기 :

답변 5

<?php 
        for ($i=0; $i<count($list); $i++) { 
      if ($list[$i]['wr_5']=="상담완료") { // 회원 레벨이 5 이거나, 상담완료일때 
    $hp = $list[$i]['wr_6']; 
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리 
     } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때 
    $hp = $list[$i]['wr_6']; 
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리 
} else { 
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****"; 
    $hp_hyphen = $hp; 

해피정님
현재
  if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>견적완료</span>" || $list[$i]['wr_5']=="<span class='wr_5_btn wr_5_4'>견적취소</span>"|| $list[$i]['wr_5']=="<span class='wr_5_btn wr_5_2'>공사완료</span>") { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
    } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else {
    $hp = substr($list[$i]['wr_6'], 0, -2) . "**";
    $hp_hyphen = $hp;
}



이렇게 되어있는데
여기서 추가로 날짜가 오늘 올린날짜로부터 한달전게시물들은 뒤에 뒷자리 2개를 막고
최근한달꺼는 레벨5일경우에만 견적완료 인거 볼수있고 나머지는 오픈하는방법으로
수정불가능할까요

        if ($list[$i]['wr_6']) { // 전화번호 필드에 값이 있으면
    if ($member['mb_level'] >= 5) // 회원 레벨이 5 이면
        $hp = $list[$i]['wr_6'];
    else // 회원 레벨 5가 아니거나, 비회원이라면
        $hp = substr($list[$i]['wr_6'], 0, -4) . "****";

 

를 아래와 같이 변경하세요

 

if ($list[$i]['wr_5']=="상담완료" || $member['mb_level'] >= 5) // 회원 레벨이 5 이면
    $hp = $list[$i]['wr_6'];
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
}
 

기호 하나가 빠졌었네요

 

if ($list[$i]['wr_5']=="상담완료" || $member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
}

 

상담완료일때는 모두(비회원 포함)에게 전화번호 전체가 보입니다.

상담완료가 아닐때는 레벨5 이상이면 전화번호 전체가 보입니다.

<?php
        for ($i=0; $i<count($list); $i++) {
       
if ($list[$i]['wr_5']=="상담완료" || $member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
}

$hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리

}
이렇게 넣고 


<?=$hp_hyphen?> 불러오는곳에 <?=$hp_hyphen?> 이렇게 넣었는데 오류가나네요
잘못한걸까요

if ($list[$i]['wr_5']=="상담완료" || $member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때 
    $hp = $list[$i]['wr_6']; 

    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else { 
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****"; 

    $hp_hyphen = $hp;

 

붙일곳에는  <?php echo $hp_hyphen; ?>  이렇게 해보세요

<?php
        for ($i=0; $i<count($list); $i++) {
      if ($list[$i]['wr_5']=="상담완료" || $member['mb_level'] >= 1) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
    $hp_hyphen = $hp;
}



레벨부분을 5말고 1로 하니까 상담완료일때 다 번호는 보입니다
근데 상담신청일때는 레벨 5만 보이고싶은데
신청,완료 모두 다 보이네요 ㅠㅠㅠㅠ

해피정님
wr_5 부분을 <span class='wr_5_btn wr_5_3'>상담완료</span> 이렇게 수정하니까 적용이됬는데


    <?php
        for ($i=0; $i<count($list); $i++) {
      if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>상담완료</span>") { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
    } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
    $hp_hyphen = $hp;
}


view스킨에서는 어케 적용해야될까여
$list[$i] 를 $view로 고쳐도 적용이안되네용 ㅠㅠㅠㅠㅠ

해피정님 추가로 질문좀 드리겠습니다..ㅠㅠ
 <?php
        for ($i=0; $i<count($list); $i++) {
      if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>상담완료</span>") { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
    } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
    $hp_hyphen = $hp;
}

답변주신대로 이 상태에서
상담완료 뿐만아니라 견적취소 일때도 전화번호를 모두 오픈하고 싶습니다~

if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>상담완료</span>") {
를 이렇게 수정하면 되겠죠
if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>상담완료</span>" || $list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>상담취소</span>") {

if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>견적완료</span>" || $list[$i]['wr_5']=="<span class='wr_5_btn wr_5_2'>견적취소</span>") {
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
    } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp = $list[$i]['wr_6'];
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리
} else {
    $hp = substr($list[$i]['wr_6'], 0, -4) . "****";
    $hp_hyphen = $hp;
}

말씀대로 수정해보고  넣었는데 안먹히네요 ㅠㅠㅠㅠ

write부분에
<select name="wr_5" style="width:100%; padding-left: 11px; height: 51px;">
              <option value="<span class='wr_5_btn wr_5_1'>견적신청</span>" <?php if($wr_5 =="견적신청") echo "selected=\"selected\""; ?>>견적신청</option>
              <option value="<span class='wr_5_btn wr_5_2'>견적취소</span>" <?php if($wr_5 == "견적취소") echo "selected=\"selected\""; ?>>견적취소  </option>
              <option value="<span class='wr_5_btn wr_5_3'>견적완료</span>" <?php if($wr_5 == "견적완료") echo "selected=\"selected\""; ?>>견적완료</option>
                </select>

이렇게 되어있는데
  if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_2'>견적취소</span>") {
이렇게만 넣으면 왜 다 ****처리로 보일까요..?
ㅜㅜ

if ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_3'>견적완료</span>") {
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $list[$i]['wr_6']); // 하이픈 정규식 처리
} elseif ($list[$i]['wr_5']=="<span class='wr_5_btn wr_5_2'>견적취소</span>") {
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $list[$i]['wr_6']); // 하이픈 정규식 처리
} else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $list[$i]['wr_6']); // 하이픈 정규식 처리
} else {
    $hp_hyphen = substr($list[$i]['wr_6'], 0, -4) . "****";
}

이렇게 하면 되겠네요

view.skin.php  에서는 이렇게 사용하면 되겠죠...

 

 <?php 
      if ($view['wr_5']=="<span class='wr_5_btn wr_5_3'>상담완료</span>") { // 회원 레벨이 5 이거나, 상담완료일때 
    $hp = $view['wr_6']; 
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리 
    } else if ($member['mb_level'] >= 5) { // 회원 레벨이 5 이거나, 상담완료일때 
    $hp = $view['wr_6']; 
    $hp_hyphen = preg_replace("/(0(?:2|[0-9]{2}))([0-9\*]+)([0-9]{4}$)/", "\\1-\\2-\\3", $hp); // 하이픈 정규식 처리 
} else { 
    $hp = substr($view['wr_6'], 0, -4) . "****"; 
    $hp_hyphen = $hp; 

?>

답변을 작성하시기 전에 로그인 해주세요.
전체 129,100 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT