휴대폰번호, 전화번호, 이메일주소 노출방지 함수 정보
휴대폰번호, 전화번호, 이메일주소 노출방지 함수본문
// 전화번호, 휴대폰번호 노출방지
function get_privacy_hidden($str)
{
// 휴대폰번호 노출 방지
$str = preg_replace("#01[016789][^\d]*\d{3,4}[^\d]*\d{4}#", "<span class='cloudy small'>*** 휴대폰번호 노출금지 ***</span>", $str);
$str = preg_replace("#공일[*** 개인정보보호를 위한 휴대폰번호 노출방지 ***]{3,4}[^\d][*** 개인정보보호를 위한 휴대폰번호 노출방지 ***]{4}#", "<span class='cloudy small'>휴대폰번호 노출금지 ***</span>", $str);
// 전화번호 노출 방지
$str = preg_replace("#0(2|31|32|33|41|42|43|51|52|53|54|55|60|61|62|63|64|70|80)[^\d]*\d{3,4}[^\d]*\d{4}#", "<span class='cloudy small'>*** 전화번호 노출금지 ***</span>", $str);
// 이메일주소 노출 방지
$str = preg_replace("#<a href=[\"\']mailto:.*[\"\'][^>]*>(.*)?</a>#i", "$1", $str);
$str = preg_replace("#((\w+\.)*\w+@(\w+\.)+[A-Za-z]+)#", "<span class='cloudy small'>*** 이메일주소 노출금지 ***</span>", $str);
return $str;
}
function get_privacy_hidden($str)
{
// 휴대폰번호 노출 방지
$str = preg_replace("#01[016789][^\d]*\d{3,4}[^\d]*\d{4}#", "<span class='cloudy small'>*** 휴대폰번호 노출금지 ***</span>", $str);
$str = preg_replace("#공일[*** 개인정보보호를 위한 휴대폰번호 노출방지 ***]{3,4}[^\d][*** 개인정보보호를 위한 휴대폰번호 노출방지 ***]{4}#", "<span class='cloudy small'>휴대폰번호 노출금지 ***</span>", $str);
// 전화번호 노출 방지
$str = preg_replace("#0(2|31|32|33|41|42|43|51|52|53|54|55|60|61|62|63|64|70|80)[^\d]*\d{3,4}[^\d]*\d{4}#", "<span class='cloudy small'>*** 전화번호 노출금지 ***</span>", $str);
// 이메일주소 노출 방지
$str = preg_replace("#<a href=[\"\']mailto:.*[\"\'][^>]*>(.*)?</a>#i", "$1", $str);
$str = preg_replace("#((\w+\.)*\w+@(\w+\.)+[A-Za-z]+)#", "<span class='cloudy small'>*** 이메일주소 노출금지 ***</span>", $str);
return $str;
}
추천
5
5
댓글 4개
어디에 추가해야 하나요?
좋은팁 감사합니다
어디에 추가해야하나요 common.lib 가 맞나요 ^^*
이거 어디에다 추가 해야 하나요... common.lib.php 넣어도 그대로 나오던데...