<?php
include 'conexao.php';

$sql_consult = $sqli->query("SELECT * FROM esqueci_senha WHERE id='".$_GET['id']."'");
$row_consult = $sql_consult->fetch_assoc();

$data_atual = strtotime(date("Y-m-d H:i:s"));
$data_limite = strtotime($row_consult['data_limite']);

if($data_atual > $data_limite or $row_consult['status'] == 1) {
    echo "<script> alert('Prazo para renovar senha expirado!'); window.location.href='login.php'; </script>";
}
?>

<!doctype html>
<html>
	<head>

		<!-- Basic -->
		<meta charset="UTF-8">
		<title>Portal dos Patrocinadores</title>
		<meta name="keywords" content="HTML5 Admin Template" />
		<meta name="description" content="Porto Admin - Responsive HTML5 Template">
		<meta name="author" content="okler.net">

		<!-- Mobile Metas -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

		<!-- Web Fonts  -->
		<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">

		<!-- Vendor CSS -->
		<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
		<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
		<link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
		<link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />

		<!-- Theme CSS -->
		<link rel="stylesheet" href="assets/stylesheets/theme.css" />

		<!-- Skin CSS -->
		<link rel="stylesheet" href="assets/stylesheets/skins/default.css" />

		<!-- Theme Custom CSS -->
		<link rel="stylesheet" href="assets/stylesheets/theme-custom.css">

		<!-- Head Libs -->
		<script src="assets/vendor/modernizr/modernizr.js"></script>

	</head>
	<body>
		<!-- start: page -->
		<section class="body-sign">
			<div class="center-sign">
				<a href="#" class="logo pull-left">
					<img src="assets/images/logo.png" height="90" alt="Porto Admin" />
				</a>

				<div class="panel panel-sign">
					<div class="panel-title-sign mt-xl text-right">
						<h2 class="title text-uppercase text-bold m-none"><i class="fa fa-user mr-xs"></i> Renovar Senha</h2>
					</div>
					<div class="panel-body">
						<form action="atualizar_senha_login.php" method="post">

                            <input type="hidden" name="id" value="<?php echo $_GET['id'] ?>" />
                            <input type="hidden" name="id_usuario" value="<?php echo $row_consult['id_usuario'] ?>" />

                            <div class="form-group mb-lg">
                                <h4>Olá, <?php echo $row_consult['nome'] ?>, digite sua nova senha:</h4>
                            </div>

                            <div class="form-group mb-lg">
                                <div class="clearfix">
                                    <label class="pull-left">Nova Senha</label>

                                </div>
                                <div class="input-group input-group-icon">
                                    <input name="nova_senha" type="password" class="form-control input-lg" />
                                    <span class="input-group-addon">
										<span class="icon icon-lg">
											<i class="fa fa-lock"></i>
										</span>
									</span>
                                </div>
                            </div>

                            <div class="form-group mb-lg">
                                <div class="clearfix">
                                    <label class="pull-left">Confirmar nova Senha</label>

                                </div>
                                <div class="input-group input-group-icon">
                                    <input name="nova_senha_2" type="password" class="form-control input-lg" />
                                    <span class="input-group-addon">
										<span class="icon icon-lg">
											<i class="fa fa-lock"></i>
										</span>
									</span>
                                </div>
                            </div>


							<div class="row" style="margin-bottom: 25px;">
								<div class="col-sm-12 text-right">
									<button type="submit" class="btn btn-warning hidden-xs">Enviar</button>
									<button type="submit" class="btn btn-warning btn-block btn-lg visible-xs mt-lg">Enviar</button>
								</div>
							</div>


						</form>
					</div>
				</div>

				<p class="text-center text-muted mt-md mb-md">&copy; Marketing Cultural 2020. Todos os direitos reservados.</p>
			</div>
		</section>
		<!-- end: page -->

		<!-- Vendor -->
		<script src="assets/vendor/jquery/jquery.js"></script>
		<script src="assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="assets/vendor/magnific-popup/magnific-popup.js"></script>
		<script src="assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="assets/javascripts/theme.init.js"></script>

	</body>
</html>