<?php session_start(); header( "Content-type: text/html; charset=utf-8" ); ?>
<!DOCTYPE html>
<html>
<head>
	<title>Grupo RBK</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta charset="utf-8">
	<base href="<?php echo "http://".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]; ?>" />

	<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	
    <link rel="shortcut icon" type="image/x-icon" href="images/icone.png">

    <link href="summernote.css" rel="stylesheet">
   

	<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jqBootstrapValidation.js"></script>
	<script type="text/javascript" src="js/bootstrap-inputmask.min.js"></script>

	<script>
	  $(function () { $("input,select,textarea").not("[type=submit]").jqBootstrapValidation(); } );
	</script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container-fluid container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menu" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.php"><img src="images/logo.png" alt="MaxCredit" title="MaxCredit"></a>
    </div>

    <div class="collapse navbar-collapse" id="menu">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.php">Home</a></li>
        <li><a href="sobre">Sobre</a></li>
        <li><a href="contato">Contato</a></li>
        <?php 
        if ( isset ( $_SESSION["max"]["id"] ) ) {?>
        <li><a href="painel" class="btn btn-success"><i class="glyphicon glyphicon-user"></i> Olá <?=$_SESSION["max"]["nome"];?></a></li>
        <li><a href="sair" class="btn btn-danger"><i class="glyphicon glyphicon-off"></i> Sair</a>
        <?php } else { ?>
        <li><a href="#" class="btn btn-success" data-toggle="modal" data-target="#myModal"><i class="glyphicon glyphicon-user"></i> Área do Cliente</a></li>
        <?php } ?>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

<?php

	include "config.php";
	
	$page = "home";

	if ( isset ( $_GET["param"] ) ) {
		$param = trim ( $_GET["param"] );

		$param = explode ("/" , $param);

		$page = $param[0];

		if ( ( empty( $page ) ) or ( $page == "index" ) ) $page = "home";
	}

	$page = "pages/".$page.".php";

	if ( file_exists ( $page ) ) include $page;
	else include "pages/erro.php";


?>

<form name="form1" method="post" action="validar" class="form-inline">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><i class="glyphicon glyphicon-user"></i> Área do Cliente</h4>
      </div>
      <div class="modal-body">
      	<p>Digite seus dados para acessar:</p>

      	<label for="cnpj">Login/CNPJ:
      	<input type="text" name="cnpj" class="form-control" required data-mask="99.999.999/9999-99"></label>

      	<label for="senha">Senha:
      	<input type="password" name="senha" class="form-control" required></label>

      	<p>Esqueceu sua senha? <a href="senha" title="Senha">Clique aqui</a>.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Entrar</button>
      </div>
    </div>
  </div>
</div>
</form>

</body>
</html>