<?php
session_start();
if(!isset($_SESSION['usuarioCPFp']) OR !isset($_SESSION['usuarioCPFm']) ) {
    header("Location: index.php");
    exit;
}
?>
<?php
include_once('conexao.php');
$cpf_pai = $_SESSION['usuarioCPFp'];
$cpf_mae = $_SESSION['usuarioCPFm'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Consultar Kademi</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="styles.css">
<style>
table, td, th {
  border: 0px solid black;
  padding: 5px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

td {
  text-align: left;
}
hr{
border: 1px solid green;
}
</style>
</head>
<body>

<div class="container">
    <div class="row justify-content-center mt-5">
        <div class="col-md-6 col-lg-6">
            <div class="card shadow-lg">
                <div class="card-body p-5 text-center">
                    <img src="logo.png" alt="Colégio Ávila" class="mb-4" width="125px">
			<hr>
                    <?php    
                    $result_usuario = "SELECT * FROM `alunos_kademi_2024` WHERE cpf_pai = '$cpf_pai' OR cpf_mae = '$cpf_mae' ORDER BY nome ASC";

			$resultado_usuario = mysqli_query($conn, $result_usuario);
			if(($resultado_usuario) AND ($resultado_usuario->num_rows != 0)){
			while($row_usuario = mysqli_fetch_assoc($resultado_usuario)){  
			echo"<table>";			
			echo"<tr><td><b>Aluno:</b></td><td style='text-transform: uppercase;'>".$row_usuario['nome']."</td></tr>";
			echo"<tr><td><b>Ensino:</b></td><td>".$row_usuario['ano']."</td></tr>";
			echo"<tr><td><b>Serie/Turma:</b></td><td>".$row_usuario['classe']."</td></tr>";
			echo"<tr><td><b>Login</b></td><td>".$row_usuario['login']."</td></tr>";
			echo"<tr><td><b>Senha(padrão):</b></td><td>123456</td></tr>";			
			echo"</table>";
			echo"<hr>";
			}
			}else{
			echo"<a>Nenhum dados encontrados na base</a><hr>";
			}
			?>
			<p><a href="https://novoava.atheva.com.br/kademi/login" target="_blank">Clique aqui para acessar a pagina de login do kademi</a></p>
                        <br><p><a href="index.php">Sair</a></p>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="script.js"></script>
</body>
</html>