<?php
	error_reporting(E_ALL ^ E_NOTICE);
?>
<!doctype html>
<html lang="en" class="no-focus">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
     <title>L2SoulPlay</title>

     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
     <meta property="og:image" content="template/panel/assets/media/favicons/favicons/favicon-192x192.html">
     <link rel="shortcut icon" href="template/panel/assets/media/favicons/favicon.ico">
     <link rel="icon" type="image/png" sizes="192x192"
          href="template/panel/assets/media/favicons/favicon-192x192.png">
     <link rel="icon" type="image/png" sizes="16x16" href="template/panel/assets/media/favicons/favicon-16x16.png">
     <link rel="apple-touch-icon" sizes="32x32" href="template/panel/assets/media/favicons/favicon-32x32.png">
     <link id="css-main" rel="stylesheet" href="template/panel/assets/css/codebase2d34.css?v=1612297400">
     <link rel="stylesheet" href="template/panel/assets/css/custom3097.css?v=1612297399">
     <link rel="stylesheet" href="template/panel/assets/css/custom_styles.css"><!-- END Stylesheets -->
</head>

<body> 

     <!-- Page Container-->
	 <div id="page-container"
            class="sidebar-inverse side-scroll main-content-boxed enable-page-overlay side-trans-enabled ">
            <!-- Sidebar -->

           <div id="page-overlay"></div>

            <div class="custom-header">
<?php
$indexing = 1; 
$add_class_head = 'fijo';
include 'cont/header.php';
?>
          </div> <!-- Main Container -->
          <main id="main-container">
               <div class="content-area small-width">
                    <div class="page-title">VERIFICACIÓN DE CUENTA</div>
                         <div class="block uns-block-custom block-themed block-rounded" style="min-height:300px;">
                              <div class="block-content text-center">
									<?php
										if (isset($_GET['tk']) && strlen($_GET['tk'])>5) {
											$indexing=1;
											include 'configs.php';
											include 'functions/func.php';

											$token = vCode($_GET['tk']);

											// Comprobación de existencia de token válido
											$token_query = $pdo->query("SELECT id, login, correo, token, access_level FROM accounts WHERE token='$token'");
											if ($token_query->rowCount() == 0) {
												// Mensaje de token inválido
												echo '<h4>Token inválido</h4>Asegúrese de haber copiado el enlace del correo correctamente';
											}else {
												// Procedo a verificar cuenta
												$pdo->query("UPDATE accounts SET access_level='0' WHERE token='$token' AND access_level='-100'");

												// Obtengo datos para mostrar
												$cuenta_q = $token_query->fetch(PDO::FETCH_ASSOC);
												$login = $cuenta_q['login'];
												$access_level = $cuenta_q['access_level'];

												// Compruebo si ya ha activado la cuenta
												if ($access_level=='0') {
													echo '<h4>Su cuenta ya se encuentra verificada</h4>';
												}else{
													echo '<h4>Su cuenta <b>"'.$login.'"</b> ha sido verificada correctamente</h4>';
												}
											}
										}else {
											// Error si no encuentra token en la url
											echo '<h4 style="color:red">Error. Token inexistente</h4>';
										}
									?>
                              </div>
                              <div class="uns-block-custom-footer block-content bg-body-light" style="border:0">
                                   
                              </div>
                         </div>
               </div>
          </main><!-- END Main Container -->
          <?php
include 'cont/footer.php'; 
?> 
          <!-- Pop Out Modal -->
          <div class="modal fade" id="modal-ajax" tabindex="-1" role="dialog" aria-labelledby="modal-popout" aria-hidden="true">
               <div class="modal-dialog modal-dialog-popout" role="document">
                    <div class="modal-content">
                         <form class="modal-ajax-form" action="https://www.la2era.com/input" method="post" onsubmit="return false;">
                              <div class="block block-themed block-transparent mb-0">
                                   <div class="block-header bg-primary-dark">
                                        <h3 class="block-title modal-ajax-title"></h3>
                                        <div class="block-options">
                                             <button type="button" class="btn-block-option" data-dismiss="modal" aria-label="Close"><i class="si si-close"></i>
                                             </button>
                                        </div>
                                   </div>
                                   <div class="block-content modal-ajax-content"></div>
                              </div>
                              <div class=" modal-ajax-footer block-content block-content-sm block-content-full bg-body-light block-settings-save-fix"></div>
                         </form>
                    </div>
               </div>
          </div><!-- END Pop Out Modal -->
     </div><!-- END Page Container -->
     <!-- Core JS -->
     <script src="template/panel/assets/js/codebase.core.min4d1e.js?v=1612297404"></script>
     <script src="template/panel/assets/js/codebase.app.min4d1e.js?v=1612297404"></script>
     <script src="template/panel/assets/js/plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
     <script src="template/panel/assets/js/plugins/bootstrap-history-tabs/bootstrap-history-tabs5e1f.js?v=2">
     </script>
     <script src="template/panel/assets/js/mmoweb4d1e.js?v=1612297404"></script>
     <script src="mmo24.ru/webstat/watch.js"></script>
     <script>
          $('.nav-tabs a').historyTabs();
          $('.custom-header .header-content__start.flex-cc').remove();
          $('.custom-header .header-content__status').remove();
     </script>
     <script src="template/panel/assets/js/custom_js.js"></script>
</body>

</html>