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

ServeurDeTest
nathan boileau 2 years ago
commit 1047cdbf3d

@ -11,7 +11,7 @@ $sel = "JeSuisUnSeldeHashageEtJeSuisUniqueEtTresSecuriseEtJeSuisTresLong";
//View
//Page
$vues['main'] = 'View/src/pages/Main.php';
$vues['main'] = 'View/src/pages/Main2.php';
$vues['presentation'] = 'View/src/pages/Presentation.html';
$vues['login'] = 'View/src/pages/LogSign/Login.php';
$vues['signUp'] = 'View/src/pages/LogSign/SignUp.php';

@ -17,7 +17,7 @@ class AdminModel
public function addNewEnigmeSolo(string $nom,string $enonce,string $aide,string $rappel,string $exemple,string $test,string $solution, string $prompt) : Enigme
{
$last = $this->enigme_gateway->findLastEnigma();
if ($last !== null){
if ($last != null){
$ordre = $last[0]->getOrdre() + 1;
} else {
$ordre = 1;
@ -61,7 +61,8 @@ async function submit(){
}
public function editEnigme(int $id, string $nom,string $enonce,string $aide,string $rappel,string $exemple,string $test,string $solution, string $prompt) : Enigme
{
$ordre = $this->enigme_gateway->findById($id)[0]->getOrdre();
$old = $this->enigme_gateway->findById($id)[0];
$ordre = $old->getOrdre();
$enigme = new Enigme($id,$nom, $enonce, $aide, $rappel, $exemple, $solution, $test, $ordre, 0, 0, $prompt);
$this->enigme_gateway->update($enigme);
$js = fopen("View/src/JS/$nom.js", "w");
@ -77,6 +78,9 @@ async function submit(){
check();
}");
fclose($js);
if ($old->getNom() != $nom){
unlink('View/src/JS/'.$old->getNom().'.js');
}
} else {
throw new Exception("Impossible d'ouvrir le fichier");
}

@ -51,6 +51,7 @@ class VisitorModel
$this->utilisateur_gateway->insert($utilisateur);
$_SESSION['role'] = 'user';
$_SESSION['utilisateur'] = $utilisateur;
$_SESSION['pseudo'] = $utilisateur->getPseudo();
}
public function login()
{
@ -71,7 +72,6 @@ class VisitorModel
throw new Exception("Mot de passe invalide");
}
$estAdmin = $this->utilisateur_gateway->getEstAdminByEmail($email);
var_dump($estAdmin);
if ($estAdmin == true) {
$_SESSION['role'] = "admin";
} else {
@ -79,5 +79,6 @@ class VisitorModel
}
$_SESSION['utilisateur'] = $utilisateur;
$_SESSION['connected'] = 'true';
$_SESSION['pseudo'] = $utilisateur->getPseudo();
}
}

