홈페이지에서 몇개의 페이지를 로그인을 해야만 볼수 있도록 할려고 합니다.
license.php3라는 파일을 만들고 로그인을 했는지 않했는지 체크를 할려고 하는데 쿠키값을
못 불러 오는지 로그인을 해도 페이지가 열리질 않습니다. 도와주세요.
----------------------------------------------------------------------
/* -------------
license.php3
------------- */
<?php
if($isOK != $userid)
{
print "<script> window.alert('사용자 접속을 하지 않으면 접근할 수 없습니다.') history.go(-1)
</script>"; exit();
}
else
{
print "$mode";
exit();
}
?>
/* ---------------
cookie-injung.php3
--------------- */
<?
$table="login";
// DB 연결
$con = mysql_connect('localhost','login','5th');
mysql_select_db('login',$con);
function login($userid,$passwd){
global $con;
global $table;
// 이미 인증된 상태인지 체크
if(!IsSet($isOK)){
$query = "select user_id,password from $table where user_id='$userid'";
$result = mysql_query($query,$con);
if(!mysql_num_rows($result)){ // 찾는 유저아디가 있지않으면
include "menu.htm";
return 0;
}
else{
$dbid = mysql_result($result,0,"id");
$dbpasswd = mysql_result($result,0,"passwd");
if($dbid==$userid AND $dbpasswd==$passwd){
SetCookie("isOK",$userid,3600,"/");
return 1;
}
else{
include "menu.htm";
return 0;
}
}
}else //이미 인증된 경우
SetCookie("isOK",$id,time()+3600);
return 1;
}//end function
function errorpage($msg){
print $msg;
}
function logout() {
if( !IsSet( $auth ) )
errorpage ( "다시 로그인을 해 주십시요" );
SetCookie( "isOK", "" );
}
if(login($userid,$passwd)==1)
include "menu1.htm";
?>
----------------------------------------------------------------------
좋은 답변 부탁 드립니다.