<commit_before><?php
	require_once(__DIR__. '/class/DatabaseManager.php');

            $hostname = "localhost";
            $database = "aen";
            $username = "root";
            $password = "";

try{
    $connect = new PDO('mysql:host='.$hostname.';dbname='.$database, $username, $password);
 }catch (PDOException $e){
        exit('problème de connexion à la base');
      }

if( !isset($_GET['activationKey'])){

	die("Pas de token");

}
$activationKey = $_GET['activationKey'];

$query = $connect->prepare("SELECT id FROM user WHERE activation_key='$activationKey'");

//Executer et récupérer l'information
$query->execute(["activationKey"=>$_GET['activationKey']]);
$results = $query->fetch();

if( !empty($results) ){
	//il existe on prépare une autre requête
	$query = $connect->prepare("UPDATE user SET active = 1 WHERE activation_key='$activationKey'");
	//On execute la nouvelle requete
	$query->execute(["activation_key"=>$_GET['activationKey']]);
	header("Location: index.php");

}else{
	die("Erreur a la fin, bdd pas mise a jour");
}
//et si il n'existe pas on die
?><commit_msg>cant doing it better for now<commit_after><?php
	require_once(__DIR__. '/class/DatabaseManager.php');
	include "header.php";

            $hostname = "localhost";
            $database = "aen";
            $username = "root";
            $password = "";

try{
    $connect = new PDO('mysql:host='.$hostname.';dbname='.$database, $username, $password);
 }catch (PDOException $e){
        exit('problème de connexion à la base');
      }

 if( !isset($_GET['activationKey']) && !isset($_GET['mail'])){

	die("Pas de token");

}
$activationKey = $_GET['activationKey'];

$mail = $_GET['mail'];
//echo $activationKey;
//echo $mail;

$query = $connect->prepare("SELECT id FROM user WHERE mail='$mail'");

//Executer et récupérer l'information
$query->execute(["mail"=>$_GET['mail']]);
$results = $query->fetch();

if( !empty($results) ){
	//il existe on prépare une autre requête
	$query = $connect->prepare("UPDATE user SET active = 1 WHERE mail='$mail'");
	//On execute la nouvelle requete
	$query->execute(["mail"=>$_GET['mail']]);

}else{
	die("Erreur a la fin, bdd pas mise a jour");
}
?>
<div class="container">
        <!-- Page Heading/Breadcrumbs -->
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">Activation de compte
                </h1>
                <ol class="breadcrumb">
                    <li><a href="index.html">Accueil</a>
                    </li>
                    <li class="active">Activation reussie</li>
                </ol>
                <div>
                    <h4>Votre compte est maintenant activé vous pouvez maintenant commencer à reserver des services, redirection vers la page d'accueil.</h4>
                </div>
            </div>
        </div>
                   
<script>
setTimeout("location.href='index.php';", 4000);
</script>

<?php

include "footer.php";


//et si il n'existe pas on die
?>
{'fraction_non_alphanumeric': 0.17645096731154103, 'fraction_numerical': 0.004002668445630421, 'mean_word_length': 2.9356955380577427, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1833829', 'n_tokens_mistral': 963, 'n_tokens_neox': 938, 'n_words': 239}