3 && time() - $log[$_SERVER['REMOTE_ADDR']]['time'] < 86400) { die('This IP address is blocked due to unsuccessful login attempts.'); } foreach ($log as $key => $value) { if (time() - $value['time'] > 86400) { unset($log[$key]); $log_updated = true; } } if (isset($log_updated)) { file_put_contents(LOG_FILE, serialize($log)); } } session_set_cookie_params(86400, dirname($_SERVER['REQUEST_URI'])); session_name('pheditor'); session_start(); if (empty(PASSWORD) === false && (isset($_SESSION['pheditor_admin']) === false || $_SESSION['pheditor_admin'] !== true)) { if (isset($_POST['pheditor_password']) && empty($_POST['pheditor_password']) === false) { if (hash('sha512', $_POST['pheditor_password']) === PASSWORD) { $_SESSION['pheditor_admin'] = true; redirect(); } else { $error = 'The entry password is not correct.'; $log = file_exists(LOG_FILE) ? unserialize(file_get_contents(LOG_FILE)) : array(); if (isset($log[$_SERVER['REMOTE_ADDR']]) === false) { $log[$_SERVER['REMOTE_ADDR']] = array('num' => 0, 'time' => 0); } $log[$_SERVER['REMOTE_ADDR']]['num'] += 1; $log[$_SERVER['REMOTE_ADDR']]['time'] = time(); file_put_contents(LOG_FILE, serialize($log)); } } else if (isset($_POST['action'])) { header('HTTP/1.0 403 Forbidden'); die('Your session has expired.'); } die('