<?php
/*
* Copyright 2012 Douglas Robbins <hide@address.com>
*
* This file is part of Blite, a blogging application, available at
* <http://blite.ca/>.
*
* Blite is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
// Valid GMT offsets.
$valid = array ("-12", "-11", "-10", "-9.5", "-9", "-8", "-7", "-6", "-5", "-4.5", "-4", "-3.5", "-3", "-2.5", "-2", "-1", "0", "+1", "+2", "+3", "+3.5", "+4", "+4.5", "+5", "+5.5", "+5.75", "+6", "+6.5", "+7", "+8", "+8.75", "+9", "+9.5", "+10", "+10.5", "+11", "+11.5", "+12", "+12.75", "+13", "+14");
// Set a cookie for time offset from GMT
if ( $_SESSION['lastpage'] ) {
if ( $_POST['offset'] && is_numeric($_POST['offset']) ) {
$offset = $_POST['offset'];
if ($offset > 0 && $offset{0} !== '+') {
$offset = '+' . $offset;
}
if (!in_array($offset, $valid)) {
$offset = 0;
}
}
else {
$offset = "0";
}
$expire = time() + 15552000;
setcookie('timeoffset', $offset, $expire, '', '');
header("Location: " . $_SESSION['lastpage'] . '#bottom');
}
else {
header("Location: ./");
}
exit;