채택완료
추천인아이디를 서브도메인으로 하고, 레벨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 파일에 코드를 짜 봤는데
극초보 실력이라서...당연히 안되더라구요..
고수님들의 도움을 부탁드립니다. (_ _)
Copy
#추천인 회원레벨 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개 / 댓글 9개
채택된 답변
+20 포인트
새답변입니다. 이걸로 하세요.
Copy
#추천인 회원레벨 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";
}
답변에 대한 댓글 7개
죄송한데 하나 더 해결 못 한 게 있어서요....
추천회원아이디를 http://아무거나.test.com 써도 아무거나로 다 인식되는데, 아무거나 쓸 경우 “http://test.com"으로 연결되게 하려면 어떻게 해야 할까요...^^;
추천회원아이디를 http://아무거나.test.com 써도 아무거나로 다 인식되는데, 아무거나 쓸 경우 “http://test.com"으로 연결되게 하려면 어떻게 해야 할까요...^^;
아래의 모든 경우의 수를 다 해봤는데도 안되네요.. ㅠㅠ
고수님들의 조언을 다시 한 번 부탁드립니다...(_ _)
Copy
$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'); }
코드를 아래와 같이 바꾸세요.
Copy
#추천인 회원레벨 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개
안되네요..그래서 디테일하게 놓친 거 있나 보고
2줄에 ;추가, 5줄에 띄어쓰기 수정해 봤으나 그래도 안되네요..ㅠㅠ
엉엉..
[code]
#
$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";
}
[/code]
2줄에 ;추가, 5줄에 띄어쓰기 수정해 봤으나 그래도 안되네요..ㅠㅠ
엉엉..
[code]
#
$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";
}
[/code]
답변을 작성하려면 로그인이 필요합니다.