추천인아이디를 서브도메인으로 하고, 레벨3 이상일 때만 주소 유지하기

추천인아이디를 서브도메인으로 하고, 레벨3 이상일 때만 주소 유지하기

QA

추천인아이디를 서브도메인으로 하고, 레벨3 이상일 때만 주소 유지하기

답변 3

본문

안녕하세요

서브도메인을 추천인으로 하고 http://sir.co.kr/qa/88505#answer_88506
레벨3 이상만 추천인 활동을 하도록 했습니다 http://sir.co.kr/qa/83789#answer_88608
그래서 현재
http://추천인아이디​.test.com    하고 접속하면 추천인이 자동으로 입력됩니다.
그런데,​
111.test.com
222.test.com
333.test.com 등등등
"추천인아이디" 자리에 아무거나 써도 다 그걸 추천인으로 인식하더군요.
그래서 "추천인아이디"가​ 레벨 3 이 안되면
그냥 http://test.com​ 으로 접속이 되도록 돌리고 싶어요
그래서​ index.php 파일에 코드를 짜 봤는데
극초보 실력이라서...당연히 안되더라구요..
고수님들의 도움을 부탁드립니다. (_ _)

#추천인 회원레벨 3미만일때 도메인 자동이동
$domain_arr = explode('.',$_SERVER[HTTP_HOST])
$dom_id="select count(*) from g5_member where mb_id='".$mb_id."' and mb_level < '3'";
if ($domain_arr[0] < $dom_id){
 $redirect= “http://test.com";
}
도메인의 첫글자(추천인)를 구하고, 회원레벨과 비교해서 3보다 작으면
​주소를 http://test.com 으로 이동한다...라고 하고 싶은뎅... ㅠ

이 질문에 댓글 쓰기 :

답변 3

새답변입니다. 이걸로 하세요.

#추천인 회원레벨 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){
 $redirect= “http://test.com";
}

아미나테마하고는 관계가 없을텐데요. 아미나 테마와 관련있는 코드가 사용된것도 아니구요. $redirect 변수에 할당된 http://test.com 으로 실제 리다이렉션은 걸어주셨나요?

어떻게 적용하셨는지 다른 장애가 생기는 코드가 있는지 유무를 모르니 저도 더이상답변은 어렵네요.

죄송한데 하나 더 해결 못 한 게 있어서요....
추천회원아이디를 http://아무거나.test.com 써도 아무거나로 다 인식되는데, 아무거나 쓸 경우 “http://test.com"으로 연결되게 하려면 어떻게 해야 할까요...^^;

코드를 아래와 같이 바꾸세요.

#추천인 회원레벨 3미만일때 도메인 자동이동
$domain_arr = explode('.',$_SERVER[HTTP_HOST])
$dom_cnt = "select count(*) from g5_member where mb_id='".$domain_arr[0]."' and mb_level < '3'";
if ($dom_cnt > 0){
 $redirect= “http://test.com";
}
​

안되네요..그래서 디테일하게 놓친 거 있나 보고
2줄에 ;추가, 5줄에 띄어쓰기 수정해 봤으나 그래도 안되네요..ㅠㅠ
엉엉..


#
$domain_arr = explode('.',$_SERVER[HTTP_HOST]);
$dom_cnt = "select count(*) from g5_member where mb_id = '".$domain_arr[0]."' and mb_level < '3'";
if ($dom_cnt > 0){
 $redirect = “http://test.com";
}

아래의 모든 경우의 수를 다 해봤는데도 안되네요.. ㅠㅠ

고수님들의 조언을 다시 한 번 부탁드립니다...(_ _)


$domain_arr = explode('.',$_SERVER[HTTP_HOST]);
$dom_id = "select count(*) from g5_member where mb_id='".$mb_id."' and mb_level >= '3'";
if (!$domain_arr[0] == $dom_id){
 //<1> $redirect = “http://test.com"; 
 //<2> redirect('test.com'); 
 //<3> echo "<meta http-equiv='refresh' content='0;url=test.com'>";
 //<4> echo header("Location:http://test.com");
 //<5> header("Location: http://test.com"); 
 //    exit();
 <6> $redirect('http://test.com'); 
}
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 51
© SIRSOFT
현재 페이지 제일 처음으로