일반페이지도 로그인해야 볼수 있게 하는 방법.. 정보
일반페이지도 로그인해야 볼수 있게 하는 방법..본문
검색해서 찾아보고 해봤는데 안되서 글올립니다..
경로문제인지..
제가 그누보드를 처음사용해봐서 맞게 쓰고 있는지는 잘 모르겠지만,
지금 제가 www 안에 ex 라는 폴더를 하나 만들고
그 안에서 작업을 하고 있습니다.
ex 안에는 제가 작업한 일반페이지 들이 들어 있구요.
gnuboard4 폴더는 ex 바깥에 있습니다.
ex/test/test/test.html 페이지를 회원로그인을 한 후에 볼수 있게 하고 싶은데,
방법이 없을까요?
www - ex - test - test - test.html
-
-
- gnuboard4
댓글 전체
_common.php 를 test.html 옆에 만드시고
<?
$g4_path = "../../../gnuboard4"; // common.php 의 상대 경로
include_once("$g4_path/common.php");
?>
test.html
첫줄에
<?php
include '_common.php';
if( empty( $member['mb_id'])) alert("로그인 하세요.");
?>
<?
$g4_path = "../../../gnuboard4"; // common.php 의 상대 경로
include_once("$g4_path/common.php");
?>
test.html
첫줄에
<?php
include '_common.php';
if( empty( $member['mb_id'])) alert("로그인 하세요.");
?>
rolo 님 말대로 하니까 되긴 되는데요...
그 test.html 의 문서 내용중에 test.php 를 인클루드 하거든요.
그래서 처음에 test.php에
<?php
include '_common.php';
if( empty( $member['mb_id'])) alert("로그인 하세요.");
?>
을 넣었는데, 로그인을 안하고 들어가면 경고창 잘 뜹니다.
그리고 로그인 하고 들어가면 페이지가 보이긴 하는데,
php가 인클루드 되는 처음 부분에
Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/faillove/www/ex/product/lg/lg10.html:5) in /home/hosting_users/faillove/www/gnuboard4/common.php on line 8
이런 오류메세지가 나타납니다.
그래서 php파일 소스를 html로 옮겨봤는데, 그렇게 하면 로그인 안한채 접속했을때,
경고창이 뜨질 않네요...
조언 부탁드립니다..
그 test.html 의 문서 내용중에 test.php 를 인클루드 하거든요.
그래서 처음에 test.php에
<?php
include '_common.php';
if( empty( $member['mb_id'])) alert("로그인 하세요.");
?>
을 넣었는데, 로그인을 안하고 들어가면 경고창 잘 뜹니다.
그리고 로그인 하고 들어가면 페이지가 보이긴 하는데,
php가 인클루드 되는 처음 부분에
Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/faillove/www/ex/product/lg/lg10.html:5) in /home/hosting_users/faillove/www/gnuboard4/common.php on line 8
이런 오류메세지가 나타납니다.
그래서 php파일 소스를 html로 옮겨봤는데, 그렇게 하면 로그인 안한채 접속했을때,
경고창이 뜨질 않네요...
조언 부탁드립니다..
_common.php 어찌 되었건 가장 맨 앞에 있어야 합니다.
t.html
==========
<?
include 'test.php';
..
?>
test.php
===========
<?
include '_common.php';
?>
이런 식이면 위와 같은 에러가 납니다.
t.html
<? include '_common.php';
include 'test.php';
...
?>
으로 바꾸세요.
t.html
==========
<?
include 'test.php';
..
?>
test.php
===========
<?
include '_common.php';
?>
이런 식이면 위와 같은 에러가 납니다.
t.html
<? include '_common.php';
include 'test.php';
...
?>
으로 바꾸세요.