묻고답하기

우선 밑에 홈페이지 주소로 들어가 보시고 작동되는지 확인해 보세요..ㅡㅡ
( http://reipin.hostmoa.net/ )

다른 곳에서 조언듣고 수정해봤는데도 안되네요..;
어디가 틀렸는지 봐주세요..ㅡㅡ 초보라 잘 모르겠네요...

목적은 두가지의 페이지를 방문자가 선택해서 들어가는 것인데
이 선택을 쿠키에 저장해서 다음에 들어올때는 선택이 필요 없게끔 하는 건데요..

구조는 index.html에서 meta태그로 0.1초만에 이동 한 다음에
confirm.php로 이동합니다. 그 다음에 특정 쿠키가 존재하는지 아닌지를 판단해서
존재 한다면 intocookie.php로 이동하고, 없다면 choose.php로 이동해서 두가지 중
하나를 선택하는 겁니다. 선택하는 form에서 쿠키에 저장 할것인지 안할것인지 선택하는
checkbox도 있구요,
너무 복잡한가요...? 그림을 그려서..

confirm.php ─>쿠키가 존재하지 않을경우 : choose.php ─>"html"을 선택할 경우 : htmlindex.php
│                                                                  └>"flash"를 선택할 경우 : flashindex.php

└>쿠키가 존재할 경우 : intocookie.php ─>쿠키에 "flash"로 기록되있는경우 : flashindex.php
                                           └>쿠키에 "html"로 기록되있는 경우 : htmlindex.php

.....ㅡㅡ역시나 복잡하군요... 하여튼.. 소스는 아래와 같습니다.


confirm.php
----------------------------------------------------------------------------
<?
        //set(), get(), delete()메쏘드를 class.cookie.php에서 정의하여 불러온다.
        require_once("class.cookie.php");

        //쿠키값을 가져와 확인함. 없다면 선택페이지로 이동
        if (!$savecookie)//쿠키값이 없다면,
        {
                //쿠키값이 없으면, 선택하는 페이지로 이동
                Header("Location: choose.php") ;
        }
        else {
                //있다면, 해당페이지로 이동하기
                Header("Location: intocookie.php") ;
        }
?>
----------------------------------------------------------------------------


choose.php
----------------------------------------------------------------------------
<html>

<form action="intoform.php" method="post">

        <!'flash로 들어갈 것인지 html로 들어갈 것인지 선택>
        <input type="radio" name="choose" value="flash" checked> Flash를 포함한 페이지 <br>
        <input type="radio" name="choose" value="html">Flash가 없는 페이지 <br>

        <!'쿠키로 저장할 것인가 지정>
        <input type="checkbox" name="savecookie" value="savecookie"> 다음에 방문하실때에도 이 선택을..? <br>

        <!'폼 데이터로 전송>
        <input type="submit" value="들어가기">  
        <input type="reset">
</form>
</html>
----------------------------------------------------------------------------


intocookie.php
----------------------------------------------------------------------------
<?php
        //set(), get(), delete()메쏘드를 class.cookie.php에서 정의하여 불러온다.
        require_once("class.cookie.php");

        //해당 쿠키값을 가져와서 $choose에 대입
        //$choose = Cookie::get("choose");

        //쿠키값을 확인함. flash인지 html인지에 따라서 각 해당 페이지로 이동
        //쿠키값에서 flash선택을 하였을 경우 해당페이지로 이동
        if($choose == "flash")
        {
                Header("Location:flashindex.php") ;
        }
        //쿠키값에서 다른 선택(html)을 하였을 경우 해당 페이지로 이동
        else if($choose=="html")
        {
                Header("Location:htmlindex.php") ;
        }
?>
----------------------------------------------------------------------------


intoform.php <- 이 부분이 상당히 의심이 가는부분 입니다요....ㅡㅡ
----------------------------------------------------------------------------
<?php
require_once("class.cookie.php");
if ($savecookie=="savecookie")
{
        setcookie("savecookie",$savecookie,time() + 60,"/");
        setcookie("choose",$choose,"time() + 60","/");

        if($choose=="flash")
        {
                Header("Location: flashindex.php") ;
        }
        else if ($choose=="html")
        {
                Header("Location: htmlindex.php") ;
        }
}
else
{
        if ($choose=="flash")
        {
                Header("Location: flashindex.php") ;
        }
        else if ($choose=="html")
        {
                Header("Location: htmlindex.php") ;
        }
}
?>
----------------------------------------------------------------------------


flashindex.php
----------------------------------------------------------------------------
<html>
<head>
<title>시안</title>
</head>
<BODY BGCOLOR=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<center>
<table width=750 height=100% border=0 cellspacing=0 cellpadding=0>
        <tr>
                <td bgcolor=#5A66A3> flash</td>
        </tr>
</table>
</center>
</body>
</html>
----------------------------------------------------------------------------


flashindex.php
----------------------------------------------------------------------------
<html>
<head>
<title>시안</title>
</head>
<BODY BGCOLOR=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<center>
<table width=750 height=100% border=0 cellspacing=0 cellpadding=0>
        <tr>
                <td bgcolor=#5A66A3> html</td>
        </tr>
</table>
</center>
</body>
</html>
----------------------------------------------------------------------------


이상입니다..;;
별것 아닌 내용인데 파일은 이렇게 많아서야..ㅡㅡ;;;

부탁 드립니다..ㅠㅠ
* zero님에 의해서 게시물 이동되었습니다 (2002-08-17 21:19)