CI 묻고 답하기

제목 ci 를 사용하며 난관에 빠졌습니다. session 이 특정브라우저에서 사용이 안됩니다.
글쓴이 핀치엔스마일 작성시각 2013/03/18 19:54:35
댓글 : 22 추천 : 0 스크랩 : 0 조회수 : 20036   RSS
 개발할대 사용했던 ie는 7,8,9 로 테스트를 하면서 개발을 진행했습니다.

몇일전에 ie10이 생겨서 기뿐마음으로 개발한 사이트에 로그인하려는 순간

로그인이 정상적으로 진행이 안돼더라구요

확인해보니 session 이 생성이 안되는것이였습니다.

예상돼는 이유는 페이지를 리로드 할때마다 session_id가 새로 생성돼는걸로 봐서 이문제때문에 정상적으로 로그인 처리를 못하는것으로 보입니다.

혹시 이와같은 문제 격으신분또는 해결방법또는 힌트 있으시면 같이 공유해주시면 감사하겠습니다. 

즐거운 하루보내세요~


ci의 버전은 2.1.3 입니다.

 다음글 view에서 foreach질문입니다. (4)
 이전글 뭔가 잘못짠거 같아요. (5)

댓글

변종원(웅파) / 2013/03/18 21:42:51 / 추천 0
호환모드로 해도 안되는지요?
핀치엔스마일 / 2013/03/18 22:21:59 / 추천 0
 네 호환모드로해도 안돼네요 이쪽사이트에도 접속이 안돼네요....음....지금이글을쓰는브라우저는 크롬을 사용하여 작성하고 있고 제가 사용하고있는 브라우저로는 접속이 안돼네요..ㅠ.ㅠ
어떻게 보면 세션이란 부분이 코어틱한 부분인데....문제가생겨서 속상하네요ㅠ.ㅠ 계속 답을 찾아봐야죵..^^;
변종원(웅파) / 2013/03/18 22:36:15 / 추천 0
음.. 뭔가 이상하네요.

저는 win8, ie10에서 호환성모드로 로그인 하여 2.1.3에서 테스트가 끝났습니다.(ci 입문서 원고 작성)

개발노트북이 win8 환경이라 ie10, chrome, ff 모두 테스트를 했습니다.

로그인 부분 config.php와 컨트롤러와 뷰를 올려주시면 답을 드릴 수도 있을 것 같습니다.
핀치엔스마일 / 2013/03/18 22:41:47 / 추천 0
 먼저 이렇게 도움을 주셔서 감사합니다.
config.php
시작
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = '';
 
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
//$config['index_page'] = 'index.php';
//mod .htaccess ���; '�ؼ� index.php f��
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';
 
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
*/
 
$config['url_suffix'] = '';
 
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'korean';
 
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';
 
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean).  See the user guide for details.
|
*/
//HOOK ��� ��d ����Ʈ : FALSE => HOOK ���; '�ؼ� TRUE
$config['enable_hooks'] = TRUE;
 
 
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
|
*/
$config['subclass_prefix'] = 'MY_';
 
 
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs.  When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
 
 
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array.  If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
 
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
 
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
 
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
 
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder.  Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
 
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = 'kwongunbo';
 
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
| 'sess_expiration' = the number of SECONDS you want the session to last.
|   by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|   when the browser window is closed
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
| 'sess_use_database' = Whether to save the session data to a database
| 'sess_table_name' = The name of the session database table
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'cisessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update'] = 0;
 
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path'   =  Typically will be a forward slash
| 'cookie_secure' =  Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
 
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = FALSE;
 
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
 
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads.  When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT:  If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts.  For
| compression to work, nothing can be sent before the output buffer is called
| by the output class.  Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
 
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or 'gmt'.  This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT.  See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';
 
 
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files.  Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
 
 
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
 
//사용자 지정
$config['profile'] = "/uploads/profile";
$config['eduplan'] = "/uploads/eduplan";
$config['temp'] = "/uploads/temp";
/* End of file config.php */
/* Location: ./application/config/config.php */
끝 



 
핀치엔스마일 / 2013/03/18 22:43:54 / 추천 0
 위에 부분이 config.php 입니다.

그리고 아래의 소스는 정상적인 사용자인지 체크한후 세션에 값을 답는 기능을 담당하는 곳입니다.


