Merge branch 'master' of https://codefirst.iut.uca.fr/git/nathan.boileau/Scripted
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
commit 79fd8bf455

@ -27,6 +27,7 @@ $vues['adminSolo'] = 'View/src/pages/Admin/AdminSolo.php';
$vues['seeOrdre'] = 'View/src/pages/Admin/SeeOrdre.php';
$vues['modifOrdre'] = 'View/src/pages/Admin/ModifOrdre.php';
$vues['partie'] = 'View/src/pages/Multijoueur/Partie.php';
$vues['queue'] = 'View/src/pages/Multijoueur/Queue.php';
// Enigme
$vues['enigme'] = 'View/src/pages/Enigme/Palindrome.html';
$vues['enigmePage'] = 'View/src/pages/Enigme/EnigmePage.php';

@ -66,7 +66,8 @@ class PartieGateway
$query = "SELECT p.id
FROM Partie p, Participer pa
WHERE pa.etat=0
AND pa.partie=p.id";
AND pa.partie=p.id
LIMIT 1";
$this->con->executeQuery($query);
$results = $this->con->getResults();
return $results[0]['id'];

@ -7,7 +7,7 @@ class UserController
try {
global $dsn, $rep, $vues, $error;
$action = $_REQUEST['action'];
//register_event_handler('add_to_queue',array($this,"onAddToQueue"));
echo $action;
switch ($action) {
case NULL:
$this->goToHome();
@ -202,29 +202,32 @@ class UserController
{
try {
global $rep, $vues, $error;
//require($rep . $vues['Queue']);
require($rep . $vues['queue']);
$model = new UserModel();
$model->addToQueue();
$userGroup = $model->findUserGroup();
echo
'<script>
socket.on("launchGame", () => {
launchGame();
});
io.to($userGroup).emit("launchGame");
io.to('.$userGroup.').emit("launchGame");
<script/>';
} catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
// public function launchGame(){
// try {
// global $rep, $vues, $error;
// $model = new UserModel();
// $model->launchGame();
// require($rep . $vues['partie']);
// }
// }
public function launchGame(){
try {
global $rep, $vues, $error;
$model = new UserModel();
$model->launchGame();
require($rep . $vues['partie']);
}
catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
public function logout()
{
$_SESSION['role'] = 'visitor';

@ -112,7 +112,7 @@ class UtilisateurGateway
public function queueFilled(){
$query = "SELECT count(*) FROM Participer WHERE etat=0";
$this->con->executeQuery($query);
if ($this->con->getResults()[0]['count(*)'] >= 4)
if ($this->con->getResults()[0]['count(*)'] >= 2)
return True;
else
return False;

@ -44,7 +44,7 @@ class Partie
}
/**
* @param array $datePartie
* @param dateTime $datePartie
*/
public function setDatePartie(dateTime $datePartie): void
{

@ -25,7 +25,14 @@ class UserModel
public function addToQueue()
{
echo '1';
var_dump($this->utilisateur_gateway->isAlreadyInQueue($_SESSION['utilisateur']));
if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) {
var_dump($this->utilisateur_gateway->queueFilled());
if($this->utilisateur_gateway->queueFilled())
{
$_REQUEST['action']='launchGame';
var_dump($_REQUEST['action']);
}
return;
}
echo '2';
@ -52,6 +59,10 @@ class UserModel
</script>';
}
public function findUserGroup() : int {
return $this->partie_gateway->findPartieInQueue();
}
public function launchGame()
{
$this->utilisateur_gateway->launchGame($_SESSION['utilisateur']);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

@ -16,7 +16,7 @@ body {
color: white;
scroll-behavior: smooth;
height: 100vh;
background-image: url("../../assets/img/ImgMain2.png");
background-image: url("../../assets/img/LoginBG.png");
background-position: center center;
background-attachment: fixed;
background-repeat: no-repeat;
@ -43,8 +43,9 @@ body {
.login-box .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
padding: 8px 0;
font-size: 12px;
color: #fff;
border: none;
border-bottom: 1px solid #fff;
@ -70,7 +71,7 @@ body {
.login-box .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #6090d1;
color: #be5631;
font-size: 12px;
}
@ -80,7 +81,7 @@ body {
display: inline-flex;
justify-content: center;
padding: 10px 0px;
color: #6090d1;
color: #5fc198;
background: transparent;
border: none;
font-size: 16px;
@ -97,11 +98,11 @@ body {
.login-box a:hover,
.login-box button:hover {
background: #6090d1;
background: #5fc198;
color: #fff;
border-radius: 5px;
box-shadow: 0 0 5px #6090d1, 0 0 25px #6090d1, 0 0 50px #6090d1,
0 0 100px #6090d1;
box-shadow: 0 0 5px #5fc198, 0 0 25px #5fc198, 0 0 50px #5fc198,
0 0 100px #5fc198;
}
.login-box a span,
@ -116,7 +117,7 @@ body {
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #6090d1);
background: linear-gradient(90deg, transparent, #5fc198);
animation: btn-anim1 1s linear infinite;
}
@ -136,7 +137,7 @@ body {
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #6090d1);
background: linear-gradient(180deg, transparent, #5fc198);
animation: btn-anim2 1s linear infinite;
animation-delay: 0.25s;
}
@ -157,9 +158,10 @@ body {
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #6090d1);
background: linear-gradient(270deg, transparent, #5fc198);
animation: btn-anim3 1s linear infinite;
animation-delay: 0.5s;
-webkit-animation: btn-anim3 1s linear infinite;
}
@keyframes btn-anim3 {
@ -178,7 +180,7 @@ body {
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #6090d1);
background: linear-gradient(360deg, transparent, #5fc198);
animation: btn-anim4 1s linear infinite;
animation-delay: 0.75s;
}

@ -1,41 +1,19 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="stylesheet" href="/Web/View/src/CSS/LogSign.css" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<title>Login</title>
</head>
<body>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="./View/src/CSS/Login.css" />
</head>
<body>
<div class="container user-select-none">
<div class="login-box col-12" id="form">
<div class="row mb-4">
@ -44,9 +22,9 @@
<form action="index.php?action=login" method="POST">
<div class="user-box mb-5 position-relative">
<input type="text" id="email" name="email" required="" />
<label class="py-1">Email</label>
<label>Email</label>
</div>
<div class="user-box mb-3 position-relative">
<div class="user-box mb-5 position-relative">
<input type="password" id="password" name="password" required="" />
<label>Password</label>
</div>
@ -69,5 +47,6 @@
</form>
</div>
</div>
</body>
</body>
</html>

@ -1,36 +1,19 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Scripted</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="./View/src/CSS/Main.css" />
</head>
<body>
</head>
<body>
<script>
function displayProfil() {
profil.classList.toggle("open");
@ -44,29 +27,20 @@
<!-- Profile page -->
<div class="col-4 d-flex" id="profilContainer">
<button
class="d-flex p-0 user-select-none"
id="btnProfil"
style="background: transparent; border: none; z-index: 10; height: fit-content;"
onclick="displayProfil()"
>
<button class="d-flex p-0 user-select-none" id="btnProfil" style="background: transparent; border: none; z-index: 10; height: fit-content;" onclick="displayProfil()">
<span class="material-symbols-outlined p-1 neonBg" id="profilIcon">
clear_all
</span>
</button>
<div
class="col-4"
id="profil"
style="
<div class="col-4" id="profil" style="
background-image: linear-gradient(15deg, #434343 0%, black 100%);
border-radius: 10px;
height: 100%;
z-index: 2;
"
>
">
<div class="row py-5 d-flex justify-content-center mx-0">
<?php
if (isset($_SESSION['role']) && $_SESSION['role'] == 'user'){
if (isset($_SESSION['role']) && $_SESSION['role'] == 'user') {
echo '<img
src="./View/assets/img/CyberpunkGirl4.png"
alt="Profil"
@ -79,7 +53,7 @@
border: 2px solid #44fff6;
"
/>
<p class="d-flex justify-content-center m-0 p-0">' .$_SESSION['pseudo'].'</p>
<p class="d-flex justify-content-center m-0 p-0">' . $_SESSION['pseudo'] . '</p>
<div
class="d-flex justify-content-center align-self-end p-0 m-0 user-select-none"
@ -92,8 +66,7 @@
<span class="button-text">Logout</span>
</a>
</div>';
}
elseif (isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){
} elseif (isset($_SESSION['role']) && $_SESSION['role'] == 'admin') {
echo '<img
src="./View/assets/img/CyberpunkGirl4.png"
alt="Profil"
@ -109,7 +82,7 @@
<p
class="d-flex justify-content-center m-0 p-0"
style="font-weight: bold; font-size: 18px"
>' .$_SESSION['pseudo'].'</p>
>' . $_SESSION['pseudo'] . '</p>
<div
class="d-flex flex-column align-items-center align-self-end p-0 m-0 user-select-none"
@ -157,8 +130,7 @@
<span class="button-text">Logout</span>
</a>
</div>';
}
else {
} else {
echo '<div class="d-flex justify-content-center align-self-center p-0 m-0" id="container">';
echo '<a class="logButton" href="index.php?action=goToLogin">';
echo ' <span class="circle" aria-hidden="true">';
@ -183,32 +155,33 @@
<!-- Solo -->
<div class="row m-0 pt-4 pb-5 d-flex justify-content-center text-center">
<a class="cssbuttons-io"
<?php
if (isset($_SESSION['role']) && $_SESSION['role'] == 'user' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){
<a class="cssbuttons-io" <?php
if (isset($_SESSION['role']) && $_SESSION['role'] == 'user' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin') {
echo 'href="index.php?action=goToPresentation"';
}
else{
} else {
echo 'href="index.php?action=goToLogin"';
}
?>
id="btn-1">
<span
><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
?> id="btn-1">
<span><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"></path>
<path
d="M24 12l-5.657 5.657-1.414-1.414L21.172 12l-4.243-4.243 1.414-1.414L24 12zM2.828 12l4.243 4.243-1.414 1.414L0 12l5.657-5.657L7.07 7.757 2.828 12zm6.96 9H7.66l6.552-18h2.128L9.788 21z"
fill="currentColor"
></path>
<path d="M24 12l-5.657 5.657-1.414-1.414L21.172 12l-4.243-4.243 1.414-1.414L24 12zM2.828 12l4.243 4.243-1.414 1.414L0 12l5.657-5.657L7.07 7.757 2.828 12zm6.96 9H7.66l6.552-18h2.128L9.788 21z" fill="currentColor"></path>
</svg>
CodeQuest</span
>
CodeQuest</span>
</a>
</div>
<!-- Multijoueur -->
<div class="row m-0 pt-4 pb-5 d-flex justify-content-center text-center">
<a class="cssbuttons-io" href="./Presentation.html" id="btn-2">
<a class="cssbuttons-io"
<?php
if (isset($_SESSION['role']) && $_SESSION['role'] == 'user' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){
echo 'href="index.php?action=goToQueue"';
}
else{
echo 'href="index.php?action=goToLogin"';
}
?>
id="btn-2">
<span>
<svg fill="#ffffff" height="200px" width="200px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 468.493 468.493" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_iconCarrier"> <g>
<path d="M138.321,161.831h-17.437v-17.437c0-3.615-2.287-6.835-5.701-8.026c-5.319-1.855-10.904-2.796-16.6-2.796 c-5.696,0-11.281,0.941-16.6,2.796c-3.414,1.191-5.701,4.411-5.701,8.026v17.437H58.847c-3.615,0-6.834,2.287-8.025,5.7 c-1.856,5.318-2.797,10.904-2.797,16.601s0.941,11.283,2.797,16.601c1.191,3.413,4.411,5.699,8.025,5.699h17.437v17.437 c0,3.615,2.287,6.834,5.7,8.025c5.318,1.856,10.904,2.797,16.601,2.797c5.697,0,11.283-0.941,16.601-2.797 c3.413-1.191,5.7-4.41,5.7-8.025v-17.437h17.437c3.615,0,6.835-2.287,8.026-5.7c1.855-5.318,2.796-10.903,2.796-16.6 c0-5.696-0.941-11.281-2.796-16.6C145.156,164.118,141.937,161.831,138.321,161.831z M131.729,189.432h-19.344 c-4.694,0-8.5,3.806-8.5,8.5v19.344c-3.481,0.553-7.12,0.552-10.601,0v-19.344c0-4.694-3.806-8.5-8.5-8.5H65.44 c-0.276-1.741-0.415-3.511-0.415-5.3s0.139-3.56,0.415-5.301h19.344c4.694,0,8.5-3.806,8.5-8.5v-19.343 c3.482-0.553,7.12-0.553,10.601,0v19.343c0,4.694,3.806,8.5,8.5,8.5h19.343c0.276,1.741,0.415,3.511,0.415,5.301 C132.143,185.921,132.004,187.692,131.729,189.432z"></path>

@ -3,5 +3,6 @@
<!--script src="/root/node_modules/socket.io"></script-->
<script src="C:\wamp64\www\Scripted\node_modules/socket.io"></script>
<script src="C:\wamp64\www\Scripted\server.js"></script>
vous êtes dans la partie
</body>
</html>
Loading…
Cancel
Save