@ -139,7 +139,7 @@ button:focus {
/* Button Login/ Logout animation */
button {
a {
position: relative;
display: inline-block;
cursor: pointer;
@ -152,12 +152,12 @@ button {
font-family: inherit;
}
button.logButton {
a.logButton {
width: 12rem;
height: 50px;
}
button.logButton .circle {
a.logButton .circle {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
display: block;
margin: 0;
@ -166,7 +166,7 @@ button.logButton .circle {
background: #fff;
border-radius: 1.625rem;
}
button.logButton .circle .icon {
a.logButton .circle .icon {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
position: absolute;
top: 0;
@ -174,14 +174,14 @@ button.logButton .circle .icon {
margin: auto;
background: #050e15;
}
button.logButton .circle .icon.arrow {
a.logButton .circle .icon.arrow {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
left: 0.625rem;
width: 1.125rem;
height: 0.125rem;
background: none;
}
button.logButton .circle .icon.arrow::before {
a.logButton .circle .icon.arrow::before {
position: absolute;
content: "";
top: -0.25rem;
@ -192,7 +192,7 @@ button.logButton .circle .icon.arrow::before {
border-right: 0.125rem solid #050e15;
transform: rotate(45deg);
}
button.logButton .button-text {
a.logButton .button-text {
transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
position: absolute;
top: 0;
@ -208,16 +208,16 @@ button.logButton .button-text {
text-transform: uppercase;
}
button:hover .circle {
a:hover .circle {
width: 100%;
}
button:hover .circle .icon.arrow {
a:hover .circle .icon.arrow {
background: #050e15;
transform: translate(1rem, 0);
}
button:hover .button-text {
a:hover .button-text {
color: #050e15;
}

@ -1,5 +1,5 @@
//~ Function that test the user code
async function submit(){
var test = editor.getValue()+`\n
def estPalindromeVerif(var):
@ -7,7 +7,6 @@ def estPalindromeVerif(var):
return True
else:
return False
import random as r
def testPalindrome(x):
l=[1,2,3,2,1]
@ -26,11 +25,10 @@ def testPalindrome(x):
return True
print(testPalindrome(5))
`;
`;
exec("print ('True')", "code");
exec(test, "solution");
result.innerHTML = "Test en cours...";
await new Promise(r => setTimeout(r, 1500));
check();
}
}

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="en">
<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="./View/src/CSS/Main2.css" />
</head>
<body>
<script>
function displayProfil() {
profil.classList.toggle("open");
profilIcon.classList.toggle("open");
profilContainer.classList.toggle("open");
mainPart.classList.toggle("open");
}
</script>
<div id="imgMain" class="container p-0 d-flex">
<!-- 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"
onclick="displayProfil()"
>
<span class="material-symbols-outlined p-1 neonBg" id="profilIcon">
clear_all
</span>
</button>
<div
class="col-4"
id="profil"
style="
background-color: #222831;
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' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){
echo '<img
src="./View/assets/img/CyberpunkGirl4.png"
alt="Profil"
id="imgProfil"
class="img-fluid rounded-circle align-self-center user-select-none"
style="
width: 125px;
height: 125px;
padding: 0;
border: 2px solid #44fff6;
"
/>
<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"
id="container"
>';
echo '<a class="logButton" href="index.php?action=logout">
<span class="circle" aria-hidden="true">
<span class="icon arrow"></span>
</span>
<span class="button-text">Logout</span>
</a>
</div>';
} else {
echo '<div class="d-flex justify-content-center align-self-center p-0 m-0" id="container">';
echo '<a class="logButton" href="index?action=goToLogin">';
echo ' <span class="circle" aria-hidden="true">';
echo ' <span class="icon arrow"></span>';
echo ' </span>';
echo ' <span class="button-text">Login</span>';
echo '</a>';
echo '</div>';
}
?>
</div>
</div>
</div>
<!-- End Profile page -->
<!-- Main page -->
<div class="col d-flex align-items-center user-select-none">
<div class="col-6 m-0 neonBg" id="mainPart" style="max-height: 80%; height: 70%">
<div class="row mx-0 pt-4 pb-5 text-center">
<h1>Scripted</h1>
</div>
<!-- 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'){
echo 'href="index.php?action=goToPresentation"';
}
else{
echo 'href="index.php?action=goToLogin"';
}
?>
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>
</svg>
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">
<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>
<path d="M254.329,166.478c0.009,0,0.019,0,0.028,0c7.996-0.009,14.459-6.501,14.44-14.497c-0.02-7.987-6.501-14.449-14.497-14.439 c-7.987,0.019-14.459,6.511-14.439,14.497C239.879,160.025,246.351,166.478,254.329,166.478z"></path>
<path d="M413.655,176.853c-15.05-16.238-39.613-18.106-57.137-4.34c-4.789,3.762-10.376,6.982-16.534,9.625 c-6.765-39.084-24.521-74.946-51.786-104.346c-15.049-16.24-39.611-18.11-57.141-4.344c-14.5,11.397-36.2,17.934-59.535,17.934 c-23.341,0-45.044-6.537-59.545-17.935C94.463,59.683,69.9,61.551,54.838,77.791C19.475,115.946,0,165.618,0,217.657 c0,19.499,2.732,38.81,8.122,57.398c3.94,13.584,14.402,24.161,27.984,28.293c4.044,1.23,8.175,1.833,12.271,1.833 c9.678,0,19.154-3.365,26.782-9.76c16.623-13.948,35.986-24.059,56.702-29.731c-4.216,16.521-6.402,33.645-6.402,51.037 c0,19.509,2.731,38.819,8.117,57.393c3.94,13.586,14.402,24.164,27.988,28.295c4.042,1.229,8.17,1.831,12.264,1.831 c9.679,0,19.157-3.367,26.782-9.764c26.931-22.595,61.155-35.038,96.366-35.038s69.435,12.443,96.365,35.038 c10.851,9.104,25.448,12.069,39.046,7.934c13.586-4.132,24.048-14.709,27.988-28.295c5.386-18.573,8.117-37.883,8.117-57.393 C468.493,264.68,449.018,215.006,413.655,176.853z M62.306,280.097c-5.739,4.811-13.167,6.312-20.378,4.117 c-7.197-2.189-12.518-7.559-14.598-14.729C22.466,252.708,20,235.27,20,217.657c0-46.981,17.582-91.825,49.505-126.269 c7.915-8.536,20.861-9.489,30.114-2.217c17.957,14.115,44.165,22.21,71.904,22.21c27.732,0,53.937-8.095,71.89-22.207 c9.265-7.274,22.208-6.321,30.118,2.214c25.198,27.172,41.391,60.45,47.16,96.697c-6.77,1.379-13.891,2.167-21.197,2.315 c0.952-1.937,1.498-4.11,1.49-6.416c-0.02-7.986-6.521-14.449-14.517-14.42c-7.986,0.019-14.439,6.52-14.419,14.516 c0.005,1.344,0.207,2.639,0.554,3.873c-13.69-2.876-25.901-8.161-35.168-15.44c-17.522-13.765-42.085-11.899-57.137,4.34 c-18.159,19.591-32.116,42.226-41.41,66.654C110.767,248.981,84.397,261.56,62.306,280.097z M441.167,368.549 c-2.08,7.173-7.4,12.542-14.599,14.731c-7.209,2.193-14.636,0.692-20.371-4.121c-30.527-25.611-69.316-39.716-109.221-39.716 s-78.693,14.105-109.22,39.716c-5.735,4.812-13.158,6.313-20.373,4.121c-7.197-2.189-12.519-7.558-14.598-14.731 c-4.861-16.763-7.326-34.199-7.326-51.823c0-46.989,17.582-91.835,49.506-126.277c4.349-4.692,10.22-7.09,16.164-7.09 c4.866,0,9.782,1.608,13.949,4.882c17.962,14.11,44.168,22.203,71.897,22.203s53.936-8.093,71.897-22.203 c9.258-7.273,22.203-6.326,30.113,2.208c31.924,34.443,49.506,79.289,49.506,126.277 C448.493,334.351,446.028,351.786,441.167,368.549z"></path>
<path d="M263.776,260.896h-17.437V243.46c0-3.615-2.287-6.835-5.7-8.026c-5.318-1.855-10.903-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.437h-17.436c-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.41,5.7,8.025,5.7h17.436v17.436 c0,3.615,2.287,6.834,5.7,8.025c5.319,1.856,10.905,2.797,16.601,2.797c5.697,0,11.283-0.941,16.601-2.797 c3.413-1.191,5.699-4.411,5.699-8.025v-17.436h17.437c3.614,0,6.834-2.286,8.025-5.699c1.855-5.317,2.797-10.903,2.797-16.602 s-0.941-11.285-2.797-16.602C270.61,263.182,267.39,260.896,263.776,260.896z M257.183,288.498h-19.344c-4.694,0-8.5,3.806-8.5,8.5 v19.343c-3.481,0.553-7.12,0.552-10.601,0v-19.343c0-4.694-3.806-8.5-8.5-8.5h-19.343c-0.276-1.741-0.415-3.511-0.415-5.301 s0.139-3.56,0.415-5.301h19.343c4.694,0,8.5-3.806,8.5-8.5v-19.343c3.482-0.553,7.12-0.552,10.601,0v19.344 c0,4.694,3.806,8.5,8.5,8.5h19.344c0.276,1.741,0.415,3.511,0.415,5.301S257.459,286.757,257.183,288.498z"></path>
<path d="M411.973,297.569c0.01,0,0.029,0,0.039,0c7.996-0.029,14.449-6.521,14.43-14.517c-0.029-7.986-6.52-14.449-14.516-14.42 c-7.987,0.019-14.449,6.52-14.42,14.507C397.524,291.116,403.996,297.569,411.973,297.569z"></path> <path d="M347.715,268.758c-7.987,0.01-14.459,6.491-14.448,14.487c0.01,7.986,6.491,14.459,14.487,14.449 c7.987-0.01,14.459-6.491,14.449-14.478C362.192,275.221,355.711,268.749,347.715,268.758z"></path>
<path d="M379.931,300.849c-0.087,0-0.164,0-0.251,0c-7.909,0.096-14.295,6.53-14.295,14.468c0,7.986,6.481,14.468,14.468,14.468 c0.019,0,0.039,0,0.048,0c0.029,0,0.058,0,0.087,0c0.02,0,0.039,0,0.058,0c7.986-0.029,14.439-6.54,14.41-14.526 C394.418,307.263,387.917,300.81,379.931,300.849z"></path>
<path d="M379.786,265.546c0.009,0,0.02,0,0.029,0c7.996-0.019,14.459-6.51,14.439-14.497c-0.019-7.996-6.511-14.459-14.497-14.439 c-7.995,0.019-14.458,6.511-14.439,14.497C365.327,259.084,371.81,265.546,379.786,265.546z"></path> </g> </g>
</svg>
ScriptRush
</span>
</a>
</div>
</div>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save