thank you very much paulnaj
Now I get this error on my page, what should I do to fix it????
Fatal error: Cannot redeclare check_login() in /......../admin/includes/common.inc.php on line 12
this is source cod of common.inc.php
<?php
// include config file
include_once 'config.inc.php';
// include global common file
include_once str_replace('admin/', '', ROOT).'includes/common.global.inc.php';
/**
* Check that a User is logged in, redirect to login page if not
* @return bool
*/
function check_login(){
if(!isset($_SESSION['User'])) {
$_SESSION['flash'] = array('type'=>'bad','msg'=>'You need to be logged to access that section');
header('Location: '.ROOT_URL.'login.php');
exit;
};
// check login time
if(isset($_SESSION['Time'])) {
// allow sessions to run this long
$period = 60*60;
if( mktime() - $_SESSION['Time'] >= $period ) {
unset($_SESSION['User']);
$_SESSION['flash'] = array('type'=>'bad','msg'=>'Your session has expired, please log in again');
header('Location: '.ROOT_URL.'login.php');
exit;
}
}
return TRUE;
}