테스트 사이트 - 개발 중인 베타 버전입니다

서브도메인을 추천인으로 할 때 (다시 올립니다. 잘못적었군뇨..ㅠ) 채택완료

zona 10년 전 조회 2,498

서브도메인을 추천인으로 하고 http://sir.co.kr/qa/88505#answer_88506">http://sir.co.kr/qa/88505#answer_88506
레벨3 이상만 추천인 활동을 하도록 했습니다 http://sir.co.kr/qa/83789#answer_88608">http://sir.co.kr/qa/83789#answer_88608
​그리고
http://sir.co.kr/qa/88639#answer_88691">http://sir.co.kr/qa/88639#answer_88691
카츠님의 도움으로

#추천인 회원레벨 3미만일때 도메인 자동이동
$domain_arr = explode('.',$_SERVER[HTTP_HOST]);
$dom = sql_fetch("select count(*) as cnt from g5_member where mb_id='".$domain_arr[0]."' and mb_level < '3' ");
if ($dom['cnt'] > 0){
 echo header("Location:<A href="<a href="http://test.com/" target="_blank" rel="noopener noreferrer">http://test.com/</a>"><a href="http://test.com" target="_blank" rel="noopener noreferrer">http://test.com</a></A>"); 
}</P>
<P>

이걸로 해서 레벨 3 이상은 http://추천인.test.com으로/">http://추천인.test.com으로, 레벨2는 그냥 http://test.com/">http://test.com으로 들어오는데

그런데,​ 문제는​

111.test.com
222.test.com
333.test.com

aksdjasdfadsf.test.com등등등​
"추천인아이디" 자리에 회원 아이디가 아이라 아무거나 막 적어도
http://아무거나.test.com/">http://아무거나.test.com 으로 접속이 되니 ...
"추천인아이디" 자리에 회원 아이디가 아이라 아무거나 막 적을 경우에도
http://test.com/">http://test.com 으로 오게 하려면 어떻게해야 할까요..

고수님들의 조언을 부탁드립니다. 꾸벅~
아무리 이래저래 고쳐봐도 안되는데...

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
10년 전

if ($dom['cnt'] > 0){
 echo header("Location:http://test.com">http://test.com");

 

위의 조건문을 아래와 같이 하면 어떨까요?

 

if ($dom['cnt'] > 0 || $domain_arr[0] != $member['mb_id']){
 echo header("Location:http://test.com">http://test.com");
}

 

위의 코드가 안 되면 아래와 같은 방법도...

</p><p>#추천인 회원레벨 3미만일때 도메인 자동이동
</p><p>$domain_arr = explode('.',$_SERVER[HTTP_HOST]);
</p><p>$dom = sql_fetch("select count(*) as cnt from g5_member where mb_id='".$domain_arr[0]."' and mb_level >= '3' ");
</p><p> </p><p>if ($dom['cnt'] > 0){
 </p><p>   echo header("Location:http://".$domain_arr[0]."test.com"); </p><p>
}
else {</p><p>   echo header("Location:<a href="<a href="http://test.com" target="_blank" rel="noopener noreferrer">http://test.com</a>"><a href="http://test.com" target="_blank" rel="noopener noreferrer">http://test.com</a></a>"); </p><p>}</p><p>
 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

z
zona
10년 전
감사합니다. 이것저것 조건을 계속 바꾸다보니 되네요... 시행착오의 연속이에요..ㅠ
if ($dom['cnt'] == 0){ 이걸로 해결했어요..ㅎㅎ
홈짱
9년 전
궁금한 게요...


왜 mb_id='$domain_arr[0]' 이렇게 안 적고 mb_id='".$domain_arr[0]."' 이렇게 적어줘야 하나요?
즉, $domain_arr[0] 앞뒤로 마침표 적고 큰따옴표로 묶고 그걸 또 작은따옴표로 묶는 이유가 궁금합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인