개발 Q&A

제목 redirect 가 안되어요.
글쓴이 욕쟁이꼬마 작성시각 2014/06/05 11:06:37
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 12149   RSS
게시판의 bbs 샘플프로그램으로 열심히 공부중입니다.
auth.php 중 login 을 성공하면 메인 페이지를 다시한번 재구성해주고싶은데요.
 
auth.php
...
auth::_remap()
{
     $this->load->view('header_v');
     if( method_exists( $this, $method ))      
    {
          $this->{"{$method}"}(); // $method='login'
     }
}


auth::login()
{
...
... 쿼리 결과후 0 < $result
...
            if( false != $result ) 
            {
                // 세션 생성
                $newdata = array(
                    'username' => $result->username,
                    'password' => $result->password,
                    'nickname' => $result->nickname,
                    'email' => $result->email,
                    'logged_in' => TRUE
                );

                $this->session->set_userdata( $newdata );
                // 로그인 되었습니다.', '/bbs/board/lists/ci_board/page/1'
                error_log("Auth: Login=login success");
                redirect('/auth/login/');
            }
            error_log("Auth: Login=login failed");
}
이렇게 redirect 했는데..그냥 화면이 먹통이 나옵니다.
ㅇㅏ..어디서부터 점검을 해줘야할까요.
 
첨부파일 application.zip (26.2 KB)
 다음글 ajax 페이지 setinterval 로 이미지 5초 ... (3)
 이전글 ie8에서 혹시 jqueryform 사용하시는분 있나요... (1)

댓글

변종원(웅파) / 2014/06/05 11:22:00 / 추천 0
php코드와 html이 짬뽕인데 에러 나는건 당연합니다. (위 소스대로 되어 있다면요)
욕쟁이꼬마 / 2014/06/05 11:36:42 / 추천 0

:) 넵 원래 html 코드는 없고요.
자료실의 bbs 코드로 이리저리 궁리하면서 작업했는데 벽이 좀 높네요. ^^*

$method 가 실행되면 실행되는코드입니다. auth::login 부분인데요.
header_v.php 가 출력된후 login()으로 들어와서 로그인쿼리결과로 화면을 재구성 하려고생각했어요. redirect 하면 그냥 될것같았는데.. 안되어서 문의드려요. 

혹시 웹서버에서도 뭔가 설정하는게 있을까요?
redirect('auth','refresh'); 이렇게 하면 웹서버는 이렇게 받아들이는군요. 멘붕..ㅠㅠ login 은 호출하지 않았는데.
[05/Jun/2014:12:23:52 +0900] "POST /cistudy/index.php/auth/login HTTP/1.1" 500 -

 

한대승(불의회상) / 2014/06/05 13:10:47 / 추천 0
욕쟁이꼬마// 새로운 시도를 많이 하시는군요. ^^

아래처러 바꿔 보세요.
 
// $this->{"{$method}"}()
$this->{$method}()
욕쟁이꼬마 / 2014/06/05 13:22:25 / 추천 0
아 소스올려서 댓글달기 힘드네요 ㅎ_ㅎ 그렇게 수정해도 마찬가지에요. 함수는 잘 호출이되고있어요.
제생각에는 redirect('http://localhost/cistudy'); 했으면 웹로그에 
"POST /cistudy/index.php/auth/login HTTP/1.1" 500 - 이렇게 나오는거는 잘못된것같은데요.

header_v.php 내에서 로그인 액션이 이렇게 들어가고있는데 
 <?php
   $attributes = array('class' => 'form-horizontal', 'id' => 'auth_login');
   echo form_open('/auth/login', $attributes);
   ?>
redirect시에지정된 주소가 redirect('http://localhost/cistudy');  적용되는게 아니라 header_v: login 폼액션의 주소 form_open('/auth/login', $attributes); 가 redirect 되는데 원래 이런건가요?
욕쟁이꼬마 / 2014/06/05 13:35:35 / 추천 0
$this->session->set_userdata( $newdata );
                // 로그인 되었습니다.', '/bbs/board/lists/ci_board/page/1'
                error_log('Auth: Login=login success');
                header('Location: http://localhost/cistudy/' ) ;
                //redirect('http://localhost/cistudy');
..왠지 이렇게 하니까 출력이되긴하는데요. ..컴터 리부팅해보고 다시해봐야지..어리버리해서 어쩌다가 되었는지 모르니;;