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

get_cookie를 이용한 특정페이지 기록남기기 채택완료

오이군 11년 전 조회 4,126

안녕하세요.

 

문의드릴게 있어서 이렇게 몇자 적습니다.

 

A사이트를 운영중인데요.

 

밤에는 A 사이트 접속시 B 사이트로 접속하게 설정을 하였습니다.

 

그런데 낮에 A 사이트를 접속했을때 쿠키를 통해서 밤에 접속한 B사이트로 강제로 이동시키고 싶은데요.

 

어떻게 해야 할지 잘 모르겠네요...ㅠ.ㅠ

 

도움 부탁드립니다.

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

답변 2개

11년 전

</p><p> </p><p>$timecheck = date(H);</p><p> </p><p>if(<span style="font-size: 10pt; line-height: 1.5;">$_COOKIE[set_night]</span><span style="font-size: 10pt; line-height: 1.5;">​=="</span><span style="font-size: 10pt; line-height: 1.5;">night_ok</span><span style="font-size: 10pt; line-height: 1.5;">​"</span><span style="font-size: 10pt; line-height: 1.5;">){</span><span style="font-size: 10pt; line-height: 1.5;">//쿠키 있다면</span><span style="font-size: 10pt; line-height: 1.5;">​</span></p><p> </p><p><span style="font-size: 10pt; line-height: 1.5;">?></span></p><p><span style="font-size: 10pt; line-height: 1.5;"> </span></p><p><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"><</span><strong class="hl" style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">meta</strong><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"> http-equiv="Refresh" content="0;</span><strong class="hl" style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">url</strong><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">=밤에 이동할 사이트 주소"></span></p><p><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"> </span></p><p><span style="font-size: 10pt; line-height: 1.5;"><?</span> </p><p> </p><p><span style="font-size: 10pt; line-height: 1.5;">}//쿠키 있다면</span></p><p><span style="font-size: 10pt; line-height: 1.5;"> </span></p><p>if(<span style="font-size: 10pt; line-height: 1.5;">$timecheck</span><span style="font-size: 10pt; line-height: 1.5;">​>19 || </span><span style="font-size: 10pt; line-height: 1.5;">$timecheck</span><span style="font-size: 10pt; line-height: 1.5;">​ <6</span><span style="font-size: 10pt; line-height: 1.5;">){ //밤에 접속한 사용자라면</span></p><p> </p><p style="margin-left: 40px;">​setcookie('<span style="font-size: 10pt; line-height: 1.5;">set_night</span><span style="font-size: 10pt; line-height: 1.5;">​</span><span style="font-size: 10pt; line-height: 1.5;">', 'night_ok', time()+(60*60*24*31)); //한달간저장</span></p><p style="margin-left: 40px;"> <span style="font-size: 10pt; line-height: 1.5;"> </span></p><p><span style="font-size: 10pt; line-height: 1.5;"> </span></p><p><span style="font-size: 10pt; line-height: 1.5;">//밤에접속할 사이트 이동</span></p><p><span style="font-size: 10pt; line-height: 1.5;"> </span></p><p>?></p><p> </p><p><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"><</span><strong class="hl" style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">meta</strong><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"> http-equiv="Refresh" content="0;</span><strong class="hl" style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">url</strong><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;">=밤에 이동할 사이트 주소"></span></p><p><span style="font-family: 굴림, gulim, helvetica, sans-serif; font-size: 12px; line-height: 18px;"> </span></p><p><?</p><p> </p><p><span style="font-size: 10pt; line-height: 1.5;">}//timecheck if문</span></p><p><span style="font-size: 10pt; line-height: 1.5;">
?></span></p><p><span style="font-size: 10pt; line-height: 1.5;">

 

쿠키방식으로 한다면 사용할 코드입니다.

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

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

별로 좋은 방법은 아니네요

왜냐구요?

낮에 방문했어요! 근데 제가 쿠키를 지웠어요!

그럼 원래는 밤에 갈 사이트여야 하는데 낮에 갈 사이트로 가지겠지요!

또 낮에는 A라는 컴에서 접속을 했어요. 근데 밤에는 B라는 컴으로 접속을 해요

그러면 쿠키가 틀리겠지요? 

쿠키를 하지 마시고 그 날의 로그인 또는 방문이력을 남기세요!

ip 또는 로그인 id를 db에 저장하시고 이를 검사함으로 밤에 사이트로 이동하게끔 하는게 좋을 듯 합니다

제 생각이니 어떻게 하시든 개발자가 하기 나름이지만요~~ 

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

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

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

로그인