diff --git a/.drone.yml b/.drone.yml index 5792672f..612dc48c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,5 +23,4 @@ steps: from_secret: DEPLOY_KEY secrets: - source: DEPLOY_KEY - rm: false - \ No newline at end of file + rm: false \ No newline at end of file diff --git a/WEB/.htaccess b/WEB/.htaccess new file mode 100644 index 00000000..d2073e34 --- /dev/null +++ b/WEB/.htaccess @@ -0,0 +1,2 @@ +php_flag display_errors on +php_value error_reporting E_ALL \ No newline at end of file diff --git a/WEB/.user.ini b/WEB/.user.ini new file mode 100644 index 00000000..3c7ddce4 --- /dev/null +++ b/WEB/.user.ini @@ -0,0 +1,3 @@ +display_errors = On +log_errors = Off +error_reporting = E_ALL & E_NOTICE & E_DEPRECATED & E_STRICT & E_WARNING \ No newline at end of file diff --git a/WEB/Config/Autoload.php b/WEB/Config/Autoload.php index d745eebc..dfa0c5e3 100644 --- a/WEB/Config/Autoload.php +++ b/WEB/Config/Autoload.php @@ -37,7 +37,7 @@ class Autoload $dir =array('Model/','./','Config/','Controller/','Metier/', 'Factory/'); foreach ($dir as $d){ $file=$rep.$d.$filename; - //echo $file; + // echo $file."\n"; if (file_exists($file)) { include $file; diff --git a/WEB/Config/Config.php b/WEB/Config/Config.php index a19620de..f2e9ae16 100644 --- a/WEB/Config/Config.php +++ b/WEB/Config/Config.php @@ -1,20 +1,10 @@ clean($input); + $output = filter_var($output, FILTER_SANITIZE_EMAIL); + return $output; + } + + public function cleanInt($input){ + $output = $this->clean($input); + $output = filter_var($output, FILTER_SANITIZE_NUMBER_INT); + return $output; + } +} \ No newline at end of file diff --git a/WEB/Controller/FrontController.php b/WEB/Controller/FrontController.php index 6970090c..8bf4a62c 100644 --- a/WEB/Controller/FrontController.php +++ b/WEB/Controller/FrontController.php @@ -5,26 +5,30 @@ class FrontController { try { global $error, $view, $rep; + $nettoyage = new Nettoyage(); session_start(); // Check role permissions if (isset($_SESSION['role'])) { - $role = $_SESSION['role']; + $role = $nettoyage->clean($_SESSION['role']); } else { $role = "visitor"; } // Check if action exists - $action = $_REQUEST['action']; + $action = $nettoyage->clean($_REQUEST['action']); if ($role == "user") { if ($action == NULL) { + $_REQUEST['action'] = $action; new UserController(); + } else if (method_exists('UserController', $action) == false) { + $error = "Action non valide " . $action; + require($rep . $view['erreur']); } - // else if (method_exists('UserModel', $action) == false) { - // $error = "Action non valide " . $action; - // require($rep . $view['erreur']); else { + $_REQUEST['action'] = $action; new UserController(); } } else { + $_REQUEST['action'] = $action; new VisitorController(); } } catch (Exception $e) { diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 8b040bc7..4089f825 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -2,44 +2,61 @@ class UserController { - private Connection $con; - + private UserModel $model; + private Nettoyage $nettoyage; function __construct() { try { global $dsn, $rep, $vues, $error; - $model = new UserModel(); + $this->model = new UserModel(); + $this->nettoyage = new Nettoyage(); $action = $_REQUEST['action']; + //register_event_handler('add_to_queue',array($this,"onAddToQueue")); switch ($action) { case NULL: - $model->goToHome(); - break; - case "goToPresentation": - $model->goToPresentation(); + $this->goToHome(); break; case "goToHome": - $model->goToHome(); + $this->goToHome(); break; - case "goToTest": - $model->goToTest(); + case "goToPresentation": + $this->goToPresentation(); break; case "goToEnigme": - $model->goToEnigme(); + $this->goToEnigme(); + break; + case "goToTest": + $this->goToTest(); break; case "goToChouette" : - $model->goToChouette(); + $this->goToChouette(); break; case "goToCesarEncrypt": - $model->goToCesarEncrypt(); + $this->goToCesarEncrypt(); break; - case "goToQueue": - $model->goToQueue(); + case "goToCesarDecrypt": + $this->goToCesarDecrypt(); + break; + case "goToChuckNorris" : + $this->goToChuckNorris(); + break; + case "goToHanoi" : + $this->goToHanoi(); + break; + case "goToTrianglePascal": + $this->goToTrianglePascal(); + break; + case "goToDoubleElement": + $this->goToDoubleElement(); break; case "goToNext": - $model->goToNext(); + $this->goToNext(); + break; + case "goToQueue": + $this->goToQueue()(); break; case "logout": - $model->logout(); + $this->logout(); break; default: $error = "Action non valide"; @@ -54,4 +71,141 @@ class UserController require($rep . $vues['erreur']); } } + public function goToHome() + { + try { + global $rep, $vues; + require($rep . $vues['main']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToPresentation() + { + try { + global $rep, $vues; + require($rep . $vues['presentation']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToTest() + { + try { + global $rep, $vues; + require($rep . $vues['test']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToEnigme() + { + try { + global $rep, $vues; + require($rep . $vues['enigme']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToChouette() + { + try { + global $rep, $vues; + require($rep . $vues['chouette']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToCesarEncrypt() + { + try { + global $rep, $vues; + require($rep . $vues['cesarEncrypt']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToCesarDecrypt() + { + try { + global $rep, $vues; + require($rep . $vues['cesarDecrypt']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToChuckNorris() + { + try { + global $rep, $vues; + require($rep . $vues['chuckNorris']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToHanoi() + { + try { + global $rep, $vues; + require($rep . $vues['hanoi']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToTrianglePascal() + { + try { + global $rep, $vues; + require($rep . $vues['trianglePascal']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToDoubleElement() + { + try { + global $rep, $vues; + require($rep . $vues['doubleElement']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToNext() + { + try { + global $rep, $vues, $error; + $num = $this->nettoyage->cleanInt($_REQUEST['num']); + require($rep . $vues['next'].$_REQUEST['num'].".html"); + } catch (Exception $e) { + $error = "Erreur Inconnue"; + require($rep . $vues['erreur']); + } + } + public function goToQueue() + { + try { + global $rep, $vues, $error; + //require($rep . $vues['Queue']); + $this->model->addToQueue(); + } catch (Exception $e) { + $error = $e->getMessage(); + require($rep . $vues['erreur']); + } + } + public function logout() + { + $_SESSION['role'] = 'visitor'; + header('Location: index.php'); + } } \ No newline at end of file diff --git a/WEB/Controller/VisitorController.php b/WEB/Controller/VisitorController.php index 34e5fe0e..af65f75d 100644 --- a/WEB/Controller/VisitorController.php +++ b/WEB/Controller/VisitorController.php @@ -2,35 +2,34 @@ class VisitorController { - private Connection $con; - + private VisitorModel $model; function __construct() { try { global $dsn, $rep, $vues, $error; - $model = new VisitorModel(); + $this->model = new VisitorModel(); $action = $_REQUEST['action']; switch ($action) { case NULL: - $model->goToHome(); + $this->goToHome(); break; case "signUp": - $model->signUp(); + $this->signUp(); break; case "login": - $model->login(); + $this->login(); break; case "goToHome": - $model->goToHome(); + $this->goToHome(); break; case "goToLogin": - $model->goToLogin(); + $this->goToLogin(); break; case "goToSignUp": - $model->goToSignUp(); + $this->goToSignUp(); break; case "goToQueue": - $model->goToLogin(); + $this->goToLogin(); break; default: $error = "Action non valide"; @@ -45,4 +44,62 @@ class VisitorController require($rep . $vues['erreur']); } } + public function goToHome() + { + try { + global $rep, $vues; + require($rep . $vues['main']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToLogin() + { + try { + global $rep, $vues; + require($rep . $vues['login']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function goToSignUp() + { + try { + global $rep, $vues; + require($rep . $vues['signUp']); + } catch (Exception $e) { + $error = "404"; + require($rep . $vues['erreur']); + } + } + public function signUp() + { + try { + global $rep, $vues, $error; + $this->model->signUp(); + $this->goToHome(); + } catch (PDOException $e) { + $error = "Erreur de connexion à la base de données."; + require($rep . $vues['erreur']); + } catch (Exception $e) { + $error = $e->getMessage(); + require($rep . $vues['erreur']); + } + } + public function login() + { + try { + global $rep, $vues, $error; + $this->model->login(); + $this->goToHome(); + } catch (PDOException $e) { + $error = "Erreur de connexion à la base de données."; + require($rep . $vues['erreur']); + } catch (Exception $e) { + $error = $e->getMessage(); + require($rep . $vues['erreur']); + } + } } \ No newline at end of file diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index 94f43a9a..b6b4c40a 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -5,6 +5,8 @@ class UserModel private EnigmeGateway $enigme_gateway; private PartieGateway $partie_gateway; private UtilisateurGateway $utilisateur_gateway; + private Nettoyage $nettoyage; + private Validation $validation; function __construct() { @@ -13,109 +15,17 @@ class UserModel $this->enigme_gateway = new EnigmeGateway(); $this->partie_gateway = new PartieGateway(); $this->utilisateur_gateway = new UtilisateurGateway(); + $this->nettoyage = new Nettoyage(); + $this->validation = new Validation(); } catch (Exception $e) { $error = $e->getMessage(); require($rep . $view['erreur']); } } - - public function goToPresentation() - { - global $rep, $vues, $error; - try { - require($rep . $vues['presentation']); - } catch (Exception $e) { - $error = "Erreur Inconnue"; - require($rep . $vues['erreur']); - } - } - - public function goToHome() - { - global $rep, $vues, $error; - try { - require($rep . $vues['main']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); - } - } - public function goToEnigme() - { - global $rep, $vues, $error; - try { - require($rep . $vues['enigme']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); - } - } - - public function goToChouette() - { - global $rep, $vues, $error; - try { - require($rep . $vues['chouette']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); - } - } - public function goToCesarEncrypt() - { - global $rep, $vues, $error; - try { - require($rep . $vues['cesarEncrypt']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); - } - } - - public function goToTest() + public function addToQueue() { - global $rep, $vues, $error; - try { - require($rep . $vues['test']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); - } - } - - public function goToNext() - { - global $rep, $vues, $error; - try { - require($rep . $vues['next'].$_REQUEST['num'].".html"); - } catch (Exception $e) { - $error = "Erreur Inconnue"; - require($rep . $vues['erreur']); - } - } - - public function goToQueue() - { - global $rep, $vues, $error; - try { - //require($rep . $vues['Queue']); - $this->addToQueue(); - } catch (Exception $e) { - $error = $e->getMessage(); - require($rep . $vues['erreur']); - } - } - public function addToQueue(){ echo '1'; - $userGroup=$this->utilisateur_gateway->findUsersInQueue(); - if($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) - { - if ($this->utilisateur_gateway->queueFilled()) - { - echo "Partie is launched"; - $this->utilisateur_gateway->launchGame($_SESSION['utilisateur']); - } else - $this->attente(); + if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) { return; } echo '2'; @@ -123,9 +33,8 @@ class UserModel echo '3'; $tabEnigme = $this->enigme_gateway->findMultiEnigma(); $idNewPartie = $this->partie_gateway->findPartieMaxId(); - $partie=$this->partie_gateway->creerPartieMulti($idNewPartie,$tabEnigme); - } - else{ + $partie = $this->partie_gateway->creerPartieMulti($idNewPartie, $tabEnigme); + } else { echo '4'; $idPartieInQueue = $this->partie_gateway->findPartieInQueue(); echo '5'; @@ -135,23 +44,24 @@ class UserModel echo '7'; } echo '8'; - $this->utilisateur_gateway->addToQueue($_SESSION['utilisateur'],$partie); - echo '9'; - if ($this->utilisateur_gateway->queueFilled()) - { - echo "Partie is launched"; - trigger_event('queue_filled',$user_group,$partie,$user_group); - $this->utilisateur_gateway->launchGame($_SESSION['utilisateur']); - } - $this->attente(); + $this->utilisateur_gateway->addToQueue($_SESSION['utilisateur'], $partie); + $userGroup = $this->utilisateur_gateway->findUsersInQueue(); + //trigger_event('add_to_queue',$userGroup); } - public function onQueueFilled{ - + public function AddUserToQueueEvent() + { + $userGroup = $this->utilisateur_gateway->findUsersInQueue(); + if ($userGroup . count() >= 4) { + $this->utilisateur_gateway->launchGame(); + } } public function logout() { + session_unset(); + session_destroy(); + $_SESSION = array(); $_SESSION['role'] = 'visitor'; header('Location: index.php'); } diff --git a/WEB/Model/VisitorModel.php b/WEB/Model/VisitorModel.php index 5fa7839f..17af584f 100644 --- a/WEB/Model/VisitorModel.php +++ b/WEB/Model/VisitorModel.php @@ -5,6 +5,8 @@ class VisitorModel private EnigmeGateway $enigme_gateway; private PartieGateway $partie_gateway; private UtilisateurGateway $utilisateur_gateway; + private Nettoyage $nettoyage; + private Validation $validation; function __construct() { @@ -13,6 +15,8 @@ class VisitorModel $this->enigme_gateway = new EnigmeGateway(); $this->partie_gateway = new PartieGateway(); $this->utilisateur_gateway = new UtilisateurGateway(); + $this->nettoyage = new Nettoyage(); + $this->validation = new Validation(); } catch (Exception $e) { $error = $e->getMessage(); require($rep . $view['erreur']); @@ -21,98 +25,58 @@ class VisitorModel public function signUp() { - global $rep, $vues, $sel, $error; - try { - $validation = new Validation(); - if (!$validation->ValidateEmail($_REQUEST['email'])) { - $error = "Email invalides."; - throw (new Exception("Email non valide")); - } - if (!$validation->ValidateUsername($_REQUEST['username'])) { - $error = "Nom d'utilisateur invalides. Il ne doit pas contenir de caractère spéciaux."; - throw (new Exception("Pseudo non valide")); - } - if (!$validation->ValidatePassword($_REQUEST['password'])) { - $error = "Mots de passe invalides. Il ne doit pas dépasser 100 caractères."; - throw (new Exception("Mot de passe non valide")); - } - $j = $this->utilisateur_gateway->getUtilisateurByEmail($_REQUEST['email']); - if ($j->getEmail() != "null") { - $error = "Email déjà utilisé."; - throw (new Exception("Email déjà utilisé")); - } - $password = password_hash($_REQUEST['password'] . $sel, PASSWORD_DEFAULT); - $utilisateur = new Utilisateur($_REQUEST['email'], $_REQUEST['username'], $password, false); - $this->utilisateur_gateway->insert($utilisateur); - $_SESSION['role'] = 'user'; - $_SESSION['utilisateur'] = $utilisateur; - require($rep . $vues['main']); - } catch (PDOException $e) { - $error = "Erreur de connexion à la base de données."; - require($rep . $vues['erreur']); - } catch (Exception $e) { - $error = $e->getMessage(); - require($rep . $vues['erreur']); + global $sel, $error; + $email = $this->nettoyage->cleanEmail($_REQUEST['email']); + if (!$this->validation->ValidateEmail($email)) { + $error = "Email invalides."; + throw (new Exception("Email non valide")); + } + $username = $this->nettoyage->clean($_REQUEST['username']); + if (!$this->validation->ValidateUsername($username)) { + $error = "Nom d'utilisateur invalides. Il ne doit pas contenir de caractère spéciaux."; + throw (new Exception("Pseudo non valide")); + } + $password = $this->nettoyage->clean($_REQUEST['password']); + if (!$this->validation->ValidatePassword($password)) { + $error = "Mots de passe invalides. Il ne doit pas dépasser 100 caractères."; + throw (new Exception("Mot de passe non valide")); + } + $j = $this->utilisateur_gateway->getUtilisateurByEmail($email); + if ($j->getEmail() != "null") { + $error = "Email déjà utilisé."; + throw (new Exception("Email déjà utilisé")); } + $password = password_hash($password . $sel, PASSWORD_DEFAULT); + $utilisateur = new Utilisateur($email, $username, $password, false); + $this->utilisateur_gateway->insert($utilisateur); + $_SESSION['role'] = 'user'; + $_SESSION['utilisateur'] = $utilisateur; } public function login() { - global $rep, $vues, $sel, $error; - try { - $utilisateur = $this->utilisateur_gateway->getUtilisateurByEmail($_REQUEST['email']); - if ($utilisateur->getEmail() == "null") { - $error = "Utilisateur non trouvé."; - throw new Exception("Utilisateur introuvable"); - } - $mdp = $this->utilisateur_gateway->getMdpByEmail($_REQUEST['email']); - if (password_verify($mdp, $_REQUEST['password'] . $sel)) { - $error = "Mot de passe incorrect."; - throw new Exception("Mot de passe invalide"); - } - $estAdmin = $this->utilisateur_gateway->getEstAdminByEmail($_REQUEST['email']); - if ($estAdmin == true) { - $_SESSION['role'] = "admin"; - } else { - $_SESSION['role'] = "user"; - } - $_SESSION['utilisateur'] = $utilisateur; - $_SESSION['connected'] = 'true'; - require($rep . $vues['main']); - } catch (Exception $e) { - require($rep . $vues['erreur']); + global $vue, $sel, $error; + $email = $this->nettoyage->cleanEmail($_REQUEST['email']); + if (!$this->validation->ValidateEmail($email)) { + $error = "Email invalides."; + throw (new Exception("Email non valide")); } - } - - public function goToHome() - { - global $rep, $vues, $error; - try { - require($rep . $vues['main']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); + $utilisateur = $this->utilisateur_gateway->getUtilisateurByEmail($email); + if ($utilisateur->getEmail() == "null") { + $error = "Utilisateur non trouvé."; + throw new Exception("Utilisateur introuvable"); } - } - - public function goToLogin() - { - global $rep, $vues, $error; - try { - require($rep . $vues['login']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); + $mdp = $this->utilisateur_gateway->getMdpByEmail($email); + if (! password_verify($_REQUEST['password'] . $sel, $mdp)) { + $error = "Mot de passe incorrect."; + throw new Exception("Mot de passe invalide"); } - } - - public function goToSignUp() - { - global $rep, $vues, $error; - try { - require($rep . $vues['signUp']); - } catch (Exception $e) { - $error = "404"; - require($rep . $vues['erreur']); + $estAdmin = $this->utilisateur_gateway->getEstAdminByEmail($email); + if ($estAdmin == true) { + $_SESSION['role'] = "admin"; + } else { + $_SESSION['role'] = "user"; } + $_SESSION['utilisateur'] = $utilisateur; + $_SESSION['connected'] = 'true'; } } \ No newline at end of file diff --git a/WEB/Model/scripted.db b/WEB/Model/scripted.db deleted file mode 100644 index 5cfd9cb7..00000000 Binary files a/WEB/Model/scripted.db and /dev/null differ diff --git a/WEB/View/assets/img/ImgMain.png b/WEB/View/assets/img/ImgMain.png index b2adc342..6040317c 100644 Binary files a/WEB/View/assets/img/ImgMain.png and b/WEB/View/assets/img/ImgMain.png differ diff --git a/WEB/View/assets/img/SecondMainBack.jpg b/WEB/View/assets/img/SecondMainBack.jpg new file mode 100644 index 00000000..4b86ffd0 Binary files /dev/null and b/WEB/View/assets/img/SecondMainBack.jpg differ diff --git a/WEB/View/src/CSS/Enigme.css b/WEB/View/src/CSS/Enigme.css index 785e2d67..37305c82 100644 --- a/WEB/View/src/CSS/Enigme.css +++ b/WEB/View/src/CSS/Enigme.css @@ -13,10 +13,6 @@ body { color: white; scroll-behavior: smooth; height: 100vh; - background-position: center center; - background-attachment: fixed; - background-repeat: no-repeat; - background-size: cover; background-color: #050E15; } diff --git a/WEB/View/src/CSS/Main2.css b/WEB/View/src/CSS/Main2.css index 6a4b6bb9..7108748c 100644 --- a/WEB/View/src/CSS/Main2.css +++ b/WEB/View/src/CSS/Main2.css @@ -4,19 +4,42 @@ color: white; scroll-behavior: smooth; height: 100vh; - background-image: radial-gradient( - circle, - #312c42, - #2e2a3d, - #2a2738, - #272434, - #24222f, - #22202c, - #1f1f29, - #1d1d26, - #1b1b23, - #191a21, - #17181e, - #15161c - ); + background-image: url("../../assets/img/ImgMain.png"); + background-position: center center; + background-attachment: fixed; + background-repeat: no-repeat; + background-size: cover; + background-color: #000; +} + +#imgMain { + background-image: url("../../assets/img/SecondMainBack.jpg"); + background-position: bottom center; + background-attachment: fixed; + background-repeat: no-repeat; + background-size: cover; + display: block; + margin: auto; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 85%; + height: 70%; + border-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + -o-border-radius: 10px; +} + +#AllBg { + background-color: #511949; + opacity: 0.8; + background-size: 10px 10px; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; } diff --git a/WEB/View/src/JS/DoubleElement.js b/WEB/View/src/JS/DoubleElement.js new file mode 100644 index 00000000..7b790219 --- /dev/null +++ b/WEB/View/src/JS/DoubleElement.js @@ -0,0 +1,34 @@ +//~ Function that test the user code + +async function submit(){ + var test = editor.getValue()+`\n +import random as r +def double_elementVerif(list): + return [i*2 for i in list] + +def testDoubleElement(x): + l=[1,2,3,2,1] + if(double_element(l) != [2,4,6,4,2]): + return False + l=[9,5,7,7,9] + if(double_element(l) != [18,10,14,14,18]): + return False + l=[] + for i in range(x): + for j in range(r.randint(1,10)): + l.append(r.randint(0,9)) + if(double_elementVerif(l)!=double_element(l)): + return False + l=[] + return True + +print(testDoubleElement(5)) + `; + exec("print ('True')", "code"); + exec(test, "solution"); + result.innerHTML = "Test en cours..."; + await new Promise(r => setTimeout(r, 1500)); + check(); + } + + \ No newline at end of file diff --git a/WEB/View/src/JS/String.js b/WEB/View/src/JS/String.js index a5c56857..e5a6de91 100644 --- a/WEB/View/src/JS/String.js +++ b/WEB/View/src/JS/String.js @@ -16,7 +16,6 @@ def triVerif(a,b): return s def triTest(x): - tri(a,b) a = "Hlowrd" b = "el ol" if(triVerif(a,b)!=tri(a,b)): diff --git a/WEB/View/src/JS/TrianglePascal.js b/WEB/View/src/JS/TrianglePascal.js index 614e749a..5225fb0d 100644 --- a/WEB/View/src/JS/TrianglePascal.js +++ b/WEB/View/src/JS/TrianglePascal.js @@ -18,12 +18,12 @@ def estTriangleDePascal(n): return triangle def testTriangleDePascal(n): - TriangleDePascal(0) + triangle_pascal(0) listTest=[0,1] for i in range(0,n): listTest.append(r.randint(5,140)) for i in listTest: - if(TriangleDePascal(i)!=estTriangleDePascal(i)): + if(triangle_pascal(i)!=estTriangleDePascal(i)): return False return True diff --git a/WEB/View/src/JS/base.js b/WEB/View/src/JS/base.js index ddcff1f7..7a4b795b 100644 --- a/WEB/View/src/JS/base.js +++ b/WEB/View/src/JS/base.js @@ -112,11 +112,11 @@ function check() { /** - * It gets all the elements with the class name "help" and sets their display property to "flex". + * It gets all the elements with the class name "help" and sets their display property to "block". */ function displayHelp() { var help = document.getElementsByClassName("help"); for (var i = 0; i < help.length; i++) { - help[i].style.display = "flex"; + help[i].style.display = "block"; } } diff --git a/WEB/View/src/pages/Enigme/CesarDecrypt.html b/WEB/View/src/pages/Enigme/CesarDecrypt.html index 8c3c3a13..4f9bc15e 100644 --- a/WEB/View/src/pages/Enigme/CesarDecrypt.html +++ b/WEB/View/src/pages/Enigme/CesarDecrypt.html @@ -1,100 +1,192 @@ - -
- - - -- Écrire une fonction Decrypt qui prend en argument un essage crypté et une clé et qui retourne le message decrypté avec le code César.(les espace ne seront pas encodé.) -
Le code César (ou chiffre de César ) est un chiffrement par substitution, où chaque lettre est remplacée par une autre lettre se situant un peu plus loin dans l'alphabet. Par exemple A avec une clé 2 devient C. -
Entrée : Sortie :
-'fbehu',3 cyber
- La fonction ord(char) de python permet de retourner l’Unicode (standard d’encodage de caractères) d'un caractère. Par exemple, ord('a') retourné '97' et ord('b’) retourne 98. -
-