세션을 저장하는 부분은
/**
* 로그인 처리
* TYPE A=>관리자 ,S=>학교 , K=>강사,  H=> 학생, 전체관리자=>ADMIN
*
*/
public function loginproc()
{
$param = $this->input->post();
if($param['mb_id'] && $param['mb_pw'] && $param['mb_type'])
{
$result = $this->member_model->loginChk($param['mb_id'],$param['mb_pw'],$param['mb_type']);
if(count($result)>0)
{
//로그인성공
$session_array = array(
'mb_id' => $param['mb_id']
,'mb_level' => $param['mb_type']
,'logindate' => date('ymdhis')
,'name' => $result['0']['name']
,'code' => $result['0']['code']
);
//슈퍼관리자인지 체크
if($param['mb_type']=="A")
{
if($result['0']['issuper']=="S")
{
$session_array['mb_level'] = "ADMIN";
}
}
//$this->session->set_userdata($session_array);
foreach($session_array as $k=>$v) {
$this->session->set_userdata($k,$v);
}
$this->javascript->href("/");
}
else
{
$this->javascript->alert("아이디또는 비밀번호가 틀립니다. 다시 로그인을 시도해주시기 바랍니다.");
$this->javascript->back("-1");
}
}
}
변종원(웅파) / 2013/03/18 22:46:37 / 추천 0
$config['sess_time_to_update'] 이 항목을 0으로 주신 이유가 있을까요?
핀치엔스마일 / 2013/03/18 22:46:38 / 추천 0
 한가지 더 세션이랑 쿠키 값을 확인해보았는데 크롬(현재 정상작동)은 쿠키가 보여지고 ie10에서는 쿠키가 정상적으로 보여지지 않네요

크롬
$this->session->all_userdata()
Array
(
    [session_id] => f809f4f0916533d0f3124a5083530d78
    [ip_address] => 110.15.21.38
    [user_agent] => Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22
    [last_activity] => 1363614769
    [user_data] => 
)
$_COOKIE
Array
(
    [PHPSESSID] => 70pulcgq5t20cuum1t9tnd6ij7
    [cisession] => a:5:{s:10:"session_id";s:32:"10ffaaff87209b5894bf36ee9a2807a6";s:10:"ip_address";s:12:"110.15.21.38";s:10:"user_agent";s:109:"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22";s:13:"last_activity";i:1363614768;s:9:"user_data";s:0:"";}39c581ff072cb3a14dd16c424cb4d61d
)


ie
$this->session->all_userdata()
Array
(
    [session_id] => 875c79e09b5b68f7566beefe82372ee8
    [ip_address] => 110.15.21.38
    [user_agent] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; WOW64; Trident/4.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 
    [last_activity] => 1363614842
    [user_data] => 
)
$_COOKIE
Array
(
)




핀치엔스마일 / 2013/03/18 22:48:16 / 추천 0
 $config['sess_time_to_update'] 이 항목을 0으로 주신 이유가 있을까요? 
=> 문제가 발생하여 해결하는과정중에 게시물을 내용들을 확인한 결과 0 으로하면 업데이트 시간을 무한대로 가져간다고 하길래 그렇게 설정하였습니다. 
$this->session->all_userdata('session_id') 값이 계속적으로 바뀌길래 혹시 그것때문에 세션정보를 저장못하는가 해서 바꾸게되었습니다.
변종원(웅파) / 2013/03/18 22:48:57 / 추천 0
foreach($session_array as $k=>$v) {
 
$this->session->set_userdata($k,$v);
 
}

이렇게 하신 이유도요. 한번에 선언이 가능한데요.
변종원(웅파) / 2013/03/18 22:50:14 / 추천 0
크롬에서도 session_id가 다릅니다. 뭔가 잘못 만드신듯..
핀치엔스마일 / 2013/03/18 22:50:48 / 추천 0
 이것도 테스트 구글링하는 와중에 사파리랑 다른 사이트에서 저와 비슷한 경험있다고 하여 저렇게해서 해결하였다고 하길래 시도해본내용입니다. 혹시 앞전에 내용과 이내용이 문제의 소지가될수있을까요?
변종원(웅파) / 2013/03/18 22:51:15 / 추천 0
$newdata = array(
                   'username'  => 'johndoe',
                   'email'     => 'johndoe@some-site.com',
                   'logged_in' => TRUE
               );

$this->session->set_userdata($newdata);

 

핀치엔스마일 / 2013/03/18 22:51:37 / 추천 0
 그런데 대부분의 브라우저에서 잘작동합니다. 거진 1달 반 정도 개발하면서 여러 브라우저에서 테스트를 해봤을때 전혀문제가 없었는데....말입니다.
변종원(웅파) / 2013/03/18 22:52:37 / 추천 0
일단 ie10에서는 아예 세션이 안만들어지고 크롬에서는 다른 session_id로 생성이 되는 것 같습니다.
핀치엔스마일 / 2013/03/18 22:55:04 / 추천 0
 브라우져 설정이나 이런 부분의 문제라고 봐야할까요?

ie는 언제나 문제의 근원이군요....ㅠㅠ