diff --git a/index.php b/index.php
index d4696cf2c5..93093b00cb 100644
--- a/index.php
+++ b/index.php
@@ -43,7 +43,7 @@ $htmlHeadXtra[] ='
';
//set cookie for check if client browser are cookies enabled
-setcookie("TestCookie", "cookies_yes", time()+3600);
+setcookie('TestCookie', 'cookies_yes', time()+3600*24*31*12);
$controller = new IndexManager($header_title);
diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php
index e210fe2c0a..9c75720cc7 100644
--- a/main/inc/lib/main_api.lib.php
+++ b/main/inc/lib/main_api.lib.php
@@ -2811,7 +2811,7 @@ function api_not_allowed($print_headers = false, $message = null) {
}
$msg = null;
// Check if the cookies are enabled. If are enabled and if no course ID was included in the requested URL, then the user has either lost his session or is anonymous, so redirect to homepage
- if( !isset($_COOKIE["TestCookie"]) && empty($_COOKIE["TestCookie"]) ) {
+ if( !isset($_COOKIE['TestCookie']) && empty($_COOKIE['TestCookie']) ) {
$msg = Display::return_message(get_lang('NoCookies').'
'.get_lang('BackTo').' '.get_lang('CampusHomepage').'
', 'error', false);
} else {
$msg = Display::return_message(get_lang('NotAllowed').'
'.get_lang('PleaseLoginAgainFromHomepage').'
', 'error', false);