diff --git a/application/config/config.php b/application/config/config.php index 6cd00a7..ba3ee2a 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -23,7 +23,17 @@ | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = 'http://localhost/akreditasi'; + +$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === 0 ? 'https://' : 'http://'; +$domain = $_SERVER['HTTP_HOST']; +$root = $protocol.$domain; +$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']); +$req_uri = $_SERVER['REQUEST_URI']; +$path = substr($req_uri,0,strrpos($req_uri,'/')); + +$config['base_url'] = $root; + +//$config['base_url'] = 'http://localhost/akreditasi'; /* |-------------------------------------------------------------------------- @@ -401,8 +411,10 @@ | */ $config['cookie_prefix'] = ''; -$config['cookie_domain'] = 'localhost'; -$config['cookie_path'] = '/akreditasi'; +$config['cookie_domain'] = $domain; +$config['cookie_path'] = '/'.$path; +//$config['cookie_domain'] = 'localhost'; +//$config['cookie_path'] = '/akreditasi'; $config['cookie_secure'] = FALSE; $config['cookie_httponly'] = FALSE; diff --git a/application/helpers/util_helper.php b/application/helpers/util_helper.php index 7083cac..15461e0 100644 --- a/application/helpers/util_helper.php +++ b/application/helpers/util_helper.php @@ -213,7 +213,21 @@ function split_page_id($page_id=null){ function get_link($page_id=null){ if(!is_string($page_id)) return _get_link($page_id); $arr = split_page_id($page_id); - $link = _get_link(...$arr); + switch(count($arr)){ + case 0: + $link = _get_link(); + break; + case 1: + $link = _get_link($arr[0]); + break; + case 2: + $link = _get_link($arr[0], $arr[1]); + break; + default: + $link = _get_link($arr[0], $arr[1], $arr[2]); + break; + } + //$link = _get_link(...$arr); $link["id"] = $page_id; return $link; } diff --git a/index.php b/index.php index e505504..c105b6d 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,8 @@