<?php

include 'includes/functions.php';
check_lang();
if (check_login()) {
    update_sts($_SESSION['user']);
}
delete_ban();
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}
?>
<html>
	<head>
		<title>Hotel 4 Hotel</title>
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
		<!--[if lt IE 9]>
			<script src="js/html5.js"></script>
		<![endif]-->
		<script type= "text/javascript" src = "js/countries.js"></script>
		<script src="js/jquery.1.9.1.js"></script>
		<script type="text/javascript" src="js/jquery.1.4.min.js"></script>
		<script>
			$(function(){
				$('a.log-reg').click(function()
				{
				<td align="center"><a href="portal_banningsmanagement.php">Banning Management Menu</a></td>
                                <td align="center"><a href="logout.php">Logout</a></td>
			</tr>
			<tr>
				<td colspan="2">
					<?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user = $_POST['username'];
    if (empty($user)) {
        echo "failed, user name can not be blank";
        exit;
    }
    $timestamp = $_POST['starttime'];
    if (empty($timestamp)) {
        echo "failed, created on time stamp can not be blank";
        exit;
    }
    $results = delete_ban($user, $timestamp);
    if (strpos(strtolower($results), "fail") !== false) {
        echo $results;
        exit;
    }
    echo "Ban removed successfully";
}
?>
				</td>
			</tr>
		</table>
	</body>
</html>