묻고답하기

쿠키생성후에 아이디와 등급을 표출시키는데 성공했는데....
이것은 그냥 인덱스나 서브페이지에 인클루드하지 않고 했을때이구요...
이후에... 문제는...
로그인페이지(log_input.php)를...
인덱스페이지와 각각의서브페이지에 인클루드해서 나타내면 쿠키는 생성되지만 아이디와 등급이 표출되지않고 그대로 입력부분이 나타나는 문제가 발생합니다.
이걸 어이하면 좋겠습니까?
***************로그인풋소스***********************

<!-- 로그전 -->
<script language="JavaScript">

function check() {
if(login.id.value=="") {
alert("아이디를 입력하세요.");
login.id.focus();
return false;

} else if (login.passwd.value=="") {
alert("비밀번호를 입력하세요.");
login.passwd.focus();
return false;

}else {
return true;
}
}
</script>

<?php
if(!$HTTP_COOKIE_VARS[cgmember_id] || !$HTTP_COOKIE_VARS[cgmember_name]) {
?>

<table cellpadding=0 cellspacing=0>
<form name=login action="http://caregiver.bbidc.com/log_pro.php" method="post" onSubmit="return check()">
<!-- 스크립트 안먹힐때 부호를 붙혀준다 -->

<tr>
<td width=185 background=http://caregiver.bbidc.com/member/imgs/log_id.gif>
                
<input type=text name="id" size=14 style=border-style:none; background-color:transparent; maxlength=14>
</td>
<td width=181 background=http://caregiver.bbidc.com/member/imgs/log_password.gif>
                  
<input type=password name="passwd" size=14 style=border-style:none; background-color:transparent; maxlength=10>
</td>
<td>

<input type=image src=http://caregiver.bbidc.com/member/imgs/log_in.gif width=59 height=34 style=border-style:none; name="Submit" >

</td>
<td><a href=http://caregiver.bbidc.com/member/member_lost_id.php><img src=http://caregiver.bbidc.com/member/imgs/log_lost_idpw.gif width=72 height=34 border=0></a>
</td>
<td><a href=http://caregiver.bbidc.com/member/member_write.php><img src=http://caregiver.bbidc.com/member/log_member.gif border=0 width=74 height=34></a>
</td>
</tr>
</form>


</table>
<?
}
else {
?>
<!-- 로그후 -->
<table cellpadding=0 cellspacing=0>
<tr>
<td>

<table cellpadding=0 cellspacing=0>
<tr>
<td width=370 background=http://caregiver.bbidc.com/member/imgs/log_member_bg.gif valign=bottom>

<table align=center cellpadding=0 cellspacing=0 width=92% height=30>
<tr>
<td><p align=center><font color=#00849F>
<?=$HTTP_COOKIE_VARS[cgmember_id]?></font> 회원님 어서오십시오.
<font color=#ff9999>[Level : <?=$HTTP_COOKIE_VARS[cgmember_grade]?> ]</font></p>
</td>
</tr>
</table>

</td>
<td>
<p><img src=http://caregiver.bbidc.com/member/imgs/log_myinfo.gif width=75 height=34 border=0></p>
</td>

</tr>
</table>

</td>
<td>
<p><img src=http://caregiver.bbidc.com/member/imgs/log_profile.gif border=0 width=80 height=34></p>
</td>
<td>
<p><a href=http://caregiver.bbidc.com/log_out.php><img src=http://caregiver.bbidc.com/member/imgs/log_out.gif border=0 width=69 height=34></a></p>
</td>
</tr>
</table>
<?
}
?>





*******************로그인프로세스******************************



<?php
include("dbcon.php");

$query = "select passwd,name,email,grade from cg_member where id='$id'";
$result = mysql_query($query, $connect);
$rows = mysql_num_rows($result);
$url=$HTTP_REFERER;


if(!$rows) {
echo ("
<script>
alert('[error!] 관리자에게 문의하십시오.')
history.go(-1)
</script>

");
exit;
}
else {
$info = mysql_fetch_array($result);

if($info['passwd'] != $passwd) {
echo("
<script>
alert('비밀번호가 다릅니다.')
history.go(-1)
</script>
");
exit;
}
else {

$name = $info[name];
$email = $info[email];
$grade = $info[grade];

SetCookie("cgmember_id", $id, time()+3600, "/");
SetCookie("cgmember_name", $name, time()+3600, "/");
SetCookie("cgmember_email", $email, time()+3600, "/");
SetCookie("cgmember_grade", $grade, time()+3600, "/");
if($id == 'caregiver') {
echo ("
<script>
location='admin/member_admin.php'
</script>

");
}else{
echo("
<script>location.href='".$url."'</script>
");
}
}}
mysql_close();
exit;

?>