2013-05-15 2 views
0

30 분 후비 캐시 페이지

if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) { 
    session_destroy(); 
    session_unset(); 
} 

$_SESSION['LAST_ACTIVITY'] = time(); 

// regenerates the session ID periodically to avoid attacks on sessions 
if (!isset($_SESSION['CREATED'])) { 
    $_SESSION['CREATED'] = time(); 
} else if (time() - $_SESSION['CREATED'] > 1800) { 
    session_regenerate_id(true); 
    $_SESSION['CREATED'] = time(); 
} 

$ts = gmdate("D, d M Y H:i:s") . " GMT"; 
header("Expires: $ts"); 
header("Last-Modified: $ts"); 
header("Pragma: no-cache"); 
header("Cache-Control: no-cache, must-revalidate"); 

답변

1
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) { 
    session_destroy(); 
    session_unset(); 
} 

이 부분에 보인다 ... 사용자가 로그 아웃을하셔야합니다,하지만 캐시 페이지/클릭 몇 온라인 사용자를 유지하는 것 같다 1800 이후 괄호 중 하나가 '보다 큼'기호 앞에오고 오타가있는 경우 :

if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY']) > 1800) { 
    session_destroy(); 
    session_unset(); 
} 
+0

이 문제가 해결되었습니다. – user1725969

+0

위대한 :)이 경우 허용 대답으로 표시하십시오;